Back to Arangodb

apply_wrap

3rdParty/boost/1.78.0/libs/mpl/doc/refmanual/apply-wrap.html

3.12.9.13.4 KB
Original Source

| Prev Next | Back Along | Up Home | Full TOC | Front Page / Metafunctions / Invocation / apply_wrap |

apply_wrap

Synopsis

template<
      typename F
    >
struct apply_wrap0
{
    typedef_unspecified_type;
};

template<
      typename F, typename A1
    >
struct apply_wrap1
{
    typedef_unspecified_type;
};_..._template<
      typename F, typename A1,_..._typename An
    >
struct[apply\_wrap](./apply-wrap.html)_n_{
    typedef_unspecified_type;
};

Description

Invokes a Metafunction Class F with arguments A1,... An.

In essence, apply_wrap forms are nothing more than syntactic wrappers around F::apply<A1,... An>::type / F::apply::type expressions (hence the name). They provide a more concise notation and higher portability than their underlaying constructs at the cost of an extra template instantiation.

#include <[boost/mpl/apply\_wrap.hpp](../../../../boost/mpl/apply_wrap.hpp)>

Parameters

ParameterRequirementDescription
FMetafunction ClassA metafunction class to invoke.
A1,... AnAny typeInvocation arguments.

Expression semantics

For any Metafunction Class f and arbitrary types a1,... an:

typedef[apply\_wrap](./apply-wrap.html)_n_<f,a1,_..._an>::type t;

| Return type: | Any type. | | Semantics: | If n > 0, equivalent to typedef f::apply<a1,... an>::type t;, otherwise equivalent to either typedef f::apply::type t; or typedef f::apply<>::type t; depending on whether f::apply is a class or a class template. |

Example

struct f0
{
    template< typename T = int > struct[apply](./apply.html){
        typedef char type;
    };
};

struct g0
{
    struct[apply](./apply.html){ typedef char type; };
};

struct f2
{
    template< typename T1, typename T2 > struct[apply](./apply.html){
        typedef T2 type;
    };
};

typedef[apply\_wrap](./apply-wrap.html)0< f0 >::type r1;
typedef[apply\_wrap](./apply-wrap.html)0< g0 >::type r2;
typedef[apply\_wrap](./apply-wrap.html)2< f2,int,char >::type r3;[BOOST\_MPL\_ASSERT](./assert.html)(( is_same<r1,char> ));[BOOST\_MPL\_ASSERT](./assert.html)(( is_same<r2,char> ));[BOOST\_MPL\_ASSERT](./assert.html)(( is_same<r3,char> ));

See also

Metafunctions, invocation, apply, lambda, quote, bind, protect

| 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) |