Imported Upstream version 1.72.0
[platform/upstream/boost.git] / libs / tti / doc / html / the_type_traits_introspection_library / tti_detail.html
1 <html>
2 <head>
3 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4 <title>Macro Metafunctions</title>
5 <link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
6 <meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7 <link rel="home" href="../index.html" title="Chapter&#160;1.&#160;The Type Traits Introspection Library">
8 <link rel="up" href="../index.html" title="Chapter&#160;1.&#160;The Type Traits Introspection Library">
9 <link rel="prev" href="tti_functionality.html" title="General Functionality">
10 <link rel="next" href="tti_detail_has_type.html" title="Introspecting an inner type">
11 </head>
12 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13 <table cellpadding="2" width="100%"><tr>
14 <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
15 <td align="center"><a href="../../../../../index.html">Home</a></td>
16 <td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td>
17 <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
18 <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
19 <td align="center"><a href="../../../../../more/index.htm">More</a></td>
20 </tr></table>
21 <hr>
22 <div class="spirit-nav">
23 <a accesskey="p" href="tti_functionality.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="tti_detail_has_type.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
24 </div>
25 <div class="section">
26 <div class="titlepage"><div><div><h2 class="title" style="clear: both">
27 <a name="the_type_traits_introspection_library.tti_detail"></a><a class="link" href="tti_detail.html" title="Macro Metafunctions">Macro
28     Metafunctions</a>
29 </h2></div></div></div>
30 <p>
31       The TTI library uses macros to create metafunctions, in the current scope,
32       for introspecting an inner element by name. Each macro for a particular type
33       of inner element has two forms, the simple one where the first macro parameter
34       designating the 'name' of the inner element is used to create the name of the
35       metafunction, and the complex one where the first macro parameter, called 'trait',
36       designates the name of the metafunction and the second macro parameter designates
37       the 'name' to be introspected. Other than that difference, the two forms of
38       the macro create metafunctions which have the exact same functionality.
39     </p>
40 <p>
41       To use these metafunctions you can include the main general header file 'boost/tti/tti.hpp',
42       unless otherwise noted. Alternatively you can include a specific header file
43       as given in the table below.
44     </p>
45 <p>
46       A table of these macros is given, based on the inner element whose existence
47       the metaprogrammer is introspecting. More detailed explanations and examples
48       for each of the macro metafunctions will follow this section in the documentation.
49       The actual syntax for each macro metafunction can be found in the reference
50       section, and examples of usage for all the macro metafunctions can be found
51       in the <a class="link" href="tti_usingMM.html#sectti_usingMM">"Using the Macro Metafunctions"</a>
52       section.
53     </p>
54 <p>
55       In the Template column only the name generated by the simple form of the template
56       is given since the name generated by the complex form is always 'trait' where
57       'trait' is the first parameter to the corresponding complex form macro.
58     </p>
59 <p>
60       All of the introspecting metafunctions in the table below return a boolean
61       constant called 'value', which specifies whether or not the inner element exists.
62       All of the metafunctions also have a nested type called 'type', which for each
63       one is the type of the boolean constant value. This is always boost::mpl::bool_.
64     </p>
65 <div class="table">
66 <a name="the_type_traits_introspection_library.tti_detail.tbmacros"></a><p class="title"><b>Table&#160;1.2.&#160;TTI Macro Metafunctions</b></p>
67 <div class="table-contents"><table class="table" summary="TTI Macro Metafunctions">
68 <colgroup>
69 <col>
70 <col>
71 <col>
72 <col>
73 </colgroup>
74 <thead><tr>
75 <th>
76               <p>
77                 Inner Element
78               </p>
79             </th>
80 <th>
81               <p>
82                 Macro
83               </p>
84             </th>
85 <th>
86               <p>
87                 Template
88               </p>
89             </th>
90 <th>
91               <p>
92                 Specific Header File
93               </p>
94             </th>
95 </tr></thead>
96 <tbody>
97 <tr>
98 <td>
99               <p>
100                 Type
101               </p>
102             </td>
103 <td>
104               <p>
105                 <code class="computeroutput"><a class="link" href="../BOOST_TTI_HAS_TYPE.html" title="Macro BOOST_TTI_HAS_TYPE">BOOST_TTI_HAS_TYPE</a></code>(name)
106               </p>
107             </td>
108 <td>
109               <p>
110                 <code class="computeroutput"><span class="identifier">has_type_</span><span class="char">'name'</span></code>
111               </p>
112               <p>
113                 class TTI_T = enclosing type
114               </p>
115             </td>
116 <td>
117               <p>
118                 <code class="computeroutput"><a class="link" href="../header/boost/tti/has_type_hpp.html" title="Header &lt;boost/tti/has_type.hpp&gt;">has_type.hpp</a></code>
119               </p>
120             </td>
121 </tr>
122 <tr>
123 <td>
124               <p>
125                 Type with lambda expression
126               </p>
127             </td>
128 <td>
129               <p>
130                 <code class="computeroutput"><a class="link" href="../BOOST_TTI_HAS_TYPE.html" title="Macro BOOST_TTI_HAS_TYPE">BOOST_TTI_HAS_TYPE</a></code>(name)
131               </p>
132             </td>
133 <td>
134               <p>
135                 <code class="computeroutput"><span class="identifier">has_type_</span><span class="char">'name'</span></code>
136               </p>
137               <p>
138                 class TTI_T = enclosing type
139               </p>
140               <p>
141                 class TTI_U = lambda expression invoked with the inner type and returning
142                 a boolean constant
143               </p>
144             </td>
145 <td>
146               <p>
147                 <code class="computeroutput"><a class="link" href="../header/boost/tti/has_type_hpp.html" title="Header &lt;boost/tti/has_type.hpp&gt;">has_type.hpp</a></code>
148               </p>
149             </td>
150 </tr>
151 <tr>
152 <td>
153               <p>
154                 Class Template ( using variadic macros )
155               </p>
156             </td>
157 <td>
158               <p>
159                 <code class="computeroutput"><a class="link" href="../BOOST_TTI_HAS_TEMPLATE.html" title="Macro BOOST_TTI_HAS_TEMPLATE">BOOST_TTI_HAS_TEMPLATE</a></code>(name)
160               </p>
161             </td>
162 <td>
163               <p>
164                 <code class="computeroutput"><span class="identifier">has_template_</span><span class="char">'name'</span></code>
165               </p>
166               <p>
167                 class TTI_T = enclosing type
168               </p>
169               <p>
170                 All of the template parameters must be template type parameters (
171                 'class' or 'typename' parameters )
172               </p>
173             </td>
174 <td>
175               <p>
176                 <code class="computeroutput"><a class="link" href="../header/boost/tti/has_template_hpp.html" title="Header &lt;boost/tti/has_template.hpp&gt;">has_template.hpp</a></code>
177               </p>
178             </td>
179 </tr>
180 <tr>
181 <td>
182               <p>
183                 Class Template ( not using variadic macros )
184               </p>
185             </td>
186 <td>
187               <p>
188                 <code class="computeroutput"><a class="link" href="../BOOST_TTI_HAS_TEMPLATE.html" title="Macro BOOST_TTI_HAS_TEMPLATE">BOOST_TTI_HAS_TEMPLATE</a></code>(name,BOOST_PP_NIL)
189               </p>
190             </td>
191 <td>
192               <p>
193                 <code class="computeroutput"><span class="identifier">has_template_</span><span class="char">'name'</span></code>
194               </p>
195               <p>
196                 class TTI_T = enclosing type
197               </p>
198               <p>
199                 All of the template parameters must be template type parameters (
200                 'class' or 'typename' parameters )
201               </p>
202             </td>
203 <td>
204               <p>
205                 <code class="computeroutput"><a class="link" href="../header/boost/tti/has_template_hpp.html" title="Header &lt;boost/tti/has_template.hpp&gt;">has_template.hpp</a></code>
206               </p>
207             </td>
208 </tr>
209 <tr>
210 <td>
211               <p>
212                 Class Template with params ( using variadic macros )
213               </p>
214             </td>
215 <td>
216               <p>
217                 <code class="computeroutput"><a class="link" href="../BOOST_TTI_HAS_TEMPLATE.html" title="Macro BOOST_TTI_HAS_TEMPLATE">BOOST_TTI_HAS_TEMPLATE</a></code>(name,...<a href="#ftn.the_type_traits_introspection_library.tti_detail.f0" class="footnote" name="the_type_traits_introspection_library.tti_detail.f0"><sup class="footnote">[a]</sup></a>)
218               </p>
219             </td>
220 <td>
221               <p>
222                 <code class="computeroutput"><span class="identifier">has_template_</span><span class="char">'name'</span></code>
223               </p>
224               <p>
225                 class TTI_T = enclosing type
226               </p>
227             </td>
228 <td>
229               <p>
230                 <code class="computeroutput"><a class="link" href="../header/boost/tti/has_template_hpp.html" title="Header &lt;boost/tti/has_template.hpp&gt;">has_template.hpp</a></code>
231               </p>
232             </td>
233 </tr>
234 <tr>
235 <td>
236               <p>
237                 Class Template with params
238               </p>
239             </td>
240 <td>
241               <p>
242                 <code class="computeroutput"><a class="link" href="../BOOST_TTI_HAS_TEMPLATE.html" title="Macro BOOST_TTI_HAS_TEMPLATE">BOOST_TTI_HAS_TEMPLATE</a></code>(name,ppArray<a href="#ftn.the_type_traits_introspection_library.tti_detail.f1" class="footnote" name="the_type_traits_introspection_library.tti_detail.f1"><sup class="footnote">[b]</sup></a>)
243               </p>
244             </td>
245 <td>
246               <p>
247                 <code class="computeroutput"><span class="identifier">has_template_</span><span class="char">'name'</span></code>
248               </p>
249               <p>
250                 class TTI_T = enclosing type
251               </p>
252             </td>
253 <td>
254               <p>
255                 <code class="computeroutput"><a class="link" href="../header/boost/tti/has_template_hpp.html" title="Header &lt;boost/tti/has_template.hpp&gt;">has_template.hpp</a></code>
256               </p>
257             </td>
258 </tr>
259 <tr>
260 <td>
261               <p>
262                 Member data
263               </p>
264             </td>
265 <td>
266               <p>
267                 <code class="computeroutput"><a class="link" href="../BOOST_TTI_HAS_MEMBER_DATA.html" title="Macro BOOST_TTI_HAS_MEMBER_DATA">BOOST_TTI_HAS_MEMBER_DATA</a></code>(name)
268               </p>
269             </td>
270 <td>
271               <p>
272                 <code class="computeroutput"><span class="identifier">has_member_data_</span><span class="char">'name'</span></code>
273               </p>
274               <p>
275                 class TTI_T = enclosing type OR pointer to member data ( 'MemberData_Type
276                 Enclosing_Type::*' )
277               </p>
278               <p>
279                 class TTI_R = (optional) data type. If the first parameter is the
280                 pointer to member data this must not be specified.
281               </p>
282             </td>
283 <td>
284               <p>
285                 <code class="computeroutput"><a class="link" href="../header/boost/tti/has_member_data_hpp.html" title="Header &lt;boost/tti/has_member_data.hpp&gt;">has_member_data.hpp</a></code>
286               </p>
287             </td>
288 </tr>
289 <tr>
290 <td>
291               <p>
292                 Member function
293               </p>
294             </td>
295 <td>
296               <p>
297                 <code class="computeroutput"><a class="link" href="../BOOST_TT_idm46187185705488.html" title="Macro BOOST_TTI_HAS_MEMBER_FUNCTION">BOOST_TTI_HAS_MEMBER_FUNCTION</a></code>(name)
298               </p>
299             </td>
300 <td>
301               <p>
302                 <code class="computeroutput"><span class="identifier">has_member_function_</span><span class="char">'name'</span></code>
303               </p>
304               <p>
305                 class TTI_T = enclosing type OR pointer to member function ( 'Return_Type
306                 Enclosing_Type::* ( Zero or more comma-separated parameter types
307                 )' )
308               </p>
309               <p>
310                 class TTI_R = (optional) return type if the first parameter is the
311                 enclosing type. If the first parameter is the pointer to member function
312                 this must not be specified.
313               </p>
314               <p>
315                 class TTI_FS = (optional) function parameter types as a Boost MPL
316                 forward sequence. If the first parameter is the pointer to member
317                 function this must not be specified. If there are no function parameters
318                 this does not have to be specified. Defaults to boost::mpl::vector&lt;&gt;.
319               </p>
320               <p>
321                 class TTI_TAG = (optional) Boost <code class="computeroutput"><span class="identifier">function_types</span></code>
322                 tag type. If the first parameter is the pointer to member function
323                 this must not be specified. Defaults to <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">function_types</span><span class="special">::</span><span class="identifier">null_tag</span></code>.
324               </p>
325             </td>
326 <td>
327               <p>
328                 <code class="computeroutput"><a class="link" href="../header/boost/tti/has_member_function_hpp.html" title="Header &lt;boost/tti/has_member_function.hpp&gt;">has_member_function.hpp</a></code>
329               </p>
330             </td>
331 </tr>
332 <tr>
333 <td>
334               <p>
335                 Static member data
336               </p>
337             </td>
338 <td>
339               <p>
340                 <code class="computeroutput"><a class="link" href="../BOOST_TT_idm46187185698016.html" title="Macro BOOST_TTI_HAS_STATIC_MEMBER_DATA">BOOST_TTI_HAS_STATIC_MEMBER_DATA</a></code>(name)
341               </p>
342             </td>
343 <td>
344               <p>
345                 <code class="computeroutput"><span class="identifier">has_static_member_data_</span><span class="char">'name'</span></code>
346               </p>
347               <p>
348                 class TTI_T = enclosing type
349               </p>
350               <p>
351                 class TTI_Type = data type
352               </p>
353             </td>
354 <td>
355               <p>
356                 <code class="computeroutput"><a class="link" href="../header/boost/tti/has_static_member_data_hpp.html" title="Header &lt;boost/tti/has_static_member_data.hpp&gt;">has_static_member_data.hpp</a></code>
357               </p>
358             </td>
359 </tr>
360 <tr>
361 <td>
362               <p>
363                 Static member function
364               </p>
365             </td>
366 <td>
367               <p>
368                 <code class="computeroutput"><a class="link" href="../BOOST_TT_idm46187185690608.html" title="Macro BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION">BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION</a></code>(name)
369               </p>
370             </td>
371 <td>
372               <p>
373                 <code class="computeroutput"><span class="identifier">has_static_member_function_</span><span class="char">'name'</span></code>
374               </p>
375               <p>
376                 class TTI_T = enclosing type
377               </p>
378               <p>
379                 class TTI_R = return type OR function type ( 'Return_Type (Zero or
380                 more comma-separated parameter types)' )
381               </p>
382               <p>
383                 class TTI_FS = (optional) function parameter types as a Boost MPL
384                 forward sequence. If the second parameter is the function type this
385                 must not be specified. If there are no function parameters, this
386                 does not have to be specified. Defaults to boost::mpl::vector&lt;&gt;.
387               </p>
388               <p>
389                 class TTI_TAG = (optional) Boost <code class="computeroutput"><span class="identifier">function_types</span></code>
390                 tag type. If the second parameter is the function type this must
391                 not be specified. Defaults to <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">function_types</span><span class="special">::</span><span class="identifier">null_tag</span></code>.
392               </p>
393             </td>
394 <td>
395               <p>
396                 <code class="computeroutput"><a class="link" href="../header/boost/tti/has_static_member_function_hpp.html" title="Header &lt;boost/tti/has_static_member_function.hpp&gt;">has_static_member_function.hpp</a></code>
397               </p>
398             </td>
399 </tr>
400 <tr>
401 <td>
402               <p>
403                 Data, either member data or static member data
404               </p>
405             </td>
406 <td>
407               <p>
408                 <code class="computeroutput"><a class="link" href="../BOOST_TTI_HAS_DATA.html" title="Macro BOOST_TTI_HAS_DATA">BOOST_TTI_HAS_DATA</a></code>(name)
409               </p>
410             </td>
411 <td>
412               <p>
413                 <code class="computeroutput"><span class="identifier">has_data_</span><span class="char">'name'</span></code>
414               </p>
415               <p>
416                 class TTI_T = enclosing type
417               </p>
418               <p>
419                 class TTI_Type = data type
420               </p>
421             </td>
422 <td>
423               <p>
424                 <code class="computeroutput"><a class="link" href="../header/boost/tti/has_data_hpp.html" title="Header &lt;boost/tti/has_data.hpp&gt;">has_data.hpp</a></code>
425               </p>
426             </td>
427 </tr>
428 <tr>
429 <td>
430               <p>
431                 Function, either member function or static member function
432               </p>
433             </td>
434 <td>
435               <p>
436                 <code class="computeroutput"><a class="link" href="../BOOST_TTI_HAS_FUNCTION.html" title="Macro BOOST_TTI_HAS_FUNCTION">BOOST_TTI_HAS_FUNCTION</a></code>(name)
437               </p>
438             </td>
439 <td>
440               <p>
441                 <code class="computeroutput"><span class="identifier">has_function_</span><span class="char">'name'</span></code>
442               </p>
443               <p>
444                 class TTI_T = enclosing type
445               </p>
446               <p>
447                 class TTI_R = return type
448               </p>
449               <p>
450                 class TTI_FS = (optional) function parameter types as a Boost MPL
451                 forward sequence. If there are no function parameters, this does
452                 not have to be specified. Defaults to boost::mpl::vector&lt;&gt;.
453               </p>
454               <p>
455                 class TTI_TAG = (optional) Boost <code class="computeroutput"><span class="identifier">function_types</span></code>
456                 tag type. Defaults to <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">function_types</span><span class="special">::</span><span class="identifier">null_tag</span></code>.
457               </p>
458             </td>
459 <td>
460               <p>
461                 <code class="computeroutput"><a class="link" href="../header/boost/tti/has_function_hpp.html" title="Header &lt;boost/tti/has_function.hpp&gt;">has_function.hpp</a></code>
462               </p>
463             </td>
464 </tr>
465 </tbody>
466 <tbody class="footnotes"><tr><td colspan="4">
467 <div id="ftn.the_type_traits_introspection_library.tti_detail.f0" class="footnote"><p><a href="#the_type_traits_introspection_library.tti_detail.f0" class="para"><sup class="para">[a] </sup></a>
468                   The template parameters as variadic data.
469                 </p></div>
470 <div id="ftn.the_type_traits_introspection_library.tti_detail.f1" class="footnote"><p><a href="#the_type_traits_introspection_library.tti_detail.f1" class="para"><sup class="para">[b] </sup></a>
471                   The template parameters as the tuple part of the PP array.
472                 </p></div>
473 </td></tr></tbody>
474 </table></div>
475 </div>
476 <br class="table-break">
477 </div>
478 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
479 <td align="left"></td>
480 <td align="right"><div class="copyright-footer">Copyright &#169; 2011-2013 Tropic Software
481       East Inc<p>
482         Distributed under the Boost Software License, Version 1.0. (See accompanying
483         file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
484       </p>
485 </div></td>
486 </tr></table>
487 <hr>
488 <div class="spirit-nav">
489 <a accesskey="p" href="tti_functionality.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="tti_detail_has_type.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
490 </div>
491 </body>
492 </html>