How to store TypeInfo

c++

Solution

You cannot instantiate objects of the type_info class directly, because the class has only a private copy constructor. Since the list needs copy constructor...

If you really need it, use std::list< type_info*>.

I don't know why you need this list, but I would think to an alternative design, not involving RTTI, if possible.

Problem

``` class A {} A a; type_info info = typeid (a); // error type_info is private ``` i want a list `list<type_info>` to store the type of classes. Is there a solution?

Original source

Related problems