Back to Arangodb

protect

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

3.12.9.13.2 KB
Original Source

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

protect

Synopsis

template<
      typename F
    >
struct[protect](./protect.html){
    //_unspecified_//_..._};

Description

protect is an identity wrapper for a Metafunction Class that prevents its argument from being recognized as a bind expression.

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

Parameters

ParameterRequirementDescription
FMetafunction ClassA metafunction class to wrap.

Expression semantics

For any Metafunction Class f:

typedef[protect](./protect.html)<f> g;

| Return type: |

Metafunction Class.

| | Semantics: |

If f is a bind expression, equivalent to

struct g
{
    template<
          typename U1 =_unspecified_,_..._typename U_n_=_unspecified_>
    struct[apply](./apply.html):[apply\_wrap](./apply-wrap.html)_n_<f,U1,_..._U_n_>
    {
    };
};

otherwise equivalent to typedef f g;.

|

Example

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

typedef[bind](./bind.html)<[quote](./quote.html)3<[if\_](./if.html)>,[\_1](./placeholders.html),[\_2](./placeholders.html),[bind](./bind.html)<f,[\_1](./placeholders.html),[\_2](./placeholders.html)> > b1;
typedef[bind](./bind.html)<[quote](./quote.html)3<[if\_](./if.html)>,[\_1](./placeholders.html),[\_2](./placeholders.html),[protect](./protect.html)<[bind](./bind.html)<f,[\_1](./placeholders.html),[\_2](./placeholders.html)> > > b2;

typedef[apply\_wrap](./apply-wrap.html)2< b1,[false\_](./bool.html),char >::type r1;
typedef[apply\_wrap](./apply-wrap.html)2< b2,[false\_](./bool.html),char >::type r2;[BOOST\_MPL\_ASSERT](./assert.html)(( is_same<r1,char> ));[BOOST\_MPL\_ASSERT](./assert.html)(( is_same<r2,[protect](./protect.html)<[bind](./bind.html)<f,[\_1](./placeholders.html),[\_2](./placeholders.html)> > > ));

See also

Composition and Argument Binding, invocation, bind, quote, apply_wrap

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