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