diff --git a/CMakeLists.txt b/CMakeLists.txt index 473d2ae3..7174d6a7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,7 +24,7 @@ include(cmake/string_catalog.cmake) add_versioned_package("gh:boostorg/mp11#boost-1.83.0") fmt_recipe(10.2.1) -add_versioned_package("gh:intel/cpp-std-extensions#646bdbe") +add_versioned_package("gh:intel/cpp-std-extensions#2fc35c7") add_versioned_package("gh:intel/cpp-baremetal-concurrency#fef18ca") add_versioned_package("gh:intel/cpp-baremetal-senders-and-receivers#113eeff") diff --git a/include/cib/callback.hpp b/include/cib/callback.hpp index 5d855573..c04af4cd 100644 --- a/include/cib/callback.hpp +++ b/include/cib/callback.hpp @@ -45,10 +45,14 @@ template struct callback { template ... Fs> // NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward) [[nodiscard]] constexpr auto add(Fs &&...fs) const { - return [&](std::index_sequence) { - return callback{ - {funcs[Is]..., std::forward(fs)...}}; - }(std::make_index_sequence{}); + callback cb; + auto i = std::size_t{}; + while (i < NumFuncs) { + cb.funcs[i] = funcs[i]; + ++i; + } + ((cb.funcs[i++] = std::forward(fs)), ...); + return cb; } /** diff --git a/include/cib/detail/config_details.hpp b/include/cib/detail/config_details.hpp index 0eab7b09..9d14473c 100644 --- a/include/cib/detail/config_details.hpp +++ b/include/cib/detail/config_details.hpp @@ -13,35 +13,33 @@ template constexpr static auto as_constant_v = std::integral_constant, Value>{}; -template struct args { - constexpr static auto value = stdx::make_tuple(as_constant_v...); -}; +template struct args {}; + +template struct config; -template -struct config : public detail::config_item { +template +struct config, ConfigTs...> : public detail::config_item { stdx::tuple configs_tuple; - CONSTEVAL explicit config(ConfigArgs, ConfigTs const &...configs) + CONSTEVAL explicit config(args, ConfigTs const &...configs) : configs_tuple{configs...} {} template [[nodiscard]] constexpr auto extends_tuple(Args const &...args) const { - return ConfigArgs::value.apply([&](auto const &...config_args) { - return configs_tuple.apply([&](auto const &...configs_pack) { - return stdx::tuple_cat( - configs_pack.extends_tuple(args..., config_args...)...); - }); + return configs_tuple.apply([&](auto const &...configs_pack) { + return stdx::tuple_cat(configs_pack.extends_tuple( + args..., as_constant_v...)...); }); } template [[nodiscard]] constexpr auto exports_tuple(Args const &...args) const { - return ConfigArgs::value.apply([&](auto const &...config_args) { - return configs_tuple.apply([&](auto const &...configs_pack) { - return stdx::tuple_cat( - configs_pack.exports_tuple(args..., config_args...)...); - }); + return configs_tuple.apply([&](auto const &...configs_pack) { + return stdx::tuple_cat(configs_pack.exports_tuple( + args..., as_constant_v...)...); }); } }; + +template config(Ts...) -> config; } // namespace cib::detail diff --git a/include/cib/detail/config_item.hpp b/include/cib/detail/config_item.hpp index 77b3ee95..ecb6a514 100644 --- a/include/cib/detail/config_item.hpp +++ b/include/cib/detail/config_item.hpp @@ -5,13 +5,15 @@ namespace cib::detail { struct config_item { template - [[nodiscard]] constexpr auto extends_tuple(Args const &...) const { - return stdx::make_tuple(); + [[nodiscard]] constexpr auto + extends_tuple(Args const &...) const -> stdx::tuple<> { + return {}; } template - [[nodiscard]] constexpr auto exports_tuple(InitArgs const &...) const { - return stdx::make_tuple(); + [[nodiscard]] constexpr auto + exports_tuple(InitArgs const &...) const -> stdx::tuple<> { + return {}; } }; } // namespace cib::detail diff --git a/include/cib/detail/exports.hpp b/include/cib/detail/exports.hpp index 9553bed6..d4cc3e7a 100644 --- a/include/cib/detail/exports.hpp +++ b/include/cib/detail/exports.hpp @@ -13,13 +13,15 @@ template struct service_entry { template struct exports : public detail::config_item { template - [[nodiscard]] constexpr auto extends_tuple(InitArgs const &...) const { - return stdx::make_tuple(extend{}...); + [[nodiscard]] constexpr auto extends_tuple(InitArgs const &...) const + -> stdx::tuple...> { + return {extend{}...}; } template - [[nodiscard]] constexpr auto exports_tuple(InitArgs const &...) const { - return stdx::make_tuple(Services{}...); + [[nodiscard]] constexpr auto + exports_tuple(InitArgs const &...) const -> stdx::tuple { + return {}; } }; } // namespace cib::detail diff --git a/include/cib/detail/extend.hpp b/include/cib/detail/extend.hpp index ec18770f..ab21de0f 100644 --- a/include/cib/detail/extend.hpp +++ b/include/cib/detail/extend.hpp @@ -16,8 +16,9 @@ struct extend : public config_item { CONSTEVAL explicit extend(Args const &...args) : args_tuple{args...} {} template - [[nodiscard]] constexpr auto extends_tuple(InitArgs const &...) const { - return stdx::make_tuple(*this); + [[nodiscard]] constexpr auto + extends_tuple(InitArgs const &...) const -> stdx::tuple { + return {*this}; } }; } // namespace cib::detail diff --git a/include/cib/detail/nexus_details.hpp b/include/cib/detail/nexus_details.hpp index 4ce12b2f..33361d7d 100644 --- a/include/cib/detail/nexus_details.hpp +++ b/include/cib/detail/nexus_details.hpp @@ -36,7 +36,7 @@ constexpr static auto initialized_builders = transform( return detail::service_entry{ built_service}; }, - chunk_by(sort(Config::config.extends_tuple()))); + stdx::gather_by(Config::config.extends_tuple())); template struct initialized { constexpr static auto value =