typeid

M

moleskyca1

If I use RTTI, will every class have a typeid info? I am confused. When
does compiler generate this info? Is it at run-time or at compile time?


What if I have a template class, or the STL classes, will they also
have typeid info?
 
A

Alf P. Steinbach

* (e-mail address removed):
If I use RTTI, will every class have a typeid info?

Not necessarily, and doesn't necessarily depend on whether you use RTTI
or not.

I am confused. When
does compiler generate this info? Is it at run-time or at compile time?

The RTTI information itself is generated at compile time. The
association from object to RTTI information is necessarily generated at
run-time.

What if I have a template class, or the STL classes, will they also
have typeid info?

All classes support typeid. For actual run-time determination of type
the statically known class for an object must have at least one virtual
member function.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,263
Messages
2,571,062
Members
48,769
Latest member
Clifft

Latest Threads

Top