Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is std::type_info noncopyable? Am I allowed to store it somewhere?

The std::type_info class is non-copyable. This makes it hard to store it in an object for later use. What should I do?

like image 387
StackedCrooked Avatar asked Mar 16 '11 19:03

StackedCrooked


People also ask

Where is Rtti stored?

RTTI for basic types such as int and bool is stored in the run-time library. Therefore, object files generated from a C++ program might reference RTTI defined in libc++abi.

What is std :: Type_info?

std::type_info The class type_info holds implementation-specific information about a type, including the name of the type and means to compare two types for equality or collating order. This is the class returned by the typeid operator.


1 Answers

There is a much better solution in C++11. A new copyable wrapper called std::type_index. You need to include header "typeindex" to use it.

like image 67
Silicomancer Avatar answered Nov 01 '22 03:11

Silicomancer