@@ -99,16 +99,17 @@ TEST_CASE("configuration with multiple components, services, and features") {
99
99
}
100
100
}
101
101
102
- struct SimpleConditionalComponent {
102
+ template <auto V> struct SimpleConditionalComponent {
103
+
103
104
constexpr static auto config = cib::config(cib::conditional(
104
- []< typename Arg>(Arg ) { return Arg::value == 42 ; },
105
+ []( ) { return V == 42 ; },
105
106
cib::extend<TestCallback<0 >>([]() { is_callback_invoked<0 > = true ; })));
106
107
};
107
108
108
109
template <int ConditionalValue> struct ConditionalTestProject {
109
- constexpr static auto config =
110
- cib::config (cib::args<ConditionalValue>, cib:: exports<TestCallback<0 >>,
111
- cib::components<SimpleConditionalComponent>);
110
+ constexpr static auto config = cib::config(
111
+ cib::exports<TestCallback<0 >>,
112
+ cib::components<SimpleConditionalComponent<ConditionalValue> >);
112
113
};
113
114
114
115
TEST_CASE (" configuration with one conditional component" ) {
@@ -131,21 +132,20 @@ TEST_CASE("configuration with one conditional component") {
131
132
}
132
133
}
133
134
134
- template <int Id> struct ConditionalComponent {
135
- constexpr static auto config = cib::config(
136
- cib::conditional ([]< typename Arg>(Arg ) { return Arg::value == Id; },
137
- cib::extend<TestCallback< Id>>(
138
- []() { is_callback_invoked<Id> = true ; })));
135
+ template <int EnId, int Id> struct ConditionalComponent {
136
+ constexpr static auto config = cib::config(cib::conditional(
137
+ []( ) { return EnId == Id; }, cib::extend<TestCallback<Id>>([]() {
138
+ is_callback_invoked< Id> = true ;
139
+ })));
139
140
};
140
141
141
142
template <int EnabledId> struct ConditionalConfig {
142
143
constexpr static auto config = cib::config(
143
- cib::args<EnabledId>,
144
-
145
144
cib::exports<TestCallback<0 >, TestCallback<1 >, TestCallback<2 >>,
146
145
147
- cib::components<ConditionalComponent<0 >, ConditionalComponent<1 >,
148
- ConditionalComponent<2 >>);
146
+ cib::components<ConditionalComponent<EnabledId, 0 >,
147
+ ConditionalComponent<EnabledId, 1 >,
148
+ ConditionalComponent<EnabledId, 2 >>);
149
149
};
150
150
151
151
TEST_CASE (" configuration with conditional features" ) {
0 commit comments