...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::parser::switch_
// In header: <boost/parser/parser.hpp> template<typename T> constexpr auto switch_(T x);
Returns a switch
-like parser. The resulting parser uses the given value x
to select one of the following value/parser pairs, and to apply the selected parser. x
may be a value to be used directly, or a unary invocable that takes a reference to the parse context, and returns the value to use. You can add more value/parser cases to the returned parser, using its call operator, e.g. switch_(x)(y1, p1)(y2, p2)
. As with the x
passed to this function, each yN
value can be a value or a unary invocable.