1212
1313
1414namespace cib ::detail {
15- template <typename ... ConfigTs>
15+ template <auto Value>
16+ CIB_CONSTEXPR static auto as_constant_v = std::integral_constant<std::remove_cv_t <std::remove_reference_t <decltype (Value)>>, Value>{};
17+
18+ template <auto ... Args>
19+ struct args {
20+ static CIB_CONSTEXPR auto value = ordered_set{as_constant_v<Args>...};
21+ };
22+
23+ template <typename ConfigArgs, typename ... ConfigTs>
1624 struct config : public detail ::config_item {
1725 std::tuple<ConfigTs...> configs_tuple;
1826
1927 CIB_CONSTEVAL explicit config (
28+ ConfigArgs,
2029 ConfigTs const & ... configs
2130 )
2231 : configs_tuple{configs...}
@@ -29,18 +38,22 @@ namespace cib::detail {
2938 BuildersT const & builders_tuple,
3039 Args const & ... args
3140 ) const {
32- return fold_right (configs_tuple, builders_tuple, [&](auto const & c, auto builders){
33- return c.init (builders, args...);
34- });
41+ return apply ([&](auto const & ... config_args){
42+ return fold_right (configs_tuple, builders_tuple, [&](auto const & c, auto builders){
43+ return c.init (builders, args..., config_args...);
44+ });
45+ }, ConfigArgs::value);
3546 }
3647
3748 template <typename ... Args>
3849 [[nodiscard]] CIB_CONSTEVAL auto exports_tuple (
3950 Args const & ... args
4051 ) const {
41- return apply ([&](auto const & ... configs_pack){
42- return type_list_cat (configs_pack.exports_tuple (args...)...);
43- }, configs_tuple);
52+ return apply ([&](auto const & ... config_args){
53+ return apply ([&](auto const & ... configs_pack){
54+ return type_list_cat (configs_pack.exports_tuple (args..., config_args...)...);
55+ }, configs_tuple);
56+ }, ConfigArgs::value);
4457 }
4558 };
4659}
0 commit comments