Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.

Boost.TypeIndex Header Reference

Header <boost/type_index.hpp>
Header <boost/type_index/ctti_type_index.hpp>
Header <boost/type_index/stl_type_index.hpp>
Header <boost/type_index/type_index_facade.hpp>

Includes minimal set of headers required to use the Boost.TypeIndex library.

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.

namespace boost {
  namespace typeindex {
    typedef platform_specific type_index;
    typedef type_index::type_info_t type_info;
    template<typename T> type_index type_id();
    template<typename T> type_index type_id_with_cvr();
    template<typename T> type_index type_id_runtime(const T &);

Contains boost::typeindex::ctti_type_index class.

boost::typeindex::ctti_type_index class can be used as a drop-in replacement for std::type_index.

It is used in situations when typeid() method is not available or BOOST_TYPE_INDEX_FORCE_NO_RTTI_COMPATIBILITY macro is defined.

namespace boost {
  namespace typeindex {
    class ctti_type_index;

    // Helper method for getting detail::ctti_data of a template parameter T. 
    template<typename T> unspecified ctti_construct();

Contains boost::typeindex::stl_type_index class.

boost::typeindex::stl_type_index class can be used as a drop-in replacement for std::type_index.

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 boost::typeindex::stl_type_index.

namespace boost {
  namespace typeindex {
    class stl_type_index;
namespace boost {
  template<typename It> std::size_t hash_range(It, It);
  namespace typeindex {
    template<typename Derived, typename TypeInfo> class type_index_facade;
    bool operator==,!=,<,...(const type_index_facade &, 
                             const type_index_facade &);

    // noexcept comparison operators for type_index_facade and it's TypeInfo classes. 
    bool operator==,!=,<,...(const type_index_facade & lhs, 
                             const TypeInfo & rhs);

    // noexcept comparison operators for type_index_facade's TypeInfo and type_index_facade classes. 
    bool operator==,!=,<,...(const TypeInfo & lhs, 
                             const type_index_facade & rhs);

    // Ostream operator that will output demangled name. 
    template<typename CharT, typename TriatT, typename Derived, 
             typename TypeInfo> 
      std::basic_ostream< CharT, TriatT > & 
      operator<<(std::basic_ostream< CharT, TriatT > & ostr, 
                 const type_index_facade< Derived, TypeInfo > & ind);
    template<typename Derived, typename TypeInfo> 
      std::size_t hash_value(const type_index_facade< Derived, TypeInfo > &);