Boost  v1.57.0
doxygen for www.boost.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
boost::typeindex Namespace Reference

Namespaces

 detail
 

Classes

class  ctti_type_index
 This class is a wrapper that pretends to work exactly like stl_type_index, but does not require RTTI support. More...
 
class  stl_type_index
 This class is a wrapper around std::type_info, that workarounds issues and provides much more rich interface. More...
 
class  type_index_facade
 This class takes care about the comparison operators, hash functions and ostream operators. More...
 

Typedefs

typedef
boost::typeindex::stl_type_index 
type_index
 
typedef type_index::type_info_t type_info
 Depending on a compiler flags, optimal implementation of type_info will be used as a default boost::typeindex::type_info. More...
 

Functions

template<class T >
const detail::ctti_datactti_construct () BOOST_NOEXCEPT
 Helper method for getting detail::ctti_data of a template parameter T. More...
 
template<class CharT , class TriatT , class Derived , class TypeInfo >
std::basic_ostream< CharT,
TriatT > & 
operator<< (std::basic_ostream< CharT, TriatT > &ostr, const type_index_facade< Derived, TypeInfo > &ind)
 Ostream operator that will output demangled name. More...
 
template<class Derived , class TypeInfo >
std::size_t hash_value (const type_index_facade< Derived, TypeInfo > &lhs) BOOST_NOEXCEPT
 This free function is used by Boost's unordered containers. More...
 
template<class T >
type_index type_id () BOOST_NOEXCEPT
 Function to get boost::typeindex::type_index for a type T. More...
 
template<class T >
type_index type_id_with_cvr () BOOST_NOEXCEPT
 Function for constructing boost::typeindex::type_index instance for type T. More...
 
template<class T >
type_index type_id_runtime (const T &runtime_val) BOOST_NOEXCEPT
 Function that works exactly like C++ typeid(rtti_val) call, but returns boost::type_index. More...
 

Typedef Documentation

Depending on a compiler flags, optimal implementation of type_info will be used as a default boost::typeindex::type_info.

Could be a std::type_info, boost::typeindex::detail::ctti_data or some user defined class.

type_info is not copyable or default constructible. It is not assignable too!

Function Documentation

template<class T >
const detail::ctti_data& boost::typeindex::ctti_construct ( )
inline

Helper method for getting detail::ctti_data of a template parameter T.

References n.

template<class Derived , class TypeInfo >
std::size_t boost::typeindex::hash_value ( const type_index_facade< Derived, TypeInfo > &  lhs)
inline

This free function is used by Boost's unordered containers.

Note
<boost/functional/hash.hpp> has to be included if this function is used.

References boost::detail::const.

template<class CharT , class TriatT , class Derived , class TypeInfo >
std::basic_ostream<CharT, TriatT>& boost::typeindex::operator<< ( std::basic_ostream< CharT, TriatT > &  ostr,
const type_index_facade< Derived, TypeInfo > &  ind 
)
inline

Ostream operator that will output demangled name.

template<class T >
type_index boost::typeindex::type_id ( )
inline

Function to get boost::typeindex::type_index for a type T.

Removes const, volatile && and & modifiers from T.

Example:

type_index ti = type_id<int&>();
std::cout << ti.pretty_name(); // Outputs 'int'
Template Parameters
TType for which type_index must be created.
Exceptions
Nothing.
Returns
boost::typeindex::type_index with information about the specified type T.
template<class T >
type_index boost::typeindex::type_id_runtime ( const T runtime_val)
inline

Function that works exactly like C++ typeid(rtti_val) call, but returns boost::type_index.

Retunrs runtime information about specified type.

Requirements: RTTI available or Base and Derived classes must be marked with BOOST_TYPE_INDEX_REGISTER_CLASS.

Example:

struct Base { virtual ~Base(){} };
struct Derived: public Base {};
...
Derived d;
Base& b = d;
std::cout << ti.pretty_name(); // Outputs 'Derived'
Parameters
runtime_valVaraible which runtime type must be returned.
Exceptions
Nothing.
Returns
boost::typeindex::type_index with information about the specified variable.

References boost::typeindex::stl_type_index::type_id_runtime().

template<class T >
type_index boost::typeindex::type_id_with_cvr ( )
inline

Function for constructing boost::typeindex::type_index instance for type T.

Does not remove const, volatile, & and && modifiers from T.

If T has no const, volatile, & and && modifiers, then returns exactly the same result as in case of calling type_id<T>().

Example:

type_index ti = type_id_with_cvr<int&>();
std::cout << ti.pretty_name(); // Outputs 'int&'
Template Parameters
TType for which type_index must be created.
Exceptions
Nothing.
Returns
boost::typeindex::type_index with information about the specified type T.