PageRenderTime 1824ms CodeModel.GetById 34ms RepoModel.GetById 9ms app.codeStats 0ms

/boost_1_57_0/doc/html/boost/typeindex/type_id_runtime.html

http://github.com/MisterTea/HyperNEAT
HTML | 98 lines | 95 code | 3 blank | 0 comment | 0 complexity | f9a3463eae4ac8c9d2f804b4bb2671b5 MD5 | raw file
Possible License(s): BSD-3-Clause, LGPL-3.0, GPL-3.0, GPL-2.0
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
  4. <title>Function template type_id_runtime</title>
  5. <link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
  6. <meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
  7. <link rel="home" href="../../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
  8. <link rel="up" href="../../boost_typeindex_header_reference.html#header.boost.type_index_hpp" title="Header &lt;boost/type_index.hpp&gt;">
  9. <link rel="prev" href="type_id_with_cvr.html" title="Function template type_id_with_cvr">
  10. <link rel="next" href="../../BOOST_TYPE_INDEX_REGISTER_CLASS.html" title="Macro BOOST_TYPE_INDEX_REGISTER_CLASS">
  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="type_id_with_cvr.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../boost_typeindex_header_reference.html#header.boost.type_index_hpp"><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_TYPE_INDEX_REGISTER_CLASS.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
  24. </div>
  25. <div class="refentry">
  26. <a name="boost.typeindex.type_id_runtime"></a><div class="titlepage"></div>
  27. <div class="refnamediv">
  28. <h2><span class="refentrytitle">Function template type_id_runtime</span></h2>
  29. <p>boost::typeindex::type_id_runtime</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="../../boost_typeindex_header_reference.html#header.boost.type_index_hpp" title="Header &lt;boost/type_index.hpp&gt;">boost/type_index.hpp</a>&gt;
  33. </span>
  34. <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">&gt;</span> <span class="identifier">type_index</span> <span class="identifier">type_id_runtime</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">T</span> <span class="special">&amp;</span> runtime_val<span class="special">)</span><span class="special">;</span></pre></div>
  35. <div class="refsect1">
  36. <a name="idp482619040"></a><h2>Description</h2>
  37. <p>Function that works exactly like C++ typeid(rtti_val) call, but returns boost::type_index.</p>
  38. <p>Retunrs runtime information about specified type.</p>
  39. <p><span class="bold"><strong>Requirements:</strong></span> RTTI available or Base and Derived classes must be marked with BOOST_TYPE_INDEX_REGISTER_CLASS.</p>
  40. <p><span class="bold"><strong>Example:</strong></span> </p>
  41. <pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">Base</span> <span class="special">{</span> <span class="keyword">virtual</span> <span class="special">~</span><span class="identifier">Base</span><span class="special">(</span><span class="special">)</span><span class="special">{</span><span class="special">}</span> <span class="special">}</span><span class="special">;</span>
  42. <span class="keyword">struct</span> <span class="identifier">Derived</span><span class="special">:</span> <span class="keyword">public</span> <span class="identifier">Base</span> <span class="special">{</span><span class="special">}</span><span class="special">;</span>
  43. <span class="special">...</span>
  44. <span class="identifier">Derived</span> <span class="identifier">d</span><span class="special">;</span>
  45. <span class="identifier">Base</span><span class="special">&amp;</span> <span class="identifier">b</span> <span class="special">=</span> <span class="identifier">d</span><span class="special">;</span>
  46. <span class="identifier">type_index</span> <span class="identifier">ti</span> <span class="special">=</span> <span class="identifier">type_id_runtime</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span><span class="special">;</span>
  47. <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">ti</span><span class="special">.</span><span class="identifier">pretty_name</span><span class="special">(</span><span class="special">)</span><span class="special">;</span> <span class="comment">// Outputs 'Derived'</span>
  48. </pre>
  49. <p>
  50. </p>
  51. <div class="variablelist"><table border="0" class="variablelist compact">
  52. <colgroup>
  53. <col align="left" valign="top">
  54. <col>
  55. </colgroup>
  56. <tbody>
  57. <tr>
  58. <td><p><span class="term">Parameters:</span></p></td>
  59. <td><div class="variablelist"><table border="0" class="variablelist compact">
  60. <colgroup>
  61. <col align="left" valign="top">
  62. <col>
  63. </colgroup>
  64. <tbody><tr>
  65. <td><p><span class="term"><code class="computeroutput">runtime_val</code></span></p></td>
  66. <td><p>Varaible which runtime type must be returned. </p></td>
  67. </tr></tbody>
  68. </table></div></td>
  69. </tr>
  70. <tr>
  71. <td><p><span class="term">Returns:</span></p></td>
  72. <td><p>boost::typeindex::type_index with information about the specified variable. </p></td>
  73. </tr>
  74. <tr>
  75. <td><p><span class="term">Throws:</span></p></td>
  76. <td>Nothing. </td>
  77. </tr>
  78. </tbody>
  79. </table></div>
  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; 2012-2014 Antony Polukhin<p>
  85. Distributed under the Boost Software License, Version 1.0. (See accompanying
  86. 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>)
  87. </p>
  88. </div></td>
  89. </tr></table>
  90. <hr>
  91. <div class="spirit-nav">
  92. <a accesskey="p" href="type_id_with_cvr.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../boost_typeindex_header_reference.html#header.boost.type_index_hpp"><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_TYPE_INDEX_REGISTER_CLASS.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
  93. </div>
  94. </body>
  95. </html>