Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of boost. Click here for the latest Boost documentation.
PrevUpHomeNext

Macro BOOST_YAP_USER_EXPR_IF_ELSE

BOOST_YAP_USER_EXPR_IF_ELSE

Synopsis

// In header: <boost/yap/user_macros.hpp>

BOOST_YAP_USER_EXPR_IF_ELSE(expr_template)

Description

Defines a 3-parameter function if_else() that acts as an analogue to the ternary operator (?:), since the ternary operator is not user-overloadable. The return type of if_else() is an expression instantiated from the expr_template expression template.

At least one parameter to if_else() must be an expression.

For each parameter E passed to if_else(), if E is an rvalue, E is moved into the result, and otherwise E is captured by reference into the result.

Example:


Parameters:

expr_template

The expression template to use to instantiate the result expression. expr_template must be an ExpressionTemplate.


PrevUpHomeNext