Reflection in C++

S

sujit

Hi All,

I have query regarding "C++ and Reflection". I could not get sufficient
information from net on this topic.

Does C++ support reflection or any features similar to some other
languages like Java?

As far as I understand C++ does support a feature on RTTI. At lest I
have not used it for anything more than simple object identidy
verification. Can it be classified as a sort of relection or rather can
this RTTI feature be used for any other purpose?

Finally in languages like Java reflection is widely used and is
considered as a useful feature. Are there any efforts going on to make
available true reflection features in C++ too.


Thanks
Sujit
 
?

=?ISO-8859-1?Q?Stefan_N=E4we?=

sujit said:
Hi All,

I have query regarding "C++ and Reflection". I could not get sufficient
information from net on this topic.

Does C++ support reflection or any features similar to some other
languages like Java?

As far as I understand C++ does support a feature on RTTI. At lest I
have not used it for anything more than simple object identidy
verification. Can it be classified as a sort of relection or rather can
this RTTI feature be used for any other purpose?

Finally in languages like Java reflection is widely used and is
considered as a useful feature. Are there any efforts going on to make
available true reflection features in C++ too.

If I google for "c++ reflection" the two top-most links I get seem to give a good
starter:

http://www.vollmann.com/en/pubs/meta/meta/meta.html
http://www.garret.ru/~knizhnik/cppreflection/docs/reflect.html

And no, the C++ language does not support reflection.


Stefan
 
?

=?ISO-8859-15?Q?Juli=E1n?= Albo

sujit said:
As far as I understand C++ does support a feature on RTTI. At lest I
have not used it for anything more than simple object identidy
verification. Can it be classified as a sort of relection or rather can
this RTTI feature be used for any other purpose?

Anything can be classified as a "sort of" any other thing.
 
Z

Zara

Hi All,

I have query regarding "C++ and Reflection". I could not get sufficient
information from net on this topic.

Does C++ support reflection or any features similar to some other
languages like Java?

As far as I understand C++ does support a feature on RTTI. At lest I
have not used it for anything more than simple object identidy
verification. Can it be classified as a sort of relection or rather can
this RTTI feature be used for any other purpose?

Finally in languages like Java reflection is widely used and is
considered as a useful feature. Are there any efforts going on to make
available true reflection features in C++ too.


Thanks
Sujit

No, C++ does not have a reflection usable as Java reflection is. And I
do like it so, I think Java reflection is a magnificient way of
trashing all safety, abstraction and type checking.

I have always felt the Java reflection is overused and abused.
 
B

Branimir Maksimovic

sujit said:
Hi All,

I have query regarding "C++ and Reflection". I could not get sufficient
information from net on this topic.

Does C++ support reflection or any features similar to some other
languages like Java?

No. C++ supports pointers to functions instead.
Finally in languages like Java reflection is widely used and is
considered as a useful feature. Are there any efforts going on to make
available true reflection features in C++ too.

Why do you need reflection when you have pointers to functions?

Greetings, Bane.
 
D

Dave Rahardja

Finally in languages like Java reflection is widely used and is
considered as a useful feature. Are there any efforts going on to make
available true reflection features in C++ too.

I've always wondered what one can use Java reflection for that cannot be just
as easily, more safely, and more economically done through other means. Can
you shed some light on this?

-dr
 
A

Alf P. Steinbach

* Dave Rahardja:
I've always wondered what one can use Java reflection for that cannot be just
as easily, more safely, and more economically done through other means. Can
you shed some light on this?

Component technologies for languages with reflection are relatively clean;
corresponding technologies for C++ are unclean, to put it mildly.
 
D

Dave Rahardja

Component technologies for languages with reflection are relatively clean;
corresponding technologies for C++ are unclean, to put it mildly.

What's it used for?

-dr
 

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

Forum statistics

Threads
474,150
Messages
2,570,853
Members
47,393
Latest member
silloma

Latest Threads

Top