]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/mpl/doc/src/refmanual/quote.rst
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / mpl / doc / src / refmanual / quote.rst
CommitLineData
7c673cae
FG
1.. Metafunctions/Composition and Argument Binding//quote |40
2
3quote
4=====
5
6Synopsis
7--------
8
9.. parsed-literal::
10
11 template<
12 template< typename P1 > class F
13 , typename Tag = |unspecified|
14 >
15 struct quote1
16 {
17 // |unspecified|
18 // |...|
19 };
20
21 |...|
22
23 template<
24 template< typename P1,\ |...| typename P\ *n* > class F
25 , typename Tag = |unspecified|
26 >
27 struct quote\ *n*
28 {
29 // |unspecified|
30 // |...|
31 };
32
33
34Description
35-----------
36
37``quote``\ *n* is a higher-order primitive that wraps an *n*-ary |Metafunction| to create
38a corresponding |Metafunction Class|.
39
40
41Header
42------
43
44.. parsed-literal::
45
46 #include <boost/mpl/quote.hpp>
47
48
49Model of
50--------
51
52|Metafunction Class|
53
54
55Parameters
56----------
57
58+---------------+-----------------------+-----------------------------------------------+
59| Parameter | Requirement | Description |
60+===============+=======================+===============================================+
61| ``F`` | |Metafunction| | A metafunction to wrap. |
62+---------------+-----------------------+-----------------------------------------------+
63| ``Tag`` | Any type | A tag determining wrap semantics. |
64+---------------+-----------------------+-----------------------------------------------+
65
66
67Expression semantics
68--------------------
69
70For any *n*-ary |Metafunction| ``f`` and arbitrary type ``tag``:
71
72
73.. parsed-literal::
74
75 typedef quote\ *n*\ <f> g;
76 typedef quote\ *n*\ <f,tag> g;
77
78:Return type:
79 |Metafunction Class|
80
81:Semantics:
82 Equivalent to
83
84 .. parsed-literal::
85
86 struct g
87 {
88 template< typename A1,\ |...| typename A\ *n* > struct apply
89 : f<A1,\ |...|\ A\ *n*\ >
90 {
91 };
92 };
93
94 if ``f<A1,...An>`` has a nested type member ``::type``, and to
95
96 .. parsed-literal::
97
98 struct g
99 {
100 template< typename A1,\ |...| typename A\ *n* > struct apply
101 {
102 typedef f<A1,\ |...|\ A\ *n*\ > type;
103 };
104 };
105
106 otherwise.
107
108
109Example
110-------
111
112.. parsed-literal::
113
114 template< typename T > struct f1
115 {
116 typedef T type;
117 };
118
119 template<
120 typename T1, typename T2, typename T3, typename T4, typename T5
121 >
122 struct f5
123 {
124 // no 'type' member!
125 };
126
127 typedef quote\ ``1``\<f1>::apply<int>::type t1;
128 typedef quote\ ``5``\<f5>::apply<char,short,int,long,float>::type t5;
129
130 BOOST_MPL_ASSERT(( is_same< t1, int > ));
131 BOOST_MPL_ASSERT(( is_same< t5, f5<char,short,int,long,float> > ));
132
133
134See also
135--------
136
137|Composition and Argument Binding|, |Invocation|, |bind|, |lambda|, |protect|, |apply|
138
139
140