Back to Arangodb

lambda

3rdParty/boost/1.78.0/libs/mpl/doc/refmanual/lambda.html

3.12.9.13.6 KB
Original Source

| Prev Next | Back Along | Up Home | Full TOC | Front Page / Metafunctions / Composition and Argument Binding / lambda |

lambda

Synopsis

template<
      typename X
    , typename Tag =_unspecified_>
struct[lambda](./lambda.html){
    typedef_unspecified_type;
};

Description

If X is a Placeholder Expression, transforms X into a corresponding Metafunction Class, otherwise X is returned unchanged.

#include <[boost/mpl/lambda.hpp](../../../../boost/mpl/lambda.hpp)>

Parameters

ParameterRequirementDescription
XAny typeAn expression to transform.
TagAny typeA tag determining transform semantics.

Expression semantics

For arbitrary types x and tag:

typedef[lambda](./lambda.html)<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](./protect.html)<[bind](./bind.html)<[quote](./quote.html)_n_<X>
    ,[lambda](./lambda.html)<a1>::type,_..._[lambda](./lambda.html)<a_n_>::type
    > > f;

otherwise, f is identical to x.

|

typedef[lambda](./lambda.html)<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](./protect.html)<[bind](./bind.html)<[quote](./quote.html)_n_<X,tag>
    ,[lambda](./lambda.html)<a1,tag>::type,_..._[lambda](./lambda.html)<a_n_,tag>::type
    > > f;

otherwise, f is identical to x.

|

Example

template< typename N1, typename N2 > struct int_plus
    :[int\_](./int.html)<( N1::value + N2::value )>
{
};

typedef[lambda](./lambda.html)< int_plus<[\_1](./placeholders.html),[int\_](./int.html)<42> > >::type f1;
typedef[bind](./bind.html)<[quote](./quote.html)2<int_plus>,[\_1](./placeholders.html),[int\_](./int.html)<42> > f2;

typedef f1::[apply](./apply.html)<42>::type r1;
typedef f2::[apply](./apply.html)<42>::type r2;[BOOST\_MPL\_ASSERT\_RELATION](./assert-relation.html)( r1::value, ==, 84 );[BOOST\_MPL\_ASSERT\_RELATION](./assert-relation.html)( r2::value, ==, 84 );

See also

Composition and Argument Binding, invocation, Placeholders, bind, quote, protect, apply

| Prev Next | Back Along | Up Home | Full TOC |

Copyright © 2001-2009 Aleksey Gurtovoy and David Abrahams Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |