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

displaying any struct

P: n/a
Is there a function in vc++ that would allow to list as strings all the
contents and names of struct members? A treeview would be
the best for listing. Thanks for aid.

Uf
Apr 22 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Ufit wrote:
Is there a function in vc++ that would allow to list as strings all the
contents and names of struct members? A treeview would be
the best for listing. Thanks for aid.


If you ask a newsgroup that covers VC++

There is no portable way to do that in the raw C++ language itself. It's
called reflection, but you should announce what real problem you are trying
to solve first. There are portable ways to simulate reflection in C++. And
maybe your problem has some other solution.

--
Phlip
http://www.greencheese.org/ZeekLand <-- NOT a blog!!!
Apr 22 '06 #2

P: n/a
> Ufit wrote:
Is there a function in vc++ that would allow to list as strings all the
contents and names of struct members? A treeview would be
the best for listing. Thanks for aid.
If you ask a newsgroup that covers VC++


....they might give me memory pills.

Also, they might point out a way to borrow your program's PDB file, run it
through their debugging system, and emit this data.

That would be a very small bang for a very huge buck.
There is no portable way to do that in the raw C++ language itself. It's
called reflection, but you should announce what real problem you are
trying to solve first. There are portable ways to simulate reflection in
C++. And maybe your problem has some other solution.

--
Phlip
http://www.greencheese.org/ZeekLand <-- NOT a blog!!!

Apr 22 '06 #3

P: n/a
"Ufit" <ko**************@NOpoczta.fm> wrote in message
news:e2**********@news.onet.pl...
Is there a function in vc++ that would allow to list as strings all the
contents and names of struct members? A treeview would be
the best for listing. Thanks for aid.


Normally that information is not available to a compiled C++ program. Your
compiler may create a file during the compilation process with that
information or you can tell your compiler to create one. That is, the names
of the structures. Perhaps with this information you can cross reference
something you can "see" about the instance with the compiler created file.

The other option is to code this information into the objects themselves.

class MyClass
{
public:
std::string ClassName;
MyClass(): ClassName( "MyClass" );
/* ... */
}
Apr 23 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.