By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,918 Members | 2,246 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,918 IT Pros & Developers. It's quick & easy.

Constructing a Class Given a String

P: n/a
I was just about to make the proclamation that the standard C++'s rtti
can't quite do all the stuff that .NET reflection can do, but I
thought I would check. Perhaps my C++ knowledge is not quite up to
date!

Does the latest go around of C++ envision richer run time type
information similar to that offered by Delphi or .NET?

I know that rtti lets me get a typeinfo with the string name of the
class in it, but I can't see a way to get a class given a string name?
Am I still stuck in switch land and factory patterns for this?

Similarly, I would like to go back and forth between enumerations and
strings.

Also, does anyone know if GNU offers "language extensions" to do this
exact thing?

Thanks!
Jul 22 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Todd Bandrowsky wrote:
I was just about to make the proclamation that the standard C++'s rtti
can't quite do all the stuff that .NET reflection can do, but I
thought I would check. Perhaps my C++ knowledge is not quite up to
date!
I can say the same about my knowledge of .NET reflection.
Does the latest go around of C++ envision richer run time type
information similar to that offered by Delphi or .NET?
I've not heard of anythink like that, besides, I've not seen the need.
I know that rtti lets me get a typeinfo with the string name of the
class in it, but I can't see a way to get a class given a string name?
RTTI-returned string is (a) implementation-specific and (b) not guaranteed
to have any meaningful content. And, no, there is no mechanism in the
language to identify types by name during run-time. Generally, one can
say that there are no types during run-time.
Am I still stuck in switch land and factory patterns for this?
Yes, you probably are. If you really need that thing, that is.
Similarly, I would like to go back and forth between enumerations and
strings.
Similarly, there is no language mechanism to do that. You need to provide
one if you need it.
Also, does anyone know if GNU offers "language extensions" to do this
exact thing?


Ask in a GNU newsgroup.

Victor
Jul 22 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.