Mattia
Mattia

Reputation: 2281

Can you look up a type using its typeinfo?

Say you have the type info for a class, is it possible to get that type using its typeinfo? Basically, if typeid maps a typeinfo to a type is it possible to do the reverse and map a type to a typeinfo?

(I doubt there is but since C++ never ceases to surprise me both pleasantly and unpleasantly I thought I'd ask)

Upvotes: 0

Views: 342

Answers (2)

Vladimir Fedosov
Vladimir Fedosov

Reputation: 102

Type in c++ is compile time information only. typeinfo is runtime information. What could you do with type in runtime? Nothing.

Upvotes: 0

Edward Strange
Edward Strange

Reputation: 40897

No. It is not possible. That is all.

Upvotes: 1

Related Questions