How to get relative address of member of Class of Struct

How to get relative memory address of members of Class or Structure ??
I want to auto scan the members of Class/Struct, and show the address/value
like the "watch window" in debug mode of popular C/C++ IDE software.
C++ is not a reflective language yet, this is not possible. No information about the members of a structure or class is stored at runtime. Debuggers use debug information that is built into the program when building in debug mode - this has nothing to do with C++.
For standard-layout types, the offsetof() macro in <cstddef>
http://en.cppreference.com/w/cpp/types/offsetof

For non-standard-layout types, we have to resort to non-portable, implementation-specific techniques.

Topic archived. No new replies allowed.