Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/libs/mpl/doc/src/refmanual/lambda.rst @ 12

Last change on this file since 12 was 12, checked in by landauf, 18 years ago

added boost

File size: 2.9 KB

lambda

Synopsis

template<
      typename X
    , typename Tag = |unspecified|
    >
struct lambda
{
    typedef |unspecified| type;
};

Description

If X is a |placeholder expression|, transforms X into a corresponding |Metafunction Class|, otherwise X is returned unchanged.

Parameters

Parameter Requirement Description
X Any type An expression to transform.
Tag Any type A tag determining transform semantics.

Expression semantics

For arbitrary types x and tag:

typedef lambda<x>::type f;
Return type:

|Metafunction Class|.

Semantics:

If x is a |placeholder expression| in a general form X<a1,...an>, where X is a class template and a1,... an are arbitrary types, equivalent to

typedef protect< bind<
      quoten<X>
    , lambda<a1>::type,|...| lambda<an>::type
    > > f;

otherwise, f is identical to x.

typedef lambda<x,tag>::type f;
Return type:

|Metafunction Class|.

Semantics:

If x is a |placeholder expression| in a general form X<a1,...an>, where X is a class template and a1,... an are arbitrary types, equivalent to

typedef protect< bind<
      quoten<X,tag>
    , lambda<a1,tag>::type,|...| lambda<an,tag>::type
    > > f;

otherwise, f is identical to x.

Example

template< typename N1, typename N2 > struct int_plus
    : int_<( N1::value + N2::value )>
{
};
typedef lambda< int_plus<_1, int_<42> > >::type f1;
typedef bind< quote2<int_plus>, _1, int_<42> > f2;
typedef f1::apply<42>::type r1;
typedef f2::apply<42>::type r2;
BOOST_MPL_ASSERT_RELATION( r1::value, ==, 84 );
BOOST_MPL_ASSERT_RELATION( r2::value, ==, 84 );

Docutils System Messages

?????????????????
Note: See TracBrowser for help on using the repository browser.