...one of the most highly
regarded and expertly designed C++ library projects in the
world. — Herb Sutter and Andrei
The syntax is
if_(conditional_expression) [ sequenced_statements ] .else_ [ sequenced_statements ]
Take note that
else has a
leading dot and a trailing underscore:
Example: This code prints out all the elements and appends
" > 5",
== 5" or
" < 5"
depending on the element's actual value:
std::for_each(c.begin(), c.end(), if_(arg1 > 5) [ cout << arg1 << " > 5\n" ] .else_ [ if_(arg1 == 5) [ cout << arg1 << " == 5\n" ] .else_ [ cout << arg1 << " < 5\n" ] ] );
Notice how the
statement is nested.