Boost C++ Libraries

...one 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.
PrevUpHomeNext

Boost.TypeIndex Header Reference

Header <boost/type_index.hpp>
Header <boost/type_index/ctti_type_index.hpp>
Header <boost/type_index/runtime_cast.hpp>
Header <boost/type_index/runtime_cast/boost_shared_ptr_cast.hpp>
Header <boost/type_index/runtime_cast/pointer_cast.hpp>
Header <boost/type_index/runtime_cast/reference_cast.hpp>
Header <boost/type_index/runtime_cast/register_runtime_class.hpp>
Header <boost/type_index/runtime_cast/std_shared_ptr_cast.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.


BOOST_TYPE_INDEX_REGISTER_CLASS
BOOST_TYPE_INDEX_FUNCTION_SIGNATURE
BOOST_TYPE_INDEX_CTTI_USER_DEFINED_PARSING
BOOST_TYPE_INDEX_USER_TYPEINDEX
BOOST_TYPE_INDEX_FORCE_NO_RTTI_COMPATIBILITY
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 that is constexpr if C++14 constexpr is supported by compiler.

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 the basic utilities necessary to fully emulate dynamic_cast for language level constructs (raw pointers and references).

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.

Contains the overload of boost::typeindex::runtime_pointer_cast for boost::shared_ptr types.

namespace boost {
  namespace typeindex {
    template<typename T, typename U> 
      boost::shared_ptr< T > 
      runtime_pointer_cast(boost::shared_ptr< U > const &);
  }
}
namespace boost {
  namespace typeindex {
    template<typename T, typename U> T runtime_cast(U *);
    template<typename T, typename U> T runtime_cast(U const *);
    template<typename T, typename U> T * runtime_pointer_cast(U *);
    template<typename T, typename U> T const * runtime_pointer_cast(U const *);
  }
}

Contains the overload of boost::typeindex::runtime_cast for reference types.

namespace boost {
  namespace typeindex {
    struct bad_runtime_cast;
    template<typename T, typename U> 
      boost::add_reference< T >::type runtime_cast(U &);
    template<typename T, typename U> 
      boost::add_reference< const T >::type runtime_cast(U const &);
  }
}

Contains the macros BOOST_TYPE_INDEX_IMPLEMENT_RUNTIME_CAST and BOOST_TYPE_INDEX_REGISTER_RUNTIME_CLASS.


BOOST_TYPE_INDEX_REGISTER_RUNTIME_CLASS(base_class_seq)
BOOST_TYPE_INDEX_IMPLEMENT_RUNTIME_CAST(base_class_seq)
BOOST_TYPE_INDEX_NO_BASE_CLASS

Contains the overload of boost::typeindex::runtime_pointer_cast for std::shared_ptr types.

namespace boost {
  namespace typeindex {
    template<typename T, typename U> 
      std::shared_ptr< T > runtime_pointer_cast(std::shared_ptr< U > const &);
  }
}

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;

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

    // 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 > &);
  }
}

PrevUpHomeNext