Capturing a type_info Object

Capturing a type_info Object

The operator typeid returns a const type_info object associated with its argument. However, the returned object is a temporary one, so if you have to call several member functions from it, you will have to use the typeid expression repeatedly–a tedious and costly operation:

 cout<

Note that you cannot copy-construct or assign the returned type_info object either:

 type_info ti = typeid(myObj); //compilation error; copy constructor and operator= are private 

As a workaround, you can initialize a reference or a pointer with the temporary object.

 type_info *pti = & typeid (myObj) ;  // OK, a pointer with the address of the returned objectcout << pti->name()  << endl;cout << pti->raw_name() << endl; 
Share the Post:
data observability

Data Observability Explained

Data is the lifeblood of any successful business, as it is the driving force behind critical decision-making, insight generation, and strategic development. However, due to its intricate nature, ensuring the

Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular