BOOST_TT_idm46187185686608.html 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
  4. <title>Macro BOOST_TTI_TRAIT_HAS_TEMPLATE</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="header/boost/tti/has_template_hpp.html" title="Header &lt;boost/tti/has_template.hpp&gt;">
  9. <link rel="prev" href="header/boost/tti/has_template_hpp.html" title="Header &lt;boost/tti/has_template.hpp&gt;">
  10. <link rel="next" href="BOOST_TTI_HAS_TEMPLATE.html" title="Macro BOOST_TTI_HAS_TEMPLATE">
  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="header/boost/tti/has_template_hpp.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="header/boost/tti/has_template_hpp.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="BOOST_TTI_HAS_TEMPLATE.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
  24. </div>
  25. <div class="refentry">
  26. <a name="BOOST_TT_idm46187185686608"></a><div class="titlepage"></div>
  27. <div class="refnamediv">
  28. <h2><span class="refentrytitle">Macro BOOST_TTI_TRAIT_HAS_TEMPLATE</span></h2>
  29. <p>BOOST_TTI_TRAIT_HAS_TEMPLATE &#8212; Expands to a metafunction which tests whether an inner class template with a particular name exists. </p>
  30. </div>
  31. <h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
  32. <div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="header/boost/tti/has_template_hpp.html" title="Header &lt;boost/tti/has_template.hpp&gt;">boost/tti/has_template.hpp</a>&gt;
  33. </span>BOOST_TTI_TRAIT_HAS_TEMPLATE(trait, ...)</pre></div>
  34. <div class="refsect1">
  35. <a name="idm45456560424288"></a><h2>Description</h2>
  36. <p>trait = the name of the metafunction. ... = variadic parameters. The first variadic parameter is the inner class template name.
  37. Following variadic parameters are optional.
  38. If no following variadic parameters exist, then the inner class template
  39. being introspected must be all template type parameters ( template parameters
  40. starting with `class` or `typename` ) and any number of template type parameters
  41. can occur.
  42. If the second variadic parameter is BOOST_PP_NIL and no other variadic
  43. parameter is given, then just as in the previous case the inner class template
  44. being introspected must be all template type parameters ( template parameters
  45. starting with `class` or `typename` ) and any number of template type parameters
  46. can occur. This form is allowed in order to be consistent with using the
  47. non-variadic form of this macro.
  48. If the second variadic parameter is a Boost preprocessor library array and no other
  49. variadic parameter is given, then the inner class template must have its template
  50. parameters matching the sequence in the tuple portion of the Boost PP array. This
  51. form is allowed in order to be consistent with using the non-variadic form of this
  52. macro.
  53. Otherwise the inner class template must have its template parameters matching the
  54. sequence of the optional variadic parameters.
  55. </p>
  56. <p>generates a metafunction called "trait" where 'trait' is the first macro parameter. template&lt;class BOOST_TTI_TP_T&gt;
  57. struct trait
  58. {
  59. static const value = unspecified;
  60. typedef mpl::bool_&lt;true-or-false&gt; type;
  61. };
  62. The metafunction types and return:
  63. BOOST_TTI_TP_T = the enclosing type in which to look for our 'name'.
  64. returns = 'value' is true if the 'name' template exists within the enclosing type,
  65. otherwise 'value' is false.
  66. </p>
  67. <p>Examples:</p>
  68. <p>1) Search for an inner class template called 'MyTemplate', with all template type parameters, nested within the class 'MyClass' using a metafunction name of 'MyMeta'.</p>
  69. <p>BOOST_TTI_TRAIT_HAS_TEMPLATE(MyMeta,MyTemplate)</p>
  70. <p>or</p>
  71. <p>BOOST_TTI_TRAIT_HAS_TEMPLATE(MyMeta,MyTemplate,BOOST_PP_NIL) // Non-variadic macro form</p>
  72. <p>MyMeta&lt;MyClass&gt;::value</p>
  73. <p>is a compile time boolean constant which is either 'true' or 'false' if the nested template exists.</p>
  74. <p>2) Search for an inner class template called 'MyTemplate', with template parameters of 'class T,int x,template&lt;class&gt; class U', nested within the class 'MyClass' using a metafunction name of 'MyMeta'.</p>
  75. <p>BOOST_TTI_TRAIT_HAS_TEMPLATE(MyMeta,MyTemplate,class,int,template&lt;class&gt; class)</p>
  76. <p>or</p>
  77. <p>BOOST_TTI_TRAIT_HAS_TEMPLATE(MyMeta,MyTemplate,(3,(class,int,template&lt;class&gt; class))) // Non-variadic macro form</p>
  78. <p>MyMeta&lt;MyClass&gt;::value</p>
  79. <p>is a compile time boolean constant which is either 'true' or 'false' if the nested template exists. </p>
  80. </div>
  81. </div>
  82. <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
  83. <td align="left"></td>
  84. <td align="right"><div class="copyright-footer">Copyright &#169; 2011-2013 Tropic Software
  85. East Inc<p>
  86. Distributed under the Boost Software License, Version 1.0. (See accompanying
  87. 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>)
  88. </p>
  89. </div></td>
  90. </tr></table>
  91. <hr>
  92. <div class="spirit-nav">
  93. <a accesskey="p" href="header/boost/tti/has_template_hpp.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="header/boost/tti/has_template_hpp.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="BOOST_TTI_HAS_TEMPLATE.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
  94. </div>
  95. </body>
  96. </html>