Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

added boost

File size: 2.8 KB

quote

Synopsis

template<
      template< typename P1 > class F
    , typename Tag = |unspecified|
    >
struct quote1
{
    // |unspecified|
    // |...|
};
|...|
template<
      template< typename P1,|...| typename Pn > class F
    , typename Tag = |unspecified|
    >
struct quoten
{
    // |unspecified|
    // |...|
};

Description

quoten is a higher-order primitive that wraps an n-ary |Metafunction| to create a corresponding |Metafunction Class|.

Parameters

Parameter Requirement Description
F |Metafunction| A metafunction to wrap.
Tag Any type A tag determining wrap semantics.

Expression semantics

For any n-ary |Metafunction| f and arbitrary type tag:

typedef quoten<f> g;
typedef quoten<f,tag> g;
Return type:

|Metafunction Class|

Semantics:

Equivalent to

struct g
{
    template< typename A1,|...| typename An > struct apply
        : f<A1,|...|An>
    {
    };
};

if f<A1,...An> has a nested type member ::type, and to

struct g
{
    template< typename A1,|...| typename An > struct apply
    {
        typedef f<A1,|...|An> type;
    };
};

otherwise.

Example

template< typename T > struct f1
{
    typedef T type;
};
template<
    typename T1, typename T2, typename T3, typename T4, typename T5
    >
struct f5
{
    // no 'type' member!
};
typedef quote1<f1>::apply<int>::type t1;
typedef quote5<f5>::apply<char,short,int,long,float>::type t5;
BOOST_MPL_ASSERT(( is_same< t1, int > ));
BOOST_MPL_ASSERT(( is_same< t5, f5<char,short,int,long,float> > ));

Docutils System Messages

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