BOOST_YAP_USER_SUBSCRIPT_OPERATOR
// In header: <boost/yap/user_macros.hpp>
BOOST_YAP_USER_SUBSCRIPT_OPERATOR(expr_template)
Defines operator overloads for operator[]() that each produce an expression instantiated from the expr_template expression template. One overload is defined for each of the qualifiers const &
, &
, and &&
. For the lvalue reference overloads, *this
is captured by reference into the resulting expression. For the rvalue reference overload, *this
is moved into the resulting expression.
The rhs parameter to each of the defined overloads may be any type, including an expression, except that the overloads are cosntrained by std::enable_if<> not to conflict with the assignment and move assignement operators. If rhs is a non-expression, it is wrapped in a terminal expression.
Example:
template <boost::yap::expr_kind Kind, typename Tuple> struct user_expr { static const boost::yap::expr_kind kind = Kind; Tuple elements; // Member operator overloads for operator[](). These will match any value // on the right-hand side, even another expression. BOOST_YAP_USER_SUBSCRIPT_OPERATOR(::user_expr) };
Parameters: |
|