...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::typeindex::type_id_runtime
// In header: <boost/type_index.hpp> template<typename T> type_index type_id_runtime(const T & runtime_val);
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: |
|
||
Returns: |
boost::typeindex::type_index with information about the specified variable. |
||
Throws: |
Nothing. |