introduction.html 6.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
  4. <title>Introduction</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.FunctionTypes 2.5">
  8. <link rel="up" href="../index.html" title="Chapter&#160;1.&#160;Boost.FunctionTypes 2.5">
  9. <link rel="prev" href="../index.html" title="Chapter&#160;1.&#160;Boost.FunctionTypes 2.5">
  10. <link rel="next" href="use_cases.html" title="Use Cases">
  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="../index.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="use_cases.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="boost_functiontypes.introduction"></a><a class="link" href="introduction.html" title="Introduction">Introduction</a>
  28. </h2></div></div></div>
  29. <p>
  30. Boost.FunctionTypes provides functionality to classify, decompose and synthesize
  31. function, function pointer, function reference and pointer to member types.
  32. </p>
  33. <p>
  34. We collectively refer to these types as <span class="emphasis"><em>callable builtin</em></span>
  35. types.
  36. </p>
  37. <p>
  38. In particular, the library can be used to:
  39. </p>
  40. <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
  41. <li class="listitem">
  42. test whether a type is a specific callable, builtin type,
  43. </li>
  44. <li class="listitem">
  45. extract all component properties from callable, builtin types, and
  46. </li>
  47. <li class="listitem">
  48. create callable, builtin types from specified properties.
  49. </li>
  50. </ul></div>
  51. <p>
  52. The library is designed to work well with other Boost libraries and uses well-accepted
  53. concepts introduced by Boost and TR1.
  54. </p>
  55. <p>
  56. Templates that encapsulate boolean or numeric properties define a static member
  57. constant called <code class="literal">value</code>.
  58. </p>
  59. <pre class="programlisting"><a class="link" href="reference/classification.html#boost_functiontypes.reference.classification.is_function_pointer" title="is_function_pointer">is_function_pointer</a><span class="special">&lt;</span> <span class="keyword">bool</span><span class="special">(*)(</span><span class="keyword">int</span><span class="special">)</span> <span class="special">&gt;::</span><span class="identifier">value</span> <span class="comment">// == true </span>
  60. <a class="link" href="reference/decomposition.html#boost_functiontypes.reference.decomposition.function_arity" title="function_arity">function_arity</a><span class="special">&lt;</span> <span class="keyword">bool</span><span class="special">(*)(</span><span class="keyword">int</span><span class="special">)</span> <span class="special">&gt;::</span><span class="identifier">value</span> <span class="comment">// == 1</span>
  61. </pre>
  62. <p>
  63. Templates that encapsulate properties that are single types contain a type
  64. member called <code class="literal">type</code>.
  65. </p>
  66. <pre class="programlisting"><a class="link" href="reference/synthesis.html#boost_functiontypes.reference.synthesis.function_type" title="function_type">function_type</a><span class="special">&lt;</span> <span class="identifier">mpl</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;</span><span class="keyword">bool</span><span class="special">,</span><span class="keyword">int</span><span class="special">&gt;</span> <span class="special">&gt;::</span><span class="identifier">type</span> <span class="comment">// is bool(int)</span>
  67. <a class="link" href="reference/decomposition.html#boost_functiontypes.reference.decomposition.result_type" title="result_type">result_type</a><span class="special">&lt;</span> <span class="keyword">bool</span><span class="special">(&amp;)(</span><span class="keyword">int</span><span class="special">)</span> <span class="special">&gt;::</span><span class="identifier">type</span> <span class="comment">// is bool</span>
  68. </pre>
  69. <p>
  70. Templates that encapsulate properties that are type lists model an MPL-compatible
  71. type sequence.
  72. </p>
  73. <pre class="programlisting"><a class="link" href="reference/decomposition.html#boost_functiontypes.reference.decomposition.parameter_types" title="parameter_types">parameter_types</a><span class="special">&lt;</span> <span class="keyword">bool</span><span class="special">(</span><span class="keyword">int</span><span class="special">)</span> <span class="special">&gt;</span> <span class="comment">// models an MPL sequence</span>
  74. </pre>
  75. </div>
  76. <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
  77. <td align="left"></td>
  78. <td align="right"><div class="copyright-footer">Copyright &#169; 2004-2007 Tobias
  79. Schwinger<p>
  80. Distributed under the Boost Software License, Version 1.0. (See accompanying
  81. 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>)
  82. </p>
  83. </div></td>
  84. </tr></table>
  85. <hr>
  86. <div class="spirit-nav">
  87. <a accesskey="p" href="../index.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="use_cases.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
  88. </div>
  89. </body>
  90. </html>