primary.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
  4. <title>Categorizing a Type</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;Boost.TypeTraits">
  8. <link rel="up" href="../value_traits.html" title="Type Traits that Describe the Properties of a Type">
  9. <link rel="prev" href="../value_traits.html" title="Type Traits that Describe the Properties of a Type">
  10. <link rel="next" href="properties.html" title="General Type Properties">
  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="../value_traits.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../value_traits.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="properties.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
  24. </div>
  25. <div class="section">
  26. <div class="titlepage"><div><div><h4 class="title">
  27. <a name="boost_typetraits.category.value_traits.primary"></a><a class="link" href="primary.html" title="Categorizing a Type">Categorizing
  28. a Type</a>
  29. </h4></div></div></div>
  30. <p>
  31. These traits identify what "kind" of type some type <code class="computeroutput"><span class="identifier">T</span></code> is. These are split into two groups:
  32. primary traits which are all mutually exclusive, and composite traits that
  33. are compositions of one or more primary traits.
  34. </p>
  35. <p>
  36. For any given type, exactly one primary type trait will inherit from <a class="link" href="../../reference/integral_constant.html" title="integral_constant">true_type</a>,
  37. and all the others will inherit from <a class="link" href="../../reference/integral_constant.html" title="integral_constant">false_type</a>,
  38. in other words these traits are mutually exclusive.
  39. </p>
  40. <p>
  41. This means that <code class="computeroutput"><a class="link" href="../../reference/is_integral.html" title="is_integral">is_integral</a><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&gt;::</span><span class="identifier">value</span></code>
  42. and <code class="computeroutput"><a class="link" href="../../reference/is_floating_point.html" title="is_floating_point">is_floating_point</a><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&gt;::</span><span class="identifier">value</span></code>
  43. will only ever be true for built-in types; if you want to check for a user-defined
  44. class type that behaves "as if" it is an integral or floating
  45. point type, then use the <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span>
  46. <span class="keyword">template</span></code> instead.
  47. </p>
  48. <p>
  49. <span class="bold"><strong>Synopsis:</strong></span>
  50. </p>
  51. <pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
  52. <span class="keyword">struct</span> <a class="link" href="../../reference/is_array.html" title="is_array">is_array</a><span class="special">;</span>
  53. <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
  54. <span class="keyword">struct</span> <a class="link" href="../../reference/is_class.html" title="is_class">is_class</a><span class="special">;</span>
  55. <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
  56. <span class="keyword">struct</span> <a class="link" href="../../reference/is_complex.html" title="is_complex">is_complex</a><span class="special">;</span>
  57. <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
  58. <span class="keyword">struct</span> <a class="link" href="../../reference/is_enum.html" title="is_enum">is_enum</a><span class="special">;</span>
  59. <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
  60. <span class="keyword">struct</span> <a class="link" href="../../reference/is_floating_point.html" title="is_floating_point">is_floating_point</a><span class="special">;</span>
  61. <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
  62. <span class="keyword">struct</span> <a class="link" href="../../reference/is_function.html" title="is_function">is_function</a><span class="special">;</span>
  63. <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
  64. <span class="keyword">struct</span> <a class="link" href="../../reference/is_integral.html" title="is_integral">is_integral</a><span class="special">;</span>
  65. <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
  66. <span class="keyword">struct</span> <a class="link" href="../../reference/is_member_function_pointer.html" title="is_member_function_pointer">is_member_function_pointer</a><span class="special">;</span>
  67. <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
  68. <span class="keyword">struct</span> <a class="link" href="../../reference/is_member_object_pointer.html" title="is_member_object_pointer">is_member_object_pointer</a><span class="special">;</span>
  69. <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
  70. <span class="keyword">struct</span> <a class="link" href="../../reference/is_pointer.html" title="is_pointer">is_pointer</a><span class="special">;</span>
  71. <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
  72. <span class="keyword">struct</span> <a class="link" href="../../reference/is_lvalue_reference.html" title="is_lvalue_reference">is_lvalue_reference</a><span class="special">;</span>
  73. <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
  74. <span class="keyword">struct</span> <a class="link" href="../../reference/is_rvalue_reference.html" title="is_rvalue_reference">is_rvalue_reference</a><span class="special">;</span>
  75. <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
  76. <span class="keyword">struct</span> <a class="link" href="../../reference/is_union.html" title="is_union">is_union</a><span class="special">;</span>
  77. <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
  78. <span class="keyword">struct</span> <a class="link" href="../../reference/is_void.html" title="is_void">is_void</a><span class="special">;</span>
  79. </pre>
  80. <p>
  81. The following traits are made up of the union of one or more type categorizations.
  82. A type may belong to more than one of these categories, in addition to
  83. one of the primary categories.
  84. </p>
  85. <pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
  86. <span class="keyword">struct</span> <a class="link" href="../../reference/is_arithmetic.html" title="is_arithmetic">is_arithmetic</a><span class="special">;</span>
  87. <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
  88. <span class="keyword">struct</span> <a class="link" href="../../reference/is_compound.html" title="is_compound">is_compound</a><span class="special">;</span>
  89. <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
  90. <span class="keyword">struct</span> <a class="link" href="../../reference/is_fundamental.html" title="is_fundamental">is_fundamental</a><span class="special">;</span>
  91. <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
  92. <span class="keyword">struct</span> <a class="link" href="../../reference/is_member_pointer.html" title="is_member_pointer">is_member_pointer</a><span class="special">;</span>
  93. <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
  94. <span class="keyword">struct</span> <a class="link" href="../../reference/is_object.html" title="is_object">is_object</a><span class="special">;</span>
  95. <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
  96. <span class="keyword">struct</span> <a class="link" href="../../reference/is_reference.html" title="is_reference">is_reference</a><span class="special">;</span>
  97. <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
  98. <span class="keyword">struct</span> <a class="link" href="../../reference/is_scalar.html" title="is_scalar">is_scalar</a><span class="special">;</span>
  99. </pre>
  100. </div>
  101. <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
  102. <td align="left"></td>
  103. <td align="right"><div class="copyright-footer">Copyright &#169; 2000, 2011 Adobe Systems Inc, David Abrahams,
  104. Frederic Bron, Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant,
  105. Jesse Jones, Mat Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten
  106. Ottosen, Roman Perepelitsa, Robert Ramey, Jeremy Siek, Robert Stewart and Steven
  107. Watanabe<p>
  108. Distributed under the Boost Software License, Version 1.0. (See accompanying
  109. 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>)
  110. </p>
  111. </div></td>
  112. </tr></table>
  113. <hr>
  114. <div class="spirit-nav">
  115. <a accesskey="p" href="../value_traits.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../value_traits.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="properties.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
  116. </div>
  117. </body>
  118. </html>