PrevUpHomeNext

Operator Macros

If you got here without reading the Operators section, go read that first. Here are the operator macros and their uses:

Table 1.1. Unary and Binary Operator-Defining Macros

Macro

Use

First/Left Operand Type

Right Operand Type

Notes

BOOST_YAP_USER_UNARY_OPERATOR

Unary operators.

An Expression instantiated from ExpressionTemplate macro parameter expr_template.

--

BOOST_YAP_USER_BINARY_OPERATOR

Binary operators.

Any type.

Any type.

At least one parameter must be an Expression instantiated from ExpressionTemplate macro parameter expr_template.

BOOST_YAP_USER_UDT_UNARY_OPERATOR

Free operators defined over non-Expression types constrained by a type trait (e.g. all std::map<>s).

Any non-Expression that satisfies the given type trait.

--

BOOST_YAP_USER_UDT_UDT_BINARY_OPERATOR

Free operators defined over non-Expression types constrained by a pair of type traits (e.g. a std::map<> on the left, and a std::vector<> on the right). Useful for type-asymmetric operators.

Any non-Expression that satisfies the left-hand type trait.

Any non-Expression that satisfies the right-hand type trait.

BOOST_YAP_USER_UDT_ANY_BINARY_OPERATOR

Free operators defined over pairs of non-Expression types, one constrained by a type trait and one not (e.g. a std::list<> on either side, and anything on the other).

Any non-Expression.

--

At least one parameter must satisfy the given type trait.


Some operators may only be defined as member functions, and so are not covered by general-purpose the unary and binary operator macros above:

Table 1.2. The Member-Only Operator Macros

Macro

Use

Operands

Notes

BOOST_YAP_USER_ASSIGN_OPERATOR

Assignment operator.

Any type except decltype(*this).

Does not conflict with the assignment or move assignment operators.

BOOST_YAP_USER_SUBSCRIPT_OPERATOR

Subscript operator.

Any type.

BOOST_YAP_USER_CALL_OPERATOR

Call operator taking any number of parameters.

Any type.

BOOST_YAP_USER_CALL_OPERATOR_N

Call operator taking exactly N parameters.

Any type.


Table 1.3. if_else Psuedo-Operator Macros

Macro

Use

Operands

Notes

BOOST_YAP_USER_EXPR_IF_ELSE

Free if_else() function that requires at least one parameter to be an expression.

Any type.

At least one parameter must be an Expression.

BOOST_YAP_USER_UDT_ANY_IF_ELSE

Free if_else() function for non-Expression types that requires at least one parameter to satisfy the given type trait.

Any non-Expression.

At least one parameter must satisfy the given type trait.


[Note] Note

Operands are handled in a uniform way across all functions defined by all the macros listed here. See How Expression Operands Are Treated for details.


PrevUpHomeNext