| Home | Libraries | People | FAQ | More

## Chapter 34. Boost.TypeIndex 4.0

Copyright © 2012-2014 Antony Polukhin

Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

## Motivation

Sometimes getting and storing information about a type at runtime is required. For such cases a construction like `&typeid(T)` or C++11 class `std::type_index` is usually used, which is where problems start:

- `typeid(T)` and `std::type_index` require Run Time Type Info (RTTI)
- some implementations of `typeid(T)` erroneously do not strip const, volatile and references from type
- some compilers have bugs and do not correctly compare `std::type_info` objects across shared libraries
- only a few implementations of Standard Library currently provide `std::type_index`
- no easy way to store type info without stripping const, volatile and references
- no nice and portable way to get human readable type names
- no way to easily make your own type info class

Boost.TypeIndex library was designed to work around all those issues.

| Note
`T` means type here. Think of it as of `T` in `template <class T>`

Last revised: April 07, 2015 at 22:51:19 GMT |