Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Macro BOOST_PROTO_LOCAL_ITERATE

BOOST_PROTO_LOCAL_ITERATE — Vertical repetition of a user-supplied macro.

Synopsis

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

BOOST_PROTO_LOCAL_ITERATE()

Description

BOOST_PROTO_LOCAL_ITERATE() is used generate the kind of repetitive code that is typical of EDSLs built with Proto. This macro causes the user-defined macro BOOST_PROTO_LOCAL_MACRO() to be expanded with values in the range specified by BOOST_PROTO_LOCAL_LIMITS.

Usage:

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 inclusion of BOOST_PROTO_LOCAL_ITERATE() 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
    >(
        

If BOOST_PROTO_LOCAL_LIMITS is not defined by the user, it defaults to (1, BOOST_PROTO_MAX_ARITY).

At each iteration, BOOST_PROTO_LOCAL_MACRO() is invoked with the current iteration number and the following 4 macro parameters:

  • BOOST_PROTO_LOCAL_typename_A
  • BOOST_PROTO_LOCAL_A
  • BOOST_PROTO_LOCAL_A_a
  • BOOST_PROTO_LOCAL_a

If these macros are not defined by the user, they default respectively to:

After including BOOST_PROTO_LOCAL_ITERATE(), the following macros are automatically undefined:

  • BOOST_PROTO_LOCAL_MACRO
  • BOOST_PROTO_LOCAL_LIMITS
  • BOOST_PROTO_LOCAL_typename_A
  • BOOST_PROTO_LOCAL_A
  • BOOST_PROTO_LOCAL_A_a
  • BOOST_PROTO_LOCAL_a


PrevUpHomeNext