Imported Upstream version 1.64.0
[platform/upstream/boost.git] / libs / type_index / doc / autodoc.xml
1 <?xml version="1.0" standalone="yes"?>
2 <library-reference id="boost_typeindex_header_reference"><title>Boost.TypeIndex Header Reference</title><header name="boost/type_index.hpp">
3 <para>Includes minimal set of headers required to use the Boost.TypeIndex library. </para><para>By inclusion of this file most optimal type index classes will be included and used as a boost::typeindex::type_index and boost::typeindex::type_info. </para><namespace name="boost">
4 <namespace name="typeindex">
5 <typedef name="type_index"><description><para>Depending on a compiler flags, optimal implementation of type_index will be used as a default boost::typeindex::type_index.</para><para>Could be a <classname alt="boost::typeindex::stl_type_index">boost::typeindex::stl_type_index</classname>, <classname alt="boost::typeindex::ctti_type_index">boost::typeindex::ctti_type_index</classname> or user defined type_index class.</para><para><emphasis role="bold">See</emphasis> <classname alt="boost::typeindex::type_index_facade">boost::typeindex::type_index_facade</classname> for a full description of type_index functions. </para></description><type>platform_specific</type></typedef>
6 <typedef name="type_info"><description><para>Depending on a compiler flags, optimal implementation of type_info will be used as a default boost::typeindex::type_info.</para><para>Could be a std::type_info, <classname alt="boost::typeindex::detail::ctti_data">boost::typeindex::detail::ctti_data</classname> or some user defined class.</para><para>type_info <emphasis role="bold">is</emphasis> <emphasis role="bold">not</emphasis> copyable or default constructible. It is <emphasis role="bold">not</emphasis> assignable too! </para></description><type>type_index::type_info_t</type></typedef>
7 <function name="type_id"><type>type_index</type><template>
8           <template-type-parameter name="T"><purpose><para>Type for which type_index must be created. </para></purpose></template-type-parameter>
9         </template><description><para>Function to get boost::typeindex::type_index for a type T. Removes const, volatile &amp;&amp; and &amp; modifiers from T.</para><para><emphasis role="bold">Example:</emphasis> <programlisting language="c++">type_index ti = type_id&lt;int&amp;&gt;();
10 std::cout &lt;&lt; ti.pretty_name();  // Outputs 'int'
11 </programlisting></para><para>
12
13
14 </para></description><returns><para>boost::typeindex::type_index with information about the specified type T. </para></returns><throws><simpara><classname>Nothing.</classname> </simpara></throws></function>
15 <function name="type_id_with_cvr"><type>type_index</type><template>
16           <template-type-parameter name="T"><purpose><para>Type for which type_index must be created. </para></purpose></template-type-parameter>
17         </template><description><para>Function for constructing boost::typeindex::type_index instance for type T. Does not remove const, volatile, &amp; and &amp;&amp; modifiers from T.</para><para>If T has no const, volatile, &amp; and &amp;&amp; modifiers, then returns exactly the same result as in case of calling <computeroutput>type_id&lt;T&gt;()</computeroutput>.</para><para><emphasis role="bold">Example:</emphasis> <programlisting language="c++">type_index ti = type_id_with_cvr&lt;int&amp;&gt;();
18 std::cout &lt;&lt; ti.pretty_name();  // Outputs 'int&amp;'
19 </programlisting></para><para>
20
21
22 </para></description><returns><para>boost::typeindex::type_index with information about the specified type T. </para></returns><throws><simpara><classname>Nothing.</classname> </simpara></throws></function>
23 <function name="type_id_runtime"><type>type_index</type><template>
24           <template-type-parameter name="T"/>
25         </template><parameter name="runtime_val"><paramtype>const T &amp;</paramtype><description><para>Variable which runtime type must be returned. </para></description></parameter><description><para>Function that works exactly like C++ typeid(rtti_val) call, but returns boost::type_index.</para><para>Returns runtime information about specified type.</para><para><emphasis role="bold">Requirements:</emphasis> RTTI available or Base and Derived classes must be marked with BOOST_TYPE_INDEX_REGISTER_CLASS.</para><para><emphasis role="bold">Example:</emphasis> <programlisting language="c++">struct Base { virtual ~Base(){} };
26 struct Derived: public Base  {};
27 ...
28 Derived d;
29 Base&amp; b = d;
30 type_index ti = type_id_runtime(b);
31 std::cout &lt;&lt; ti.pretty_name();  // Outputs 'Derived'
32 </programlisting></para><para>
33
34
35 </para></description><returns><para>boost::typeindex::type_index with information about the specified variable. </para></returns><throws><simpara><classname>Nothing.</classname> </simpara></throws></function>
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50 </namespace>
51
52 </namespace>
53 <macro name="BOOST_TYPE_INDEX_REGISTER_CLASS"><description><para>BOOST_TYPE_INDEX_REGISTER_CLASS is used to help to emulate RTTI. Put this macro into the public section of polymorphic class to allow runtime type detection.</para><para>Depending on the typeid() availability this macro will expand to nothing or to virtual helper function <computeroutput>virtual const type_info&amp; boost_type_info_type_id_runtime_() const noexcept</computeroutput>.</para><para><emphasis role="bold">Example:</emphasis> <programlisting language="c++">class A {
54 public:
55     BOOST_TYPE_INDEX_REGISTER_CLASS
56     virtual ~A(){}
57 };
58
59 struct B: public A {
60     BOOST_TYPE_INDEX_REGISTER_CLASS
61 };
62
63 struct C: public B {
64     BOOST_TYPE_INDEX_REGISTER_CLASS
65 };
66
67 ...
68
69 C c1;
70 A* pc1 = &amp;c1;
71 assert(boost::typeindex::type_id&lt;C&gt;() == boost::typeindex::type_id_runtime(*pc1));
72 </programlisting> </para></description></macro>
73 <macro name="BOOST_TYPE_INDEX_FUNCTION_SIGNATURE"><description><para>BOOST_TYPE_INDEX_FUNCTION_SIGNATURE is used by <classname alt="boost::typeindex::ctti_type_index">boost::typeindex::ctti_type_index</classname> class to deduce the name of a type. If your compiler is not recognized by the TypeIndex library and you wish to work with <classname alt="boost::typeindex::ctti_type_index">boost::typeindex::ctti_type_index</classname>, you may define this macro by yourself.</para><para>BOOST_TYPE_INDEX_FUNCTION_SIGNATURE must be defined to a compiler specific macro that outputs the <emphasis role="bold">whole</emphasis> function signature <emphasis role="bold">including</emphasis> <emphasis role="bold">template</emphasis> <emphasis role="bold">parameters</emphasis>.</para><para>If your compiler is not recognised and BOOST_TYPE_INDEX_FUNCTION_SIGNATURE is not defined, then a compile-time error will arise at any attempt to use <classname alt="boost::typeindex::ctti_type_index">boost::typeindex::ctti_type_index</classname> classes.</para><para>See BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS and BOOST_TYPE_INDEX_CTTI_USER_DEFINED_PARSING for an information of how to tune the implementation to make a nice pretty_name() output. </para></description></macro>
74 <macro name="BOOST_TYPE_INDEX_CTTI_USER_DEFINED_PARSING"><description><para>This is a helper macro for making correct pretty_names() with RTTI off.</para><para>BOOST_TYPE_INDEX_CTTI_USER_DEFINED_PARSING macro may be defined to '(begin_skip, end_skip, runtime_skip, runtime_skip_until)' with parameters for adding a support for compilers, that by default are not recognized by TypeIndex library.</para><para><emphasis role="bold">Example:</emphasis> </para><para>Imagine the situation when <programlisting language="c++">boost::typeindex::ctti_type_index::type_id&lt;int&gt;().pretty_name() 
75 </programlisting> returns the following string: <programlisting language="c++">"static const char *boost::detail::ctti&lt;int&gt;::n() [T = int]" 
76 </programlisting> and<programlisting language="c++">boost::typeindex::ctti_type_index::type_id&lt;short&gt;().pretty_name() 
77 </programlisting> returns the following: <programlisting language="c++">"static const char *boost::detail::ctti&lt;short&gt;::n() [T = short]" 
78 </programlisting></para><para>As we may see first 39 characters are "static const char *boost::detail::ctti&lt;" and they do not depend on the type T. After first 39 characters we have a human readable type name which is duplicated at the end of a string. String always ends on ']', which consumes 1 character.</para><para>Now if we define <computeroutput>BOOST_TYPE_INDEX_CTTI_USER_DEFINED_PARSING</computeroutput> to <computeroutput>(39, 1, false, "")</computeroutput> we'll be getting<programlisting language="c++">"int&gt;::n() [T = int" 
79 </programlisting> for <computeroutput>boost::typeindex::ctti_type_index::type_id&lt;int&gt;().pretty_name()</computeroutput> and<programlisting language="c++">"short&gt;::n() [T = short" 
80 </programlisting> for <computeroutput>boost::typeindex::ctti_type_index::type_id&lt;short&gt;().pretty_name()</computeroutput>.</para><para>Now we need to take additional care of the characters that go before the last mention of our type. We'll do that by telling the macro that we need to cut off everything that goes before the "T = " including the "T = " itself:</para><para><programlisting language="c++">(39, 1, true, "T = ") 
81 </programlisting></para><para>In case of GCC or Clang command line we need to add the following line while compiling all the sources:</para><para><programlisting language="c++">-DBOOST_TYPE_INDEX_CTTI_USER_DEFINED_PARSING='(39, 1, true, "T = ")'
82 </programlisting> 
83 See <ulink url="boost_typeindex/rtti_emulation_limitations.html">RTTI emulation limitations</ulink> for more info. </para></description></macro>
84 <macro name="BOOST_TYPE_INDEX_USER_TYPEINDEX"><description><para>BOOST_TYPE_INDEX_USER_TYPEINDEX can be defined to the path to header file with user provided implementation of type_index.</para><para>See <ulink url="boost_typeindex/making_a_custom_type_index.html">Making a custom type_index</ulink> section of documentation for usage example. </para></description></macro>
85 <macro name="BOOST_TYPE_INDEX_FORCE_NO_RTTI_COMPATIBILITY"><description><para>BOOST_TYPE_INDEX_FORCE_NO_RTTI_COMPATIBILITY is a helper macro that must be defined if mixing RTTI on/off modules. See <ulink url="boost_typeindex/mixing_sources_with_rtti_on_and_.html">Mixing sources with RTTI on and RTTI off</ulink> section of documentation for more info. </para></description></macro>
86 </header>
87 <header name="boost/type_index/ctti_type_index.hpp">
88 <para>Contains <classname alt="boost::typeindex::ctti_type_index">boost::typeindex::ctti_type_index</classname> class that is constexpr if C++14 constexpr is supported by compiler. </para><para><classname alt="boost::typeindex::ctti_type_index">boost::typeindex::ctti_type_index</classname> class can be used as a drop-in replacement for std::type_index.</para><para>It is used in situations when typeid() method is not available or BOOST_TYPE_INDEX_FORCE_NO_RTTI_COMPATIBILITY macro is defined. </para><namespace name="boost">
89 <namespace name="typeindex">
90 <class name="ctti_type_index"><description><para>This class is a wrapper that pretends to work exactly like <classname alt="boost::typeindex::stl_type_index">stl_type_index</classname>, but does not require RTTI support. <emphasis role="bold">For</emphasis> <emphasis role="bold">description</emphasis> <emphasis role="bold">of</emphasis> <emphasis role="bold">functions</emphasis> <emphasis role="bold">see</emphasis> <classname alt="boost::typeindex::type_index_facade">type_index_facade</classname>.</para><para>This class on C++14 compatible compilers has following functions marked as constexpr:<itemizedlist>
91 <listitem><para>default constructor</para></listitem><listitem><para>copy constructors and assignemnt operations</para></listitem><listitem><para>class methods: name(), before(const ctti_type_index&amp; rhs), equal(const ctti_type_index&amp; rhs)</para></listitem><listitem><para>static methods type_id&lt;T&gt;(), type_id_with_cvr&lt;T&gt;()</para></listitem><listitem><para>comparison operators</para></listitem></itemizedlist>
92 </para><para>This class produces slightly longer type names, so consider using <classname alt="boost::typeindex::stl_type_index">stl_type_index</classname> in situations when typeid() is working. </para></description><typedef name="type_info_t"><type><emphasis>unspecified</emphasis></type></typedef>
93 <method-group name="private member functions">
94 <method name="get_raw_name_length" cv="const noexcept"><type>std::size_t</type></method>
95 </method-group>
96 <constructor specifiers="explicit" cv="noexcept"><parameter name="data"><paramtype>const char *</paramtype></parameter></constructor>
97 <method-group name="public member functions">
98 <method name="type_info" cv="const noexcept"><type>const <classname>type_info_t</classname> &amp;</type></method>
99 <method name="raw_name" cv="const noexcept"><type>constexpr const char *</type></method>
100 <method name="name" cv="const noexcept"><type>constexpr const char *</type></method>
101 <method name="pretty_name" cv="const"><type>std::string</type></method>
102 <method name="hash_code" cv="const noexcept"><type>std::size_t</type></method>
103 <method name="equal" cv="const noexcept"><type>constexpr bool</type><parameter name="rhs"><paramtype>const <classname>ctti_type_index</classname> &amp;</paramtype></parameter></method>
104 <method name="before" cv="const noexcept"><type>constexpr bool</type><parameter name="rhs"><paramtype>const <classname>ctti_type_index</classname> &amp;</paramtype></parameter></method>
105 </method-group>
106 <constructor cv="noexcept"/>
107 <constructor cv="noexcept"><parameter name="data"><paramtype>const <classname>type_info_t</classname> &amp;</paramtype></parameter></constructor>
108 <method-group name="public static functions">
109 <method name="type_id" cv="noexcept" specifiers="static"><type>constexpr <classname>ctti_type_index</classname></type><template>
110           <template-type-parameter name="T"/>
111         </template></method>
112 <method name="type_id_with_cvr" cv="noexcept" specifiers="static"><type>constexpr <classname>ctti_type_index</classname></type><template>
113           <template-type-parameter name="T"/>
114         </template></method>
115 <method name="type_id_runtime" cv="noexcept" specifiers="static"><type><classname>ctti_type_index</classname></type><template>
116           <template-type-parameter name="T"/>
117         </template><parameter name="variable"><paramtype>const T &amp;</paramtype></parameter></method>
118 </method-group>
119 </class>
120
121
122 <function name="ctti_construct"><type><emphasis>unspecified</emphasis></type><template>
123           <template-type-parameter name="T"/>
124         </template><purpose>Helper method for getting <classname alt="boost::typeindex::detail::ctti_data">detail::ctti_data</classname> of a template parameter T. </purpose></function>
125
126
127
128
129
130
131
132
133
134
135
136
137
138 </namespace>
139
140 </namespace>
141 </header>
142 <header name="boost/type_index/runtime_cast.hpp">
143 <para>Contains the basic utilities necessary to fully emulate dynamic_cast for language level constructs (raw pointers and references). </para><para>boost::typeindex::runtime_cast is a drop in replacement for dynamic_cast that can be used in situations where traditional rtti is either unavailable or undesirable. </para></header>
144 <header name="boost/type_index/runtime_cast/boost_shared_ptr_cast.hpp">
145 <para>Contains the overload of boost::typeindex::runtime_pointer_cast for boost::shared_ptr types. </para><namespace name="boost">
146 <namespace name="typeindex">
147
148
149
150
151
152
153
154
155
156 <function name="runtime_pointer_cast"><type>boost::shared_ptr&lt; T &gt;</type><template>
157           <template-type-parameter name="T"><purpose><para>The desired target type to return a pointer of. </para></purpose></template-type-parameter>
158           <template-type-parameter name="U"><purpose><para>A complete class type of the source instance pointed to from u. </para></purpose></template-type-parameter>
159         </template><parameter name="u"><paramtype>boost::shared_ptr&lt; U &gt; const &amp;</paramtype></parameter><purpose>Creates a new instance of std::shared_ptr whose stored pointer is obtained from u's stored pointer using a runtime_cast. </purpose><description><para>The new shared_ptr will share ownership with u, except that it is empty if the runtime_cast performed by runtime_pointer_cast returns a null pointer. 
160
161 </para></description><returns><para>If there exists a valid conversion from U* to T*, returns a boost::shared_ptr&lt;T&gt; that points to an address suitably offset from u. If no such conversion exists, returns boost::shared_ptr&lt;T&gt;(); </para></returns></function>
162
163
164
165
166
167
168
169 </namespace>
170
171 </namespace>
172 </header>
173 <header name="boost/type_index/runtime_cast/pointer_cast.hpp">
174 <namespace name="boost">
175 <namespace name="typeindex">
176
177
178
179
180
181
182
183
184
185
186 <function name="runtime_cast"><type>T</type><template>
187           <template-type-parameter name="T"><purpose><para>The desired target type. Like dynamic_cast, must be a pointer to complete class type. </para></purpose></template-type-parameter>
188           <template-type-parameter name="U"><purpose><para>A complete class type of the source instance, u. </para></purpose></template-type-parameter>
189         </template><parameter name="u"><paramtype>U *</paramtype></parameter><purpose>Safely converts pointers to classes up, down, and sideways along the inheritance hierarchy. </purpose><description><para>
190
191 </para></description><returns><para>If there exists a valid conversion from U* to T, returns a T that points to an address suitably offset from u. If no such conversion exists, returns NULL. </para></returns></function>
192 <function name="runtime_cast"><type>T</type><template>
193           <template-type-parameter name="T"><purpose><para>The desired target type. Like dynamic_cast, must be a pointer to complete class type. </para></purpose></template-type-parameter>
194           <template-type-parameter name="U"><purpose><para>A complete class type of the source instance, u. </para></purpose></template-type-parameter>
195         </template><parameter name="u"><paramtype>U const *</paramtype></parameter><purpose>Safely converts pointers to classes up, down, and sideways along the inheritance hierarchy. </purpose><description><para>
196
197 </para></description><returns><para>If there exists a valid conversion from U* to T, returns a T that points to an address suitably offset from u. If no such conversion exists, returns NULL. </para></returns></function>
198 <function name="runtime_pointer_cast"><type>T *</type><template>
199           <template-type-parameter name="T"><purpose><para>The desired target type to return a pointer to. </para></purpose></template-type-parameter>
200           <template-type-parameter name="U"><purpose><para>A complete class type of the source instance, u. </para></purpose></template-type-parameter>
201         </template><parameter name="u"><paramtype>U *</paramtype></parameter><purpose>Safely converts pointers to classes up, down, and sideways along the inheritance hierarchy. </purpose><description><para>
202
203 </para></description><returns><para>If there exists a valid conversion from U const* to T*, returns a T* that points to an address suitably offset from u. If no such conversion exists, returns NULL. </para></returns></function>
204 <function name="runtime_pointer_cast"><type>T const *</type><template>
205           <template-type-parameter name="T"><purpose><para>The desired target type to return a pointer to. </para></purpose></template-type-parameter>
206           <template-type-parameter name="U"><purpose><para>A complete class type of the source instance, u. </para></purpose></template-type-parameter>
207         </template><parameter name="u"><paramtype>U const *</paramtype></parameter><purpose>Safely converts pointers to classes up, down, and sideways along the inheritance hierarchy. </purpose><description><para>
208
209 </para></description><returns><para>If there exists a valid conversion from U const* to T const*, returns a T const* that points to an address suitably offset from u. If no such conversion exists, returns NULL. </para></returns></function>
210
211
212
213 </namespace>
214
215 </namespace>
216 </header>
217 <header name="boost/type_index/runtime_cast/reference_cast.hpp">
218 <para>Contains the overload of boost::typeindex::runtime_cast for reference types. </para><namespace name="boost">
219 <namespace name="typeindex">
220 <struct name="bad_runtime_cast"><inherit access="public">exception</inherit><purpose>Indicates that runtime_cast was unable to perform the desired cast operation because the source instance was not also an instance of the target type. </purpose></struct>
221
222
223
224
225
226
227
228
229
230
231
232
233
234 <function name="runtime_cast"><type>boost::add_reference&lt; T &gt;::type</type><template>
235           <template-type-parameter name="T"><purpose><para>The desired target type. Like dynamic_cast, must be a pointer to complete class type. </para></purpose></template-type-parameter>
236           <template-type-parameter name="U"><purpose><para>A complete class type of the source instance, u. </para></purpose></template-type-parameter>
237         </template><parameter name="u"><paramtype>U &amp;</paramtype></parameter><purpose>Safely converts references to classes up, down, and sideways along the inheritance hierarchy. </purpose><description><para>
238
239 </para></description><returns><para>If there exists a valid conversion from U&amp; to T, returns a T that references an address suitably offset from u. If no such conversion exists, throws <classname alt="boost::typeindex::bad_runtime_cast">boost::typeindex::bad_runtime_cast</classname>. </para></returns></function>
240 <function name="runtime_cast"><type>boost::add_reference&lt; const T &gt;::type</type><template>
241           <template-type-parameter name="T"><purpose><para>The desired target type. Like dynamic_cast, must be a pointer to complete class type. </para></purpose></template-type-parameter>
242           <template-type-parameter name="U"><purpose><para>A complete class type of the source instance, u. </para></purpose></template-type-parameter>
243         </template><parameter name="u"><paramtype>U const &amp;</paramtype></parameter><purpose>Safely converts references to classes up, down, and sideways along the inheritance hierarchy. </purpose><description><para>
244
245 </para></description><returns><para>If there exists a valid conversion from U const&amp; to T const, returns a T const that references an address suitably offset from u. If no such conversion exists, throws <classname alt="boost::typeindex::bad_runtime_cast">boost::typeindex::bad_runtime_cast</classname>. </para></returns></function>
246
247 </namespace>
248
249 </namespace>
250 </header>
251 <header name="boost/type_index/runtime_cast/register_runtime_class.hpp">
252 <para>Contains the macros BOOST_TYPE_INDEX_IMPLEMENT_RUNTIME_CAST and BOOST_TYPE_INDEX_REGISTER_RUNTIME_CLASS. </para><namespace name="boost">
253 <namespace name="typeindex">
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271 </namespace>
272
273 </namespace>
274 <macro name="BOOST_TYPE_INDEX_REGISTER_RUNTIME_CLASS" kind="functionlike"><macro-parameter name="base_class_seq"><description><para>A Boost.Preprocessor sequence of the current class' direct bases, or BOOST_TYPE_INDEX_NO_BASE_CLASS if this class has no direct base classes. </para></description></macro-parameter><purpose>Macro used to make a class compatible with boost::typeindex::runtime_cast. </purpose><description><para>BOOST_TYPE_INDEX_REGISTER_RUNTIME_CLASS generates a virtual function in the current class that, when combined with the supplied base class information, allows boost::typeindex::runtime_cast to accurately convert between dynamic types of instances of the current class.</para><para>BOOST_TYPE_INDEX_REGISTER_RUNTIME_CLASS also adds support for boost::typeindex::type_id_runtime by including BOOST_TYPE_INDEX_REGISTER_CLASS. It is typical that these features are used together, but in the event that BOOST_TYPE_INDEX_REGISTER_CLASS is undesirable in the current class, BOOST_TYPE_INDEX_IMPLEMENT_RUNTIME_CAST is provided.</para><para><emphasis role="bold">Example:</emphasis> <programlisting language="c++">struct base1 {
275     BOOST_TYPE_INDEX_REGISTER_RUNTIME_CLASS(BOOST_TYPE_INDEX_NO_BASE_CLASS)
276     virtual ~base1();
277 };
278
279 struct base2 {
280     BOOST_TYPE_INDEX_REGISTER_RUNTIME_CLASS(BOOST_TYPE_INDEX_NO_BASE_CLASS)
281     virtual ~base2();
282 };
283
284 struct derived1 : base1 {
285     BOOST_TYPE_INDEX_REGISTER_RUNTIME_CLASS((base1))
286 };
287
288 struct derived2 : base1, base2 {
289     BOOST_TYPE_INDEX_REGISTER_RUNTIME_CLASS((base1)(base2))
290 };
291
292 ...
293
294 base1* pb1 = get_object();
295 if(derived2* pb2 = boost::typeindex::runtime_cast&lt;derived2*&gt;(pb1)) {
296     assert(boost::typeindex::type_id_runtime(*pb1)) == boost::typeindex::type_id&lt;derived2&gt;());
297 }
298 </programlisting></para><para>
299 </para></description></macro>
300 <macro name="BOOST_TYPE_INDEX_IMPLEMENT_RUNTIME_CAST" kind="functionlike"><macro-parameter name="base_class_seq"><description><para>A Boost.Preprocessor sequence of the current class' direct bases, or BOOST_TYPE_INDEX_NO_BASE_CLASS if this class has no direct base classes. </para></description></macro-parameter><purpose>Macro used to make a class compatible with boost::typeindex::runtime_cast without including support for boost::typeindex::type_id_runtime. </purpose><description><para>BOOST_TYPE_INDEX_IMPLEMENT_RUNTIME_CAST is provided as an alternative to BOOST_TYPE_INDEX_REGISTER_RUNTIME_CLASS in the event that support for boost::typeindex::type_id_runtime is undesirable.</para><para><emphasis role="bold">Example:</emphasis> <programlisting language="c++">struct base1 {
301     BOOST_TYPE_INDEX_IMPLEMENT_RUNTIME_CAST(BOOST_TYPE_INDEX_NO_BASE_CLASS)
302     virtual ~base1();
303 };
304
305 struct base2 {
306     BOOST_TYPE_INDEX_IMPLEMENT_RUNTIME_CAST(BOOST_TYPE_INDEX_NO_BASE_CLASS)
307     virtual ~base2();
308 };
309
310 struct derived1 : base1 {
311     BOOST_TYPE_INDEX_IMPLEMENT_RUNTIME_CAST((base1))
312 };
313
314 struct derived2 : base1, base2 {
315     BOOST_TYPE_INDEX_IMPLEMENT_RUNTIME_CAST((base1)(base2))
316 };
317
318 ...
319
320 base1* pb1 = get_object();
321 if(derived2* pb2 = boost::typeindex::runtime_cast&lt;derived2*&gt;(pb1))
322 { /* can't call boost::typeindex::type_id_runtime(*pb1) here */ }
323 </programlisting></para><para>
324 </para></description></macro>
325 <macro name="BOOST_TYPE_INDEX_NO_BASE_CLASS"><purpose>Instructs BOOST_TYPE_INDEX_REGISTER_RUNTIME_CLASS and BOOST_TYPE_INDEX_IMPLEMENT_RUNTIME_CAST that this class has no base classes. </purpose></macro>
326 </header>
327 <header name="boost/type_index/runtime_cast/std_shared_ptr_cast.hpp">
328 <para>Contains the overload of boost::typeindex::runtime_pointer_cast for std::shared_ptr types. </para><namespace name="boost">
329 <namespace name="typeindex">
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346 <function name="runtime_pointer_cast"><type>std::shared_ptr&lt; T &gt;</type><template>
347           <template-type-parameter name="T"><purpose><para>The desired target type to return a pointer of. </para></purpose></template-type-parameter>
348           <template-type-parameter name="U"><purpose><para>A complete class type of the source instance pointed to from u. </para></purpose></template-type-parameter>
349         </template><parameter name="u"><paramtype>std::shared_ptr&lt; U &gt; const &amp;</paramtype></parameter><purpose>Creates a new instance of std::shared_ptr whose stored pointer is obtained from u's stored pointer using a runtime_cast. </purpose><description><para>The new shared_ptr will share ownership with u, except that it is empty if the runtime_cast performed by runtime_pointer_cast returns a null pointer. 
350
351 </para></description><returns><para>If there exists a valid conversion from U* to T*, returns a std::shared_ptr&lt;T&gt; that points to an address suitably offset from u. If no such conversion exists, returns std::shared_ptr&lt;T&gt;(); </para></returns></function>
352 </namespace>
353
354 </namespace>
355 </header>
356 <header name="boost/type_index/stl_type_index.hpp">
357 <para>Contains <classname alt="boost::typeindex::stl_type_index">boost::typeindex::stl_type_index</classname> class. </para><para><classname alt="boost::typeindex::stl_type_index">boost::typeindex::stl_type_index</classname> class can be used as a drop-in replacement for std::type_index.</para><para>It is used in situations when RTTI is enabled or typeid() method is available. When typeid() is disabled or BOOST_TYPE_INDEX_FORCE_NO_RTTI_COMPATIBILITY macro is defined boost::typeindex::ctti is usually used instead of <classname alt="boost::typeindex::stl_type_index">boost::typeindex::stl_type_index</classname>. </para><namespace name="boost">
358 <namespace name="typeindex">
359 <class name="stl_type_index"><inherit access="public">boost::typeindex::type_index_facade&lt; stl_type_index, std::type_info &gt;</inherit><description><para>This class is a wrapper around std::type_info, that workarounds issues and provides much more rich interface. <emphasis role="bold">For</emphasis> <emphasis role="bold">description</emphasis> <emphasis role="bold">of</emphasis> <emphasis role="bold">functions</emphasis> <emphasis role="bold">see</emphasis> <classname alt="boost::typeindex::type_index_facade">type_index_facade</classname>.</para><para>This class requires typeid() to work. For cases when RTTI is disabled see <classname alt="boost::typeindex::ctti_type_index">ctti_type_index</classname>. </para></description><typedef name="type_info_t"><type>std::type_info</type></typedef>
360 <method-group name="public member functions">
361 <method name="type_info" cv="const noexcept"><type>const type_info_t &amp;</type></method>
362 <method name="raw_name" cv="const noexcept"><type>const char *</type></method>
363 <method name="name" cv="const noexcept"><type>const char *</type></method>
364 <method name="pretty_name" cv="const"><type>std::string</type></method>
365 <method name="hash_code" cv="const noexcept"><type>std::size_t</type></method>
366 <method name="equal" cv="const noexcept"><type>bool</type><parameter name="rhs"><paramtype>const <classname>stl_type_index</classname> &amp;</paramtype></parameter></method>
367 <method name="before" cv="const noexcept"><type>bool</type><parameter name="rhs"><paramtype>const <classname>stl_type_index</classname> &amp;</paramtype></parameter></method>
368 </method-group>
369 <constructor cv="noexcept"/>
370 <constructor cv="noexcept"><parameter name="data"><paramtype>const type_info_t &amp;</paramtype></parameter></constructor>
371 <method-group name="public static functions">
372 <method name="type_id" cv="noexcept" specifiers="static"><type><classname>stl_type_index</classname></type><template>
373           <template-type-parameter name="T"/>
374         </template></method>
375 <method name="type_id_with_cvr" cv="noexcept" specifiers="static"><type><classname>stl_type_index</classname></type><template>
376           <template-type-parameter name="T"/>
377         </template></method>
378 <method name="type_id_runtime" cv="noexcept" specifiers="static"><type><classname>stl_type_index</classname></type><template>
379           <template-type-parameter name="T"/>
380         </template><parameter name="value"><paramtype>const T &amp;</paramtype></parameter></method>
381 </method-group>
382 </class>
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399 </namespace>
400
401 </namespace>
402 </header>
403 <header name="boost/type_index/type_index_facade.hpp">
404 <namespace name="boost">
405 <namespace name="typeindex">
406 <class name="type_index_facade"><template>
407       <template-type-parameter name="Derived"><purpose><para>Class derived from <classname alt="boost::typeindex::type_index_facade">type_index_facade</classname>. </para></purpose></template-type-parameter>
408       <template-type-parameter name="TypeInfo"><purpose><para>Class that will be used as a base type_info class. </para></purpose></template-type-parameter>
409     </template><description><para>This class takes care about the comparison operators, hash functions and ostream operators. Use this class as a public base class for defining new type_info-conforming classes.</para><para><emphasis role="bold">Example:</emphasis> <programlisting language="c++">class stl_type_index: public type_index_facade&lt;stl_type_index, std::type_info&gt; 
410 {
411 public:
412     typedef std::type_info type_info_t;
413 private:
414     const type_info_t* data_;
415
416 public:
417     stl_type_index(const type_info_t&amp; data) noexcept
418         : data_(&amp;data)
419     {}
420 // ...
421 };
422 </programlisting></para><para>
423 <note><para>Take a look at the protected methods. They are <emphasis role="bold">not</emphasis> <emphasis role="bold">defined</emphasis> in <classname alt="boost::typeindex::type_index_facade">type_index_facade</classname>. Protected member functions raw_name() <emphasis role="bold">must</emphasis> be defined in Derived class. All the other methods are mandatory. </para></note>
424 <para><emphasis role="bold">See Also:</emphasis><para>'Making a custom type_index' section for more information about creating your own type_index using <classname alt="boost::typeindex::type_index_facade">type_index_facade</classname>. </para></para>
425 </para></description><typedef name="type_info_t"><type>TypeInfo</type></typedef>
426 <method-group name="public member functions">
427 <method name="name" cv="const noexcept"><type>const char *</type><description><para><emphasis role="bold">Override:</emphasis> This function <emphasis role="bold">may</emphasis> be redefined in Derived class. Overrides <emphasis role="bold">must</emphasis> not throw. 
428 </para></description><returns><para>Name of a type. By default returns Derived::raw_name(). </para></returns></method>
429 <method name="pretty_name" cv="const"><type>std::string</type><description><para><emphasis role="bold">Override:</emphasis> This function <emphasis role="bold">may</emphasis> be redefined in Derived class. Overrides may throw. 
430 </para></description><returns><para>Human readable type name. By default returns Derived::name(). </para></returns></method>
431 <method name="equal" cv="const noexcept"><type>bool</type><parameter name="rhs"><paramtype>const Derived &amp;</paramtype></parameter><description><para><emphasis role="bold">Override:</emphasis> This function <emphasis role="bold">may</emphasis> be redefined in Derived class. Overrides <emphasis role="bold">must</emphasis> not throw. 
432 </para></description><returns><para>True if two types are equal. By default compares types by raw_name(). </para></returns></method>
433 <method name="before" cv="const noexcept"><type>bool</type><parameter name="rhs"><paramtype>const Derived &amp;</paramtype></parameter><description><para><emphasis role="bold">Override:</emphasis> This function <emphasis role="bold">may</emphasis> be redefined in Derived class. Overrides <emphasis role="bold">must</emphasis> not throw. 
434 </para></description><returns><para>True if rhs is greater than this. By default compares types by raw_name(). </para></returns></method>
435 <method name="hash_code" cv="const noexcept"><type>std::size_t</type><description><para><emphasis role="bold">Override:</emphasis> This function <emphasis role="bold">may</emphasis> be redefined in Derived class. Overrides <emphasis role="bold">must</emphasis> not throw. 
436 <note><para>&lt;boost/functional/hash.hpp&gt; has to be included if this function is used. </para></note>
437 </para></description><returns><para>Hash code of a type. By default hashes types by raw_name(). </para></returns></method>
438 </method-group>
439 <method-group name="protected member functions">
440 <method name="raw_name" cv="const noexcept"><type>const char *</type><description><para><emphasis role="bold">Override:</emphasis> This function <emphasis role="bold">must</emphasis> be redefined in Derived class. Overrides <emphasis role="bold">must</emphasis> not throw. 
441 </para></description><returns><para>Pointer to unredable/raw type name. </para></returns></method>
442 <method name="type_info" cv="const noexcept"><type>const type_info_t &amp;</type><description><para><emphasis role="bold">Override:</emphasis> This function <emphasis role="bold">may</emphasis> be redefined in Derived class. Overrides <emphasis role="bold">must</emphasis> not throw. 
443 </para></description><returns><para>Const reference to underlying low level type_info_t. </para></returns></method>
444 </method-group>
445 <method-group name="protected static functions">
446 <method name="type_id" cv="noexcept" specifiers="static"><type>Derived</type><template>
447           <template-type-parameter name="T"><purpose><para>Type for which type_index must be created. </para></purpose></template-type-parameter>
448         </template><description><para>This is a factory method that is used to create instances of Derived classes. boost::typeindex::type_id() will call this method, if Derived has same type as boost::typeindex::type_index.</para><para><emphasis role="bold">Override:</emphasis> This function <emphasis role="bold">may</emphasis> be redefined and made public in Derived class. Overrides <emphasis role="bold">must</emphasis> not throw. Overrides <emphasis role="bold">must</emphasis> remove const, volatile &amp;&amp; and &amp; modifiers from T. 
449
450 </para></description><returns><para>type_index for type T. </para></returns></method>
451 <method name="type_id_with_cvr" cv="noexcept" specifiers="static"><type>Derived</type><template>
452           <template-type-parameter name="T"><purpose><para>Type for which type_index must be created. </para></purpose></template-type-parameter>
453         </template><description><para>This is a factory method that is used to create instances of Derived classes. boost::typeindex::type_id_with_cvr() will call this method, if Derived has same type as boost::typeindex::type_index.</para><para><emphasis role="bold">Override:</emphasis> This function <emphasis role="bold">may</emphasis> be redefined and made public in Derived class. Overrides <emphasis role="bold">must</emphasis> not throw. Overrides <emphasis role="bold">must</emphasis> <emphasis role="bold">not</emphasis> remove const, volatile &amp;&amp; and &amp; modifiers from T. 
454
455 </para></description><returns><para>type_index for type T. </para></returns></method>
456 <method name="type_id_runtime" cv="noexcept" specifiers="static"><type>Derived</type><template>
457           <template-type-parameter name="T"/>
458         </template><parameter name="variable"><paramtype>const T &amp;</paramtype><description><para>Variable which runtime type will be stored in type_index. </para></description></parameter><description><para>This is a factory method that is used to create instances of Derived classes. boost::typeindex::type_id_runtime(const T&amp;) will call this method, if Derived has same type as boost::typeindex::type_index.</para><para><emphasis role="bold">Override:</emphasis> This function <emphasis role="bold">may</emphasis> be redefined and made public in Derived class. 
459
460 </para></description><returns><para>type_index with runtime type of variable. </para></returns></method>
461 </method-group>
462 </class>
463
464
465
466 <function name="operator==,!=,&lt;,..."><type>bool</type><parameter name="lhs"><paramtype>const <classname>type_index_facade</classname> &amp;</paramtype></parameter><parameter name="rhs"><paramtype>const <classname>type_index_facade</classname> &amp;</paramtype></parameter><purpose>noexcept comparison operators for <classname alt="boost::typeindex::type_index_facade">type_index_facade</classname> classes. </purpose></function>
467 <function name="operator==,!=,&lt;,..."><type>bool</type><parameter name="lhs"><paramtype>const <classname>type_index_facade</classname> &amp;</paramtype></parameter><parameter name="rhs"><paramtype>const TypeInfo &amp;</paramtype></parameter><purpose>noexcept comparison operators for <classname alt="boost::typeindex::type_index_facade">type_index_facade</classname> and it's TypeInfo classes. </purpose></function>
468 <function name="operator==,!=,&lt;,..."><type>bool</type><parameter name="lhs"><paramtype>const TypeInfo &amp;</paramtype></parameter><parameter name="rhs"><paramtype>const <classname>type_index_facade</classname> &amp;</paramtype></parameter><purpose>noexcept comparison operators for <classname alt="boost::typeindex::type_index_facade">type_index_facade</classname>'s TypeInfo and <classname alt="boost::typeindex::type_index_facade">type_index_facade</classname> classes. </purpose></function>
469 <function name="operator&lt;&lt;"><type>std::basic_ostream&lt; CharT, TriatT &gt; &amp;</type><template>
470           <template-type-parameter name="CharT"/>
471           <template-type-parameter name="TriatT"/>
472           <template-type-parameter name="Derived"/>
473           <template-type-parameter name="TypeInfo"/>
474         </template><parameter name="ostr"><paramtype>std::basic_ostream&lt; CharT, TriatT &gt; &amp;</paramtype></parameter><parameter name="ind"><paramtype>const <classname>type_index_facade</classname>&lt; Derived, TypeInfo &gt; &amp;</paramtype></parameter><purpose>Ostream operator that will output demangled name. </purpose></function>
475 <function name="hash_value"><type>std::size_t</type><template>
476           <template-type-parameter name="Derived"/>
477           <template-type-parameter name="TypeInfo"/>
478         </template><parameter name="lhs"><paramtype>const <classname>type_index_facade</classname>&lt; Derived, TypeInfo &gt; &amp;</paramtype></parameter><description><para>This free function is used by Boost's unordered containers. <note><para>&lt;boost/functional/hash.hpp&gt; has to be included if this function is used. </para></note>
479 </para></description></function>
480
481
482
483
484
485
486
487
488 </namespace>
489 <function name="hash_range"><type>std::size_t</type><template>
490           <template-type-parameter name="It"/>
491         </template><parameter name=""><paramtype>It</paramtype></parameter><parameter name=""><paramtype>It</paramtype></parameter></function>
492 </namespace>
493 </header>
494 </library-reference>