source:
downloads/boost_1_34_1/libs/mpl/doc/src/refmanual/protect.rst
@
29
| Last change on this file since 29 was 29, checked in by landauf, 17 years ago | |
|---|---|
| File size: 2.1 KB | |
protect
Synopsis
template<
typename F
>
struct protect
{
// |unspecified|
// |...|
};
Description
protect is an identity wrapper for a |Metafunction Class| that prevents its argument from being recognized as a |bind expression|.
Header
#include <boost/mpl/protect.hpp>
Parameters
| Parameter | Requirement | Description |
|---|---|---|
| F | |Metafunction Class| | A metafunction class to wrap. |
Expression semantics
For any |Metafunction Class| f:
typedef protect<f> g;
| Return type: | |
|---|---|
| Semantics: | If f is a |bind expression|, equivalent to
struct g
{
template<
typename U1 = |unspecified|,|...| typename Un = |unspecified|
>
struct apply
: apply_wrapn<f,U1,|...|Un>
{
};
};
otherwise equivalent to typedef f g;. |
Example
FIXME
struct f
{
template< typename T1, typename T2 > struct apply
{
// |...|
};
};
typedef bind<_1, protect< bind<f,_1,_2> > >
typedef apply_wrap0< f0 >::type r1;
typedef apply_wrap0< g0 >::type r2;
typedef apply_wrap2< f2,int,char >::type r3;
BOOST_MPL_ASSERT(( is_same<r1,char> ));
BOOST_MPL_ASSERT(( is_same<r2,char> ));
BOOST_MPL_ASSERT(( is_same<r3,char> ));
Note: See TracBrowser
for help on using the repository browser.










