displaying any struct

U

Ufit

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
 
P

Phlip

Ufit said:
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.
 
P

Phlip

Ufit said:
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.
 
J

Jim Langston

Ufit said:
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" );
/* ... */
}
 

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

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top