![]() |
![]() ![]() ![]() ![]() |
![]() |
The MPL Reference Manual: quoteBoost , ,
|
|||||||||||||||||||||
| Front Page / Metafunctions / Composition and Argument Binding / quote |
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
// ...
};
цитатаnявляется примитивным более высокого порядка, который обертываетn-aryМетафункциядля создания соответствующейКласс метафункций.
#include <boost/mpl/quote.hpp>
| Parameter | Requirement | Description |
|---|---|---|
| F | Метафункция | Метафункция для обертывания. |
| Таг | Любой тип | Тег, определяющий семантику обертывания. |
Для любогоn-aryМетафункцияfи произвольный типтег:
typedef quoten<f> g; typedef quoten<f,tag> g;
| Return type: | |
|---|---|
| Semantics: | Equivalent to
struct g
{
template< typename A1,... typename An > struct apply
: f<A1,...An>
{
};
};
Еслиf
struct g
{
template< typename A1,... typename An > struct apply
{
typedef f<A1,...An> type;
};
};
otherwise. |
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> > ));
Статья The MPL Reference Manual: quote раздела может быть полезна для разработчиков на c++ и boost.
:: Главная :: ::
реклама |