| Home | Libraries | People | FAQ | More

## Macro BOOST_PROTO_BASIC_EXTENDS

BOOST_PROTO_BASIC_EXTENDS — For creating expression wrappers that add members 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_BASIC_EXTENDS(Expr, Derived, Domain)

## Description

`BOOST_PROTO_BASIC_EXTENDS()` adds the basic typedefs, member functions, and data members necessary to make a struct a valid Proto expression extension. It does not add any constructors, virtual functions or access control blocks that would render the containing struct non-POD.

`Expr` is the Proto expression that the enclosing struct extends. `Derived` is the type of the enclosing struct. `Domain` is the Proto domain to which this expression extension belongs. (See `proto::domain<>`.) Can be preceeded with "`typename`" if the specified domain is a dependent type.

`BOOST_PROTO_BASIC_EXTENDS()` adds to its enclosing struct exactly one data member of type `Expr`.

If the `Domain` parameter is dependent, you can specify it as `typename Domain`, as in `BOOST_PROTO_BASIC_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<> does /not/ have overloaded assignment, subscript,
        // and function call operators that build expression templates, however.
        BOOST_PROTO_BASIC_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}};

See also:

- `BOOST_PROTO_EXTENDS_ASSIGN()`
- `BOOST_PROTO_EXTENDS_SUBSCRIPT()`
- `BOOST_PROTO_EXTENDS_FUNCTION()`
- `BOOST_PROTO_EXTENDS()`