1 | <?xml version="1.0" encoding="utf-8" ?> |
---|
2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
---|
3 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
---|
4 | <head> |
---|
5 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
---|
6 | <meta name="generator" content="Docutils 0.3.6: http://docutils.sourceforge.net/" /> |
---|
7 | <title>The MPL Reference Manual: quote</title> |
---|
8 | <link rel="stylesheet" href="../style.css" type="text/css" /> |
---|
9 | </head> |
---|
10 | <body class="docframe refmanual"> |
---|
11 | <table class="header"><tr class="header"><td class="header-group navigation-bar"><span class="navigation-group"><a href="./bind.html" class="navigation-link">Prev</a> <a href="./arg.html" class="navigation-link">Next</a></span><span class="navigation-group-separator"> | </span><span class="navigation-group"><a href="./bind.html" class="navigation-link">Back</a> <a href="./arg.html" class="navigation-link">Along</a></span><span class="navigation-group-separator"> | </span><span class="navigation-group"><a href="./composition-and-argument.html" class="navigation-link">Up</a> <a href="../refmanual.html" class="navigation-link">Home</a></span><span class="navigation-group-separator"> | </span><span class="navigation-group"><a href="./refmanual_toc.html" class="navigation-link">Full TOC</a></span></td> |
---|
12 | <td class="header-group page-location"><a href="../refmanual.html" class="navigation-link">Front Page</a> / <a href="./metafunctions.html" class="navigation-link">Metafunctions</a> / <a href="./composition-and-argument.html" class="navigation-link">Composition and Argument Binding</a> / <a href="./quote.html" class="navigation-link">quote</a></td> |
---|
13 | </tr></table><div class="header-separator"></div> |
---|
14 | <div class="section" id="quote"> |
---|
15 | <h1><a class="toc-backref" href="./composition-and-argument.html#id458" name="quote">quote</a></h1> |
---|
16 | <div class="section" id="quote-synopsis"> |
---|
17 | <h3><a class="subsection-title" href="#synopsis" name="synopsis">Synopsis</a></h3> |
---|
18 | <pre class="literal-block"> |
---|
19 | template< |
---|
20 | template< typename P1 > class F |
---|
21 | , typename Tag = <em>unspecified</em> |
---|
22 | > |
---|
23 | struct quote1 |
---|
24 | { |
---|
25 | // <em>unspecified</em> |
---|
26 | // <em>...</em> |
---|
27 | }; |
---|
28 | |
---|
29 | <em>...</em> |
---|
30 | |
---|
31 | template< |
---|
32 | template< typename P1,<em>...</em> typename P<em>n</em> > class F |
---|
33 | , typename Tag = <em>unspecified</em> |
---|
34 | > |
---|
35 | struct <a href="./quote.html" class="identifier">quote</a><em>n</em> |
---|
36 | { |
---|
37 | // <em>unspecified</em> |
---|
38 | // <em>...</em> |
---|
39 | }; |
---|
40 | </pre> |
---|
41 | </div> |
---|
42 | <div class="section" id="quote-description"> |
---|
43 | <h3><a class="subsection-title" href="#description" name="description">Description</a></h3> |
---|
44 | <p><tt class="literal"><span class="pre">quoten</span></tt> is a higher-order primitive that wraps an <em>n</em>-ary <a class="reference" href="./metafunction.html">Metafunction</a> to create |
---|
45 | a corresponding <a class="reference" href="./metafunction-class.html">Metafunction Class</a>.</p> |
---|
46 | </div> |
---|
47 | <div class="section" id="quote-header"> |
---|
48 | <h3><a class="subsection-title" href="#header" name="header">Header</a></h3> |
---|
49 | <pre class="literal-block"> |
---|
50 | #include <<a href="../../../../boost/mpl/quote.hpp" class="header">boost/mpl/quote.hpp</a>> |
---|
51 | </pre> |
---|
52 | </div> |
---|
53 | <div class="section" id="quote-model-of"> |
---|
54 | <h3><a class="subsection-title" href="#model-of" name="model-of">Model of</a></h3> |
---|
55 | <p><a class="reference" href="./metafunction-class.html">Metafunction Class</a></p> |
---|
56 | </div> |
---|
57 | <div class="section" id="quote-parameters"> |
---|
58 | <h3><a class="subsection-title" href="#parameters" name="parameters">Parameters</a></h3> |
---|
59 | <table border="1" class="table"> |
---|
60 | <colgroup> |
---|
61 | <col width="18%" /> |
---|
62 | <col width="27%" /> |
---|
63 | <col width="55%" /> |
---|
64 | </colgroup> |
---|
65 | <thead valign="bottom"> |
---|
66 | <tr><th>Parameter</th> |
---|
67 | <th>Requirement</th> |
---|
68 | <th>Description</th> |
---|
69 | </tr> |
---|
70 | </thead> |
---|
71 | <tbody valign="top"> |
---|
72 | <tr><td><tt class="literal"><span class="pre">F</span></tt></td> |
---|
73 | <td><a class="reference" href="./metafunction.html">Metafunction</a></td> |
---|
74 | <td>A metafunction to wrap.</td> |
---|
75 | </tr> |
---|
76 | <tr><td><tt class="literal"><span class="pre">Tag</span></tt></td> |
---|
77 | <td>Any type</td> |
---|
78 | <td>A tag determining wrap semantics.</td> |
---|
79 | </tr> |
---|
80 | </tbody> |
---|
81 | </table> |
---|
82 | </div> |
---|
83 | <div class="section" id="quote-expression-semantics"> |
---|
84 | <h3><a class="subsection-title" href="#expression-semantics" name="expression-semantics">Expression semantics</a></h3> |
---|
85 | <p>For any <em>n</em>-ary <a class="reference" href="./metafunction.html">Metafunction</a> <tt class="literal"><span class="pre">f</span></tt> and arbitrary type <tt class="literal"><span class="pre">tag</span></tt>:</p> |
---|
86 | <pre class="literal-block"> |
---|
87 | typedef <a href="./quote.html" class="identifier">quote</a><em>n</em><f> g; |
---|
88 | typedef <a href="./quote.html" class="identifier">quote</a><em>n</em><f,tag> g; |
---|
89 | </pre> |
---|
90 | <table class="field-list" frame="void" rules="none"> |
---|
91 | <col class="field-name" /> |
---|
92 | <col class="field-body" /> |
---|
93 | <tbody valign="top"> |
---|
94 | <tr class="field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference" href="./metafunction-class.html">Metafunction Class</a></td> |
---|
95 | </tr> |
---|
96 | <tr class="field"><th class="field-name">Semantics:</th><td class="field-body"><p class="first">Equivalent to</p> |
---|
97 | <pre class="literal-block"> |
---|
98 | struct g |
---|
99 | { |
---|
100 | template< typename A1,<em>...</em> typename A<em>n</em> > struct <a href="./apply.html" class="identifier">apply</a> |
---|
101 | : f<A1,<em>...</em>A<em>n</em>> |
---|
102 | { |
---|
103 | }; |
---|
104 | }; |
---|
105 | </pre> |
---|
106 | <p>if <tt class="literal"><span class="pre">f<A1,...An></span></tt> has a nested type member <tt class="literal"><span class="pre">::type</span></tt>, and to</p> |
---|
107 | <pre class="literal-block"> |
---|
108 | struct g |
---|
109 | { |
---|
110 | template< typename A1,<em>...</em> typename A<em>n</em> > struct <a href="./apply.html" class="identifier">apply</a> |
---|
111 | { |
---|
112 | typedef f<A1,<em>...</em>A<em>n</em>> type; |
---|
113 | }; |
---|
114 | }; |
---|
115 | </pre> |
---|
116 | <p class="last">otherwise.</p> |
---|
117 | </td> |
---|
118 | </tr> |
---|
119 | </tbody> |
---|
120 | </table> |
---|
121 | </div> |
---|
122 | <div class="section" id="quote-example"> |
---|
123 | <h3><a class="subsection-title" href="#example" name="example">Example</a></h3> |
---|
124 | <pre class="literal-block"> |
---|
125 | template< typename T > struct f1 |
---|
126 | { |
---|
127 | typedef T type; |
---|
128 | }; |
---|
129 | |
---|
130 | template< |
---|
131 | typename T1, typename T2, typename T3, typename T4, typename T5 |
---|
132 | > |
---|
133 | struct f5 |
---|
134 | { |
---|
135 | // no 'type' member! |
---|
136 | }; |
---|
137 | |
---|
138 | typedef <a href="./quote.html" class="identifier">quote</a><tt class="literal"><span class="pre">1</span></tt><f1>::<a href="./apply.html" class="identifier">apply</a><int>::type t1; |
---|
139 | typedef <a href="./quote.html" class="identifier">quote</a><tt class="literal"><span class="pre">5</span></tt><f5>::<a href="./apply.html" class="identifier">apply</a><char,short,int,long,float>::type t5; |
---|
140 | |
---|
141 | <a href="./assert.html" class="identifier">BOOST_MPL_ASSERT</a>(( is_same< t1, int > )); |
---|
142 | <a href="./assert.html" class="identifier">BOOST_MPL_ASSERT</a>(( is_same< t5, f5<char,short,int,long,float> > )); |
---|
143 | </pre> |
---|
144 | </div> |
---|
145 | <div class="section" id="quote-see-also"> |
---|
146 | <h3><a class="subsection-title" href="#see-also" name="see-also">See also</a></h3> |
---|
147 | <p><a class="reference" href="./composition-and-argument.html">Composition and Argument Binding</a>, <a class="reference" href="./invocation.html">invocation</a>, <a class="refentry reference" href="./bind.html"><tt class="refentry literal"><span class="pre">bind</span></tt></a>, <a class="refentry reference" href="./lambda.html"><tt class="refentry literal"><span class="pre">lambda</span></tt></a>, <a class="refentry reference" href="./protect.html"><tt class="refentry literal"><span class="pre">protect</span></tt></a>, <a class="refentry reference" href="./apply.html"><tt class="refentry literal"><span class="pre">apply</span></tt></a></p> |
---|
148 | <!-- modtime: November 10, 2004 04:33:42 +0000 --> |
---|
149 | <!-- Metafunctions/Composition and Argument Binding//arg |50 --> |
---|
150 | </div> |
---|
151 | </div> |
---|
152 | |
---|
153 | <div class="footer-separator"></div> |
---|
154 | <table class="footer"><tr class="footer"><td class="header-group navigation-bar"><span class="navigation-group"><a href="./bind.html" class="navigation-link">Prev</a> <a href="./arg.html" class="navigation-link">Next</a></span><span class="navigation-group-separator"> | </span><span class="navigation-group"><a href="./bind.html" class="navigation-link">Back</a> <a href="./arg.html" class="navigation-link">Along</a></span><span class="navigation-group-separator"> | </span><span class="navigation-group"><a href="./composition-and-argument.html" class="navigation-link">Up</a> <a href="../refmanual.html" class="navigation-link">Home</a></span><span class="navigation-group-separator"> | </span><span class="navigation-group"><a href="./refmanual_toc.html" class="navigation-link">Full TOC</a></span></td> |
---|
155 | </tr></table></body> |
---|
156 | </html> |
---|