@@ -44,11 +44,11 @@ Actions are added to the flow inside a component's `cib::config`.
4444struct morning {
4545 constexpr auto config = cib::config(
4646 cib::extend<MorningRoutine>(
47- WAKE_UP >>
48- selfcare::SHOWER >>
49- selfcare::GET_DRESSED >>
50- food::MAKE_COFFEE >>
51- food::DRINK_COFFEE));
47+ * WAKE_UP >>
48+ * selfcare::SHOWER >>
49+ * selfcare::GET_DRESSED >>
50+ * food::MAKE_COFFEE >>
51+ * food::DRINK_COFFEE));
5252};
5353----
5454
@@ -58,6 +58,17 @@ a shower. The flow library will order actions in a flow to respect these
5858dependencies. The actions will be executed in an order that respects all given
5959dependencies.
6060
61+ The `*` operator is used to explicitly add an action to the
62+ flow. Without the `*` operator an action is just a reference.
63+ A compile-time error will be triggered if an action is referenced without ever
64+ being explicitly added to the flow. If an action is added under a compile-time
65+ or runtime conditional, and the conditional is false, then it is as if the
66+ action was never added at all.
67+
68+ The behavior of the `*` operator ensures that merely referencing an
69+ action to create an ordering dependency doesn't unintentionally add the action
70+ to the flow.
71+
6172If we only use the `morning` component in our project, the `MorningRoutine` flow
6273graph would look like the following:
6374
@@ -93,11 +104,11 @@ struct childcare {
93104 constexpr auto config = cib::config(
94105 cib::extend<MorningRoutine>(
95106 food::MAKE_COFFEE >> // this step exists in the MorningRoutine flow
96- PACK_SCHOOL_LUNCHES >> // new
107+ * PACK_SCHOOL_LUNCHES >> // new
97108 food::DRINK_COFFEE >> // existing
98- food::MAKE_BREAKFAST >> // new
99- food::EAT_BREAKFAST >> // new
100- SEND_KIDS_TO_SCHOOL)); // new
109+ * food::MAKE_BREAKFAST >> // new
110+ * food::EAT_BREAKFAST >> // new
111+ * SEND_KIDS_TO_SCHOOL)); // new
101112};
102113----
103114
@@ -140,7 +151,7 @@ struct exercise {
140151 constexpr auto config = cib::config(
141152 cib::extend<MorningRoutine>(
142153 morning::WAKE_UP >>
143- RIDE_STATIONARY_BIKE >>
154+ * RIDE_STATIONARY_BIKE >>
144155 selfcare::SHOWER));
145156};
146157----
@@ -321,7 +332,47 @@ namespace example_component {
321332 constexpr auto config = cib::config(
322333 cib::extend<MyFlow>(
323334 // no order requirement between these actions
324- SOME_ACTION && SOME_OTHER_ACTION));
335+ *SOME_ACTION && *SOME_OTHER_ACTION));
336+ }
337+ ----
338+
339+ ==== `operator*`
340+
341+ Explicitly add an action to the flow. Actions used in flow extensions without
342+ the `*` will be treated as references only and will not be added to the
343+ flow at that location. It is a compilation error if an action is not added
344+ with a `*` in exactly one location in the overall config.
345+
346+ Actions can be added and ordered all at once:
347+
348+ [source,cpp]
349+ ----
350+ namespace example_component {
351+ constexpr auto config = cib::config(
352+ cib::extend<MyFlow>(
353+ // Add both actions and create an ordering between them.
354+ *SOME_ACTION >> *SOME_OTHER_ACTION));
355+ }
356+ ----
357+
358+ Actions can also be added and ordered seperately:
359+
360+ [source,cpp]
361+ ----
362+ namespace other_component {
363+ constexpr auto INIT_SOMETHING = ...
364+
365+ constexpr auto config = cib::config(
366+ cib::extend<MyFlow>(*INIT_SOMETHING));
367+ }
368+
369+ namespace example_component {
370+ constexpr auto DO_A_THING = ...
371+
372+ constexpr auto config = cib::config(
373+ cib::extend<MyFlow>(
374+ other_component::INIT_SOMETHING >>
375+ *DO_A_THING));
325376}
326377----
327378
0 commit comments