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 a snapshot of the master branch, built from commit b9ab49fc70.
PrevUpHomeNext

Function template type_id_runtime

boost::typeindex::type_id_runtime

Synopsis

// In header: <boost/type_index.hpp>


template<typename T> type_index type_id_runtime(const T & runtime_val);

Description

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

Returns 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;
type_index ti = type_id_runtime(b);
std::cout << ti.pretty_name();  // Outputs 'Derived'

Parameters:

runtime_val

Variable which runtime type must be returned.

Returns:

boost::typeindex::type_index with information about the specified variable.

Throws:

Nothing.

PrevUpHomeNext