| Home | Libraries | People | FAQ | More

## 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.

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

Parameters:

`runtime_val` | Varaible which runtime type must be returned.

Returns: | boost::typeindex::type_index with information about the specified variable.
Throws: | Nothing.