Blame libs/type_index/doc/autodoc.xml

Packit 58578d
Packit 58578d
<library-reference id="boost_typeindex_header_reference"><title>Boost.TypeIndex Header Reference</title><header name="boost/type_index.hpp">
Packit 58578d
<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">
Packit 58578d
<namespace name="typeindex">
Packit 58578d
<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>
Packit 58578d
<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>
Packit 58578d
<function name="type_id"><type>type_index</type><template>
Packit 58578d
          <template-type-parameter name="T"><purpose><para>Type for which type_index must be created. </para></purpose></template-type-parameter>
Packit 58578d
        </template><description><para>Function to get boost::typeindex::type_index for a type T. Removes const, volatile && and & modifiers from T.</para><para><emphasis role="bold">Example:</emphasis> <programlisting language="c++">type_index ti = type_id<int&>();
Packit 58578d
std::cout << ti.pretty_name();  // Outputs 'int'
Packit 58578d
</programlisting></para><para>
Packit 58578d
Packit 58578d
Packit 58578d
</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>
Packit 58578d
<function name="type_id_with_cvr"><type>type_index</type><template>
Packit 58578d
          <template-type-parameter name="T"><purpose><para>Type for which type_index must be created. </para></purpose></template-type-parameter>
Packit 58578d
        </template><description><para>Function for constructing boost::typeindex::type_index instance for type T. Does not remove const, volatile, & and && modifiers from T.</para><para>If T has no const, volatile, & and && modifiers, then returns exactly the same result as in case of calling <computeroutput>type_id<T>()</computeroutput>.</para><para><emphasis role="bold">Example:</emphasis> <programlisting language="c++">type_index ti = type_id_with_cvr<int&>();
Packit 58578d
std::cout << ti.pretty_name();  // Outputs 'int&'
Packit 58578d
</programlisting></para><para>
Packit 58578d
Packit 58578d
Packit 58578d
</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>
Packit 58578d
<function name="type_id_runtime"><type>type_index</type><template>
Packit 58578d
          <template-type-parameter name="T"/>
Packit 58578d
        </template><parameter name="runtime_val"><paramtype>const T &</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(){} };
Packit 58578d
struct Derived: public Base  {};
Packit 58578d
...
Packit 58578d
Derived d;
Packit 58578d
Base& b = d;
Packit 58578d
type_index ti = type_id_runtime(b);
Packit 58578d
std::cout << ti.pretty_name();  // Outputs 'Derived'
Packit 58578d
</programlisting></para><para>
Packit 58578d
Packit 58578d
Packit 58578d
</para></description><returns><para>boost::typeindex::type_index with information about the specified variable. </para></returns><throws><simpara><classname>Nothing.</classname> </simpara></throws></function>
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
</namespace>
Packit 58578d
Packit 58578d
</namespace>
Packit 58578d
<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& boost_type_info_type_id_runtime_() const noexcept</computeroutput>.</para><para><emphasis role="bold">Example:</emphasis> <programlisting language="c++">class A {
Packit 58578d
public:
Packit 58578d
    BOOST_TYPE_INDEX_REGISTER_CLASS
Packit 58578d
    virtual ~A(){}
Packit 58578d
};
Packit 58578d
Packit 58578d
struct B: public A {
Packit 58578d
    BOOST_TYPE_INDEX_REGISTER_CLASS
Packit 58578d
};
Packit 58578d
Packit 58578d
struct C: public B {
Packit 58578d
    BOOST_TYPE_INDEX_REGISTER_CLASS
Packit 58578d
};
Packit 58578d
Packit 58578d
...
Packit 58578d
Packit 58578d
C c1;
Packit 58578d
A* pc1 = &c1;
Packit 58578d
assert(boost::typeindex::type_id<C>() == boost::typeindex::type_id_runtime(*pc1));
Packit 58578d
</programlisting> </para></description></macro>
Packit 58578d
<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>
Packit 58578d
<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<int>().pretty_name() 
Packit 58578d
</programlisting> returns the following string: <programlisting language="c++">"static const char *boost::detail::ctti<int>::n() [T = int]" 
Packit 58578d
</programlisting> and<programlisting language="c++">boost::typeindex::ctti_type_index::type_id<short>().pretty_name() 
Packit 58578d
</programlisting> returns the following: <programlisting language="c++">"static const char *boost::detail::ctti<short>::n() [T = short]" 
Packit 58578d
</programlisting></para><para>As we may see first 39 characters are "static const char *boost::detail::ctti<" 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>::n() [T = int" 
Packit 58578d
</programlisting> for <computeroutput>boost::typeindex::ctti_type_index::type_id<int>().pretty_name()</computeroutput> and<programlisting language="c++">"short>::n() [T = short" 
Packit 58578d
</programlisting> for <computeroutput>boost::typeindex::ctti_type_index::type_id<short>().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 = ") 
Packit 58578d
</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 = ")'
Packit 58578d
</programlisting> 
Packit 58578d
See <ulink url="boost_typeindex/rtti_emulation_limitations.html">RTTI emulation limitations</ulink> for more info. </para></description></macro>
Packit 58578d
<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>
Packit 58578d
<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>
Packit 58578d
</header>
Packit 58578d
<header name="boost/type_index/ctti_type_index.hpp">
Packit 58578d
<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">
Packit 58578d
<namespace name="typeindex">
Packit 58578d
<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>
Packit 58578d
<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& rhs), equal(const ctti_type_index& rhs)</para></listitem><listitem><para>static methods type_id<T>(), type_id_with_cvr<T>()</para></listitem><listitem><para>comparison operators</para></listitem></itemizedlist>
Packit 58578d
</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>
Packit 58578d
<method-group name="private member functions">
Packit 58578d
<method name="get_raw_name_length" cv="const noexcept"><type>std::size_t</type></method>
Packit 58578d
</method-group>
Packit 58578d
<constructor specifiers="explicit" cv="noexcept"><parameter name="data"><paramtype>const char *</paramtype></parameter></constructor>
Packit 58578d
<method-group name="public member functions">
Packit 58578d
<method name="type_info" cv="const noexcept"><type>const <classname>type_info_t</classname> &</type></method>
Packit 58578d
<method name="raw_name" cv="const noexcept"><type>constexpr const char *</type></method>
Packit 58578d
<method name="name" cv="const noexcept"><type>constexpr const char *</type></method>
Packit 58578d
<method name="pretty_name" cv="const"><type>std::string</type></method>
Packit 58578d
<method name="hash_code" cv="const noexcept"><type>std::size_t</type></method>
Packit 58578d
<method name="equal" cv="const noexcept"><type>constexpr bool</type><parameter name="rhs"><paramtype>const <classname>ctti_type_index</classname> &</paramtype></parameter></method>
Packit 58578d
<method name="before" cv="const noexcept"><type>constexpr bool</type><parameter name="rhs"><paramtype>const <classname>ctti_type_index</classname> &</paramtype></parameter></method>
Packit 58578d
</method-group>
Packit 58578d
<constructor cv="noexcept"/>
Packit 58578d
<constructor cv="noexcept"><parameter name="data"><paramtype>const <classname>type_info_t</classname> &</paramtype></parameter></constructor>
Packit 58578d
<method-group name="public static functions">
Packit 58578d
<method name="type_id" cv="noexcept" specifiers="static"><type>constexpr <classname>ctti_type_index</classname></type><template>
Packit 58578d
          <template-type-parameter name="T"/>
Packit 58578d
        </template></method>
Packit 58578d
<method name="type_id_with_cvr" cv="noexcept" specifiers="static"><type>constexpr <classname>ctti_type_index</classname></type><template>
Packit 58578d
          <template-type-parameter name="T"/>
Packit 58578d
        </template></method>
Packit 58578d
<method name="type_id_runtime" cv="noexcept" specifiers="static"><type><classname>ctti_type_index</classname></type><template>
Packit 58578d
          <template-type-parameter name="T"/>
Packit 58578d
        </template><parameter name="variable"><paramtype>const T &</paramtype></parameter></method>
Packit 58578d
</method-group>
Packit 58578d
</class>
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
<function name="ctti_construct"><type><emphasis>unspecified</emphasis></type><template>
Packit 58578d
          <template-type-parameter name="T"/>
Packit 58578d
        </template><purpose>Helper method for getting <classname alt="boost::typeindex::detail::ctti_data">detail::ctti_data</classname> of a template parameter T. </purpose></function>
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
</namespace>
Packit 58578d
Packit 58578d
</namespace>
Packit 58578d
</header>
Packit 58578d
<header name="boost/type_index/runtime_cast.hpp">
Packit 58578d
<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>
Packit 58578d
<header name="boost/type_index/runtime_cast/boost_shared_ptr_cast.hpp">
Packit 58578d
<para>Contains the overload of boost::typeindex::runtime_pointer_cast for boost::shared_ptr types. </para><namespace name="boost">
Packit 58578d
<namespace name="typeindex">
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
<function name="runtime_pointer_cast"><type>boost::shared_ptr< T ></type><template>
Packit 58578d
          <template-type-parameter name="T"><purpose><para>The desired target type to return a pointer of. </para></purpose></template-type-parameter>
Packit 58578d
          <template-type-parameter name="U"><purpose><para>A complete class type of the source instance pointed to from u. </para></purpose></template-type-parameter>
Packit 58578d
        </template><parameter name="u"><paramtype>boost::shared_ptr< U > const &</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. 
Packit 58578d
Packit 58578d
</para></description><returns><para>If there exists a valid conversion from U* to T*, returns a boost::shared_ptr<T> that points to an address suitably offset from u. If no such conversion exists, returns boost::shared_ptr<T>(); </para></returns></function>
Packit 58578d
</namespace>
Packit 58578d
Packit 58578d
</namespace>
Packit 58578d
</header>
Packit 58578d
<header name="boost/type_index/runtime_cast/pointer_cast.hpp">
Packit 58578d
<namespace name="boost">
Packit 58578d
<namespace name="typeindex">
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
<function name="runtime_cast"><type>T</type><template>
Packit 58578d
          <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>
Packit 58578d
          <template-type-parameter name="U"><purpose><para>A complete class type of the source instance, u. </para></purpose></template-type-parameter>
Packit 58578d
        </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>
Packit 58578d
Packit 58578d
</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>
Packit 58578d
<function name="runtime_cast"><type>T</type><template>
Packit 58578d
          <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>
Packit 58578d
          <template-type-parameter name="U"><purpose><para>A complete class type of the source instance, u. </para></purpose></template-type-parameter>
Packit 58578d
        </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>
Packit 58578d
Packit 58578d
</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>
Packit 58578d
<function name="runtime_pointer_cast"><type>T *</type><template>
Packit 58578d
          <template-type-parameter name="T"><purpose><para>The desired target type to return a pointer to. </para></purpose></template-type-parameter>
Packit 58578d
          <template-type-parameter name="U"><purpose><para>A complete class type of the source instance, u. </para></purpose></template-type-parameter>
Packit 58578d
        </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>
Packit 58578d
Packit 58578d
</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>
Packit 58578d
<function name="runtime_pointer_cast"><type>T const *</type><template>
Packit 58578d
          <template-type-parameter name="T"><purpose><para>The desired target type to return a pointer to. </para></purpose></template-type-parameter>
Packit 58578d
          <template-type-parameter name="U"><purpose><para>A complete class type of the source instance, u. </para></purpose></template-type-parameter>
Packit 58578d
        </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>
Packit 58578d
Packit 58578d
</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>
Packit 58578d
Packit 58578d
</namespace>
Packit 58578d
Packit 58578d
</namespace>
Packit 58578d
</header>
Packit 58578d
<header name="boost/type_index/runtime_cast/reference_cast.hpp">
Packit 58578d
<para>Contains the overload of boost::typeindex::runtime_cast for reference types. </para><namespace name="boost">
Packit 58578d
<namespace name="typeindex">
Packit 58578d
<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>
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
<function name="runtime_cast"><type>boost::add_reference< T >::type</type><template>
Packit 58578d
          <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>
Packit 58578d
          <template-type-parameter name="U"><purpose><para>A complete class type of the source instance, u. </para></purpose></template-type-parameter>
Packit 58578d
        </template><parameter name="u"><paramtype>U &</paramtype></parameter><purpose>Safely converts references to classes up, down, and sideways along the inheritance hierarchy. </purpose><description><para>
Packit 58578d
Packit 58578d
</para></description><returns><para>If there exists a valid conversion from U& 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>
Packit 58578d
<function name="runtime_cast"><type>boost::add_reference< const T >::type</type><template>
Packit 58578d
          <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>
Packit 58578d
          <template-type-parameter name="U"><purpose><para>A complete class type of the source instance, u. </para></purpose></template-type-parameter>
Packit 58578d
        </template><parameter name="u"><paramtype>U const &</paramtype></parameter><purpose>Safely converts references to classes up, down, and sideways along the inheritance hierarchy. </purpose><description><para>
Packit 58578d
Packit 58578d
</para></description><returns><para>If there exists a valid conversion from U const& 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>
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
</namespace>
Packit 58578d
Packit 58578d
</namespace>
Packit 58578d
</header>
Packit 58578d
<header name="boost/type_index/runtime_cast/register_runtime_class.hpp">
Packit 58578d
<para>Contains the macros BOOST_TYPE_INDEX_IMPLEMENT_RUNTIME_CAST and BOOST_TYPE_INDEX_REGISTER_RUNTIME_CLASS. </para><namespace name="boost">
Packit 58578d
<namespace name="typeindex">
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
</namespace>
Packit 58578d
Packit 58578d
</namespace>
Packit 58578d
<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 {
Packit 58578d
    BOOST_TYPE_INDEX_REGISTER_RUNTIME_CLASS(BOOST_TYPE_INDEX_NO_BASE_CLASS)
Packit 58578d
    virtual ~base1();
Packit 58578d
};
Packit 58578d
Packit 58578d
struct base2 {
Packit 58578d
    BOOST_TYPE_INDEX_REGISTER_RUNTIME_CLASS(BOOST_TYPE_INDEX_NO_BASE_CLASS)
Packit 58578d
    virtual ~base2();
Packit 58578d
};
Packit 58578d
Packit 58578d
struct derived1 : base1 {
Packit 58578d
    BOOST_TYPE_INDEX_REGISTER_RUNTIME_CLASS((base1))
Packit 58578d
};
Packit 58578d
Packit 58578d
struct derived2 : base1, base2 {
Packit 58578d
    BOOST_TYPE_INDEX_REGISTER_RUNTIME_CLASS((base1)(base2))
Packit 58578d
};
Packit 58578d
Packit 58578d
...
Packit 58578d
Packit 58578d
base1* pb1 = get_object();
Packit 58578d
if(derived2* pb2 = boost::typeindex::runtime_cast<derived2*>(pb1)) {
Packit 58578d
    assert(boost::typeindex::type_id_runtime(*pb1)) == boost::typeindex::type_id<derived2>());
Packit 58578d
}
Packit 58578d
</programlisting></para><para>
Packit 58578d
</para></description></macro>
Packit 58578d
<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 {
Packit 58578d
    BOOST_TYPE_INDEX_IMPLEMENT_RUNTIME_CAST(BOOST_TYPE_INDEX_NO_BASE_CLASS)
Packit 58578d
    virtual ~base1();
Packit 58578d
};
Packit 58578d
Packit 58578d
struct base2 {
Packit 58578d
    BOOST_TYPE_INDEX_IMPLEMENT_RUNTIME_CAST(BOOST_TYPE_INDEX_NO_BASE_CLASS)
Packit 58578d
    virtual ~base2();
Packit 58578d
};
Packit 58578d
Packit 58578d
struct derived1 : base1 {
Packit 58578d
    BOOST_TYPE_INDEX_IMPLEMENT_RUNTIME_CAST((base1))
Packit 58578d
};
Packit 58578d
Packit 58578d
struct derived2 : base1, base2 {
Packit 58578d
    BOOST_TYPE_INDEX_IMPLEMENT_RUNTIME_CAST((base1)(base2))
Packit 58578d
};
Packit 58578d
Packit 58578d
...
Packit 58578d
Packit 58578d
base1* pb1 = get_object();
Packit 58578d
if(derived2* pb2 = boost::typeindex::runtime_cast<derived2*>(pb1))
Packit 58578d
{ /* can't call boost::typeindex::type_id_runtime(*pb1) here */ }
Packit 58578d
</programlisting></para><para>
Packit 58578d
</para></description></macro>
Packit 58578d
<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>
Packit 58578d
</header>
Packit 58578d
<header name="boost/type_index/runtime_cast/std_shared_ptr_cast.hpp">
Packit 58578d
<para>Contains the overload of boost::typeindex::runtime_pointer_cast for std::shared_ptr types. </para><namespace name="boost">
Packit 58578d
<namespace name="typeindex">
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
<function name="runtime_pointer_cast"><type>std::shared_ptr< T ></type><template>
Packit 58578d
          <template-type-parameter name="T"><purpose><para>The desired target type to return a pointer of. </para></purpose></template-type-parameter>
Packit 58578d
          <template-type-parameter name="U"><purpose><para>A complete class type of the source instance pointed to from u. </para></purpose></template-type-parameter>
Packit 58578d
        </template><parameter name="u"><paramtype>std::shared_ptr< U > const &</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. 
Packit 58578d
Packit 58578d
</para></description><returns><para>If there exists a valid conversion from U* to T*, returns a std::shared_ptr<T> that points to an address suitably offset from u. If no such conversion exists, returns std::shared_ptr<T>(); </para></returns></function>
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
</namespace>
Packit 58578d
Packit 58578d
</namespace>
Packit 58578d
</header>
Packit 58578d
<header name="boost/type_index/stl_type_index.hpp">
Packit 58578d
<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">
Packit 58578d
<namespace name="typeindex">
Packit 58578d
<class name="stl_type_index"><inherit access="public">boost::typeindex::type_index_facade< stl_type_index, std::type_info ></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>
Packit 58578d
<method-group name="public member functions">
Packit 58578d
<method name="type_info" cv="const noexcept"><type>const type_info_t &</type></method>
Packit 58578d
<method name="raw_name" cv="const noexcept"><type>const char *</type></method>
Packit 58578d
<method name="name" cv="const noexcept"><type>const char *</type></method>
Packit 58578d
<method name="pretty_name" cv="const"><type>std::string</type></method>
Packit 58578d
<method name="hash_code" cv="const noexcept"><type>std::size_t</type></method>
Packit 58578d
<method name="equal" cv="const noexcept"><type>bool</type><parameter name="rhs"><paramtype>const <classname>stl_type_index</classname> &</paramtype></parameter></method>
Packit 58578d
<method name="before" cv="const noexcept"><type>bool</type><parameter name="rhs"><paramtype>const <classname>stl_type_index</classname> &</paramtype></parameter></method>
Packit 58578d
</method-group>
Packit 58578d
<constructor cv="noexcept"/>
Packit 58578d
<constructor cv="noexcept"><parameter name="data"><paramtype>const type_info_t &</paramtype></parameter></constructor>
Packit 58578d
<method-group name="public static functions">
Packit 58578d
<method name="type_id" cv="noexcept" specifiers="static"><type><classname>stl_type_index</classname></type><template>
Packit 58578d
          <template-type-parameter name="T"/>
Packit 58578d
        </template></method>
Packit 58578d
<method name="type_id_with_cvr" cv="noexcept" specifiers="static"><type><classname>stl_type_index</classname></type><template>
Packit 58578d
          <template-type-parameter name="T"/>
Packit 58578d
        </template></method>
Packit 58578d
<method name="type_id_runtime" cv="noexcept" specifiers="static"><type><classname>stl_type_index</classname></type><template>
Packit 58578d
          <template-type-parameter name="T"/>
Packit 58578d
        </template><parameter name="value"><paramtype>const T &</paramtype></parameter></method>
Packit 58578d
</method-group>
Packit 58578d
</class>
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
</namespace>
Packit 58578d
Packit 58578d
</namespace>
Packit 58578d
</header>
Packit 58578d
<header name="boost/type_index/type_index_facade.hpp">
Packit 58578d
<namespace name="boost">
Packit 58578d
<namespace name="typeindex">
Packit 58578d
<class name="type_index_facade"><template>
Packit 58578d
      <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>
Packit 58578d
      <template-type-parameter name="TypeInfo"><purpose><para>Class that will be used as a base type_info class. </para></purpose></template-type-parameter>
Packit 58578d
    </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<stl_type_index, std::type_info> 
Packit 58578d
{
Packit 58578d
public:
Packit 58578d
    typedef std::type_info type_info_t;
Packit 58578d
private:
Packit 58578d
    const type_info_t* data_;
Packit 58578d
Packit 58578d
public:
Packit 58578d
    stl_type_index(const type_info_t& data) noexcept
Packit 58578d
        : data_(&data)
Packit 58578d
    {}
Packit 58578d
// ...
Packit 58578d
};
Packit 58578d
</programlisting></para><para>
Packit 58578d
<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>
Packit 58578d
<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>
Packit 58578d
</para></description><typedef name="type_info_t"><type>TypeInfo</type></typedef>
Packit 58578d
<method-group name="public member functions">
Packit 58578d
<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. 
Packit 58578d
</para></description><returns><para>Name of a type. By default returns Derived::raw_name(). </para></returns></method>
Packit 58578d
<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. 
Packit 58578d
</para></description><returns><para>Human readable type name. By default returns Derived::name(). </para></returns></method>
Packit 58578d
<method name="equal" cv="const noexcept"><type>bool</type><parameter name="rhs"><paramtype>const Derived &</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. 
Packit 58578d
</para></description><returns><para>True if two types are equal. By default compares types by raw_name(). </para></returns></method>
Packit 58578d
<method name="before" cv="const noexcept"><type>bool</type><parameter name="rhs"><paramtype>const Derived &</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. 
Packit 58578d
</para></description><returns><para>True if rhs is greater than this. By default compares types by raw_name(). </para></returns></method>
Packit 58578d
<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. 
Packit 58578d
<note><para>Derived class header <emphasis role="bold">must</emphasis> include <boost/functional/hash.hpp>, <emphasis role="bold">unless</emphasis> this function is redefined in Derived class to not use boost::hash_range(). </para></note>
Packit 58578d
</para></description><returns><para>Hash code of a type. By default hashes types by raw_name(). </para></returns></method>
Packit 58578d
</method-group>
Packit 58578d
<method-group name="protected member functions">
Packit 58578d
<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. 
Packit 58578d
</para></description><returns><para>Pointer to unredable/raw type name. </para></returns></method>
Packit 58578d
<method name="type_info" cv="const noexcept"><type>const type_info_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. 
Packit 58578d
</para></description><returns><para>Const reference to underlying low level type_info_t. </para></returns></method>
Packit 58578d
</method-group>
Packit 58578d
<method-group name="protected static functions">
Packit 58578d
<method name="type_id" cv="noexcept" specifiers="static"><type>Derived</type><template>
Packit 58578d
          <template-type-parameter name="T"><purpose><para>Type for which type_index must be created. </para></purpose></template-type-parameter>
Packit 58578d
        </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 && and & modifiers from T. 
Packit 58578d
Packit 58578d
</para></description><returns><para>type_index for type T. </para></returns></method>
Packit 58578d
<method name="type_id_with_cvr" cv="noexcept" specifiers="static"><type>Derived</type><template>
Packit 58578d
          <template-type-parameter name="T"><purpose><para>Type for which type_index must be created. </para></purpose></template-type-parameter>
Packit 58578d
        </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 && and & modifiers from T. 
Packit 58578d
Packit 58578d
</para></description><returns><para>type_index for type T. </para></returns></method>
Packit 58578d
<method name="type_id_runtime" cv="noexcept" specifiers="static"><type>Derived</type><template>
Packit 58578d
          <template-type-parameter name="T"/>
Packit 58578d
        </template><parameter name="variable"><paramtype>const T &</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&) 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. 
Packit 58578d
Packit 58578d
</para></description><returns><para>type_index with runtime type of variable. </para></returns></method>
Packit 58578d
</method-group>
Packit 58578d
</class>
Packit 58578d
Packit 58578d
Packit 58578d
<function name="operator==,!=,<,..."><type>bool</type><parameter name="lhs"><paramtype>const <classname>type_index_facade</classname> &</paramtype></parameter><parameter name="rhs"><paramtype>const <classname>type_index_facade</classname> &</paramtype></parameter><purpose>noexcept comparison operators for <classname alt="boost::typeindex::type_index_facade">type_index_facade</classname> classes. </purpose></function>
Packit 58578d
<function name="operator==,!=,<,..."><type>bool</type><parameter name="lhs"><paramtype>const <classname>type_index_facade</classname> &</paramtype></parameter><parameter name="rhs"><paramtype>const TypeInfo &</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>
Packit 58578d
<function name="operator==,!=,<,..."><type>bool</type><parameter name="lhs"><paramtype>const TypeInfo &</paramtype></parameter><parameter name="rhs"><paramtype>const <classname>type_index_facade</classname> &</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>
Packit 58578d
<function name="operator<<"><type>std::basic_ostream< CharT, TriatT > &</type><template>
Packit 58578d
          <template-type-parameter name="CharT"/>
Packit 58578d
          <template-type-parameter name="TriatT"/>
Packit 58578d
          <template-type-parameter name="Derived"/>
Packit 58578d
          <template-type-parameter name="TypeInfo"/>
Packit 58578d
        </template><parameter name="ostr"><paramtype>std::basic_ostream< CharT, TriatT > &</paramtype></parameter><parameter name="ind"><paramtype>const <classname>type_index_facade</classname>< Derived, TypeInfo > &</paramtype></parameter><purpose>Ostream operator that will output demangled name. </purpose></function>
Packit 58578d
<function name="hash_value"><type>std::size_t</type><template>
Packit 58578d
          <template-type-parameter name="Derived"/>
Packit 58578d
          <template-type-parameter name="TypeInfo"/>
Packit 58578d
        </template><parameter name="lhs"><paramtype>const <classname>type_index_facade</classname>< Derived, TypeInfo > &</paramtype></parameter><description><para>This free function is used by Boost's unordered containers. <note><para><boost/functional/hash.hpp> has to be included if this function is used. </para></note>
Packit 58578d
</para></description></function>
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
Packit 58578d
</namespace>
Packit 58578d
<function name="hash_range"><type>std::size_t</type><template>
Packit 58578d
          <template-type-parameter name="It"/>
Packit 58578d
        </template><parameter name=""><paramtype>It</paramtype></parameter><parameter name=""><paramtype>It</paramtype></parameter></function>
Packit 58578d
</namespace>
Packit 58578d
</header>
Packit 58578d
</library-reference>