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

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
Front Page / Macros / Broken Compiler Workarounds / BOOST_MPL_AUX_LAMBDA_SUPPORT

BOOST_MPL_AUX_LAMBDA_SUPPORT

Synopsis

#define BOOST_MPL_AUX_LAMBDA_SUPPORT(arity, fun, params) \
    unspecified token sequence \
/**/

Description

Enables metafunction fun for the use in Lambda Expressions on compilers that don't support partial template specialization or/and template template parameters. Expands to nothing on conforming compilers.

Header

#include <boost/mpl/aux_/lambda_support.hpp>

Parameters

Parameter Requirement Description
arity An integral constant The metafunction's arity, i.e. the number of its template parameters, including the defaults.
fun A legal identifier token The metafunction's name.
params A PP-tuple A tuple of the metafunction's parameter names, in their original order, including the defaults.

Expression semantics

For any integral constant n, a Metafunction fun, and arbitrary types A1,... An:

template< typename A1,... typename An > struct fun
{
    // ...

    BOOST_MPL_AUX_LAMBDA_SUPPORT(n, fun, (A1,...An))
};
Precondition:Appears in fun's scope, immediately followed by the scope-closing bracket (}).
Return type:None.
Semantics:Expands to nothing and has no effect on conforming compilers. On compilers that don't support partial template specialization or/and template template parameters expands to an unspecified token sequence enabling fun to participate in Lambda Expressions with the semantics described in this manual.

Example

template< typename T, typename U = int > struct f
{
    typedef T type[sizeof(U)];

    BOOST_MPL_AUX_LAMBDA_SUPPORT(2, f, (T,U))
};

typedef apply1< f<char,_1>,long >::type r;
BOOST_MPL_ASSERT(( is_same< r, char[sizeof(long)] > ));

See also

Macros, Metafunctions, Lambda Expression