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

PrevUpHomeNext

Macro BOOST_PROTO_EXTENDS

BOOST_PROTO_EXTENDS — For creating expression wrappers that add behaviors to a Proto expression template, like proto::extends<>, but while retaining POD-ness of the expression wrapper.

Synopsis

// In header: <boost/proto/extends.hpp>

BOOST_PROTO_EXTENDS(Expr, Derived, Domain)

Description

Equivalent to:

BOOST_PROTO_BASIC_EXTENDS(Expr, Derived, Domain)
BOOST_PROTO_EXTENDS_ASSIGN()
BOOST_PROTO_EXTENDS_SUBSCRIPT()
BOOST_PROTO_EXTENDS_FUNCTION()

If the Domain parameter is dependent, you can specify it as typename Domain, as in BOOST_PROTO_EXTENDS(Expr, Derived, typename Domain)

Example:

template< class Expr >
struct my_expr;

struct my_domain
  : proto::domain< proto::pod_generator< my_expr > >
{};

template< class Expr >
struct my_expr
{
    // OK, this makes my_expr<> a valid Proto expression extension.
    // my_expr<> has overloaded assignment, subscript,
    // and function call operators that build expression templates.
    BOOST_PROTO_EXTENDS(Expr, my_expr, my_domain)
};

// OK, my_expr<> is POD, so this is statically initialized:
my_expr< proto::terminal<int>::type > const _1 = {{1}};


PrevUpHomeNext