22 Jul, 2009, Lobotomy wrote in the 1st comment:
Votes: 0
I'm in the middle of making the transition over to using C++ (from C) and I have the following question regarding typeid: Is there a way to store the type information returned as a type variable of some sort, or is copying the type name into a string the only way to retain the information for later use?
22 Jul, 2009, David Haley wrote in the 2nd comment:
Votes: 0
Yes, since you cannot copy the type_info structure, that's pretty much your only option. What is it that you are wanting to store for future use, and/or what future use are you planning? It might be impossible: C++ doesn't have nearly as much introspection as other languages; for instance if you wanted to create an object from its class name you'd have to implement the sequence of if statements and instantiations yourself.