Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Macro BOOST_PROTO_REPEAT_FROM_TO

BOOST_PROTO_REPEAT_FROM_TO — Repeatedly invoke the specified macro.

Synopsis

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

BOOST_PROTO_REPEAT_FROM_TO(FROM, TO, MACRO)

Description

BOOST_PROTO_REPEAT_FROM_TO() is used to generate the kind of repetitive code that is typical of EDSLs built with Proto. BOOST_PROTO_REPEAT_FROM_TO(FROM, TO, MACRO) is equivalent to:

(, BOOST_PROTO_typename_A, BOOST_PROTO_A_const_ref, BOOST_PROTO_A_const_ref_a, BOOST_PROTO_ref_a)
(, BOOST_PROTO_typename_A, BOOST_PROTO_A_const_ref, BOOST_PROTO_A_const_ref_a, BOOST_PROTO_ref_a)
...
(, BOOST_PROTO_typename_A, BOOST_PROTO_A_const_ref, BOOST_PROTO_A_const_ref_a, BOOST_PROTO_ref_a)

Example:

// Generate BOOST_PROTO_MAX_ARITY-1 overloads of the
// following construct() function template.
proto::result_of::make_expr<                             \
    proto::tag::function                                          \
  , proto::make_expr<                                      \
        proto::tag::function                                      \
    >(                                                            \
        

The above invocation of BOOST_PROTO_REPEAT_FROM_TO() will generate the following code:

proto::result_of::make_expr<
    proto::tag::function
  , proto::make_expr<
        proto::tag::function
    >(
        proto::result_of::make_expr<
    proto::tag::function
  , proto::make_expr<
        proto::tag::function
    >(
        


PrevUpHomeNext