0

I know it is possible to check whether a specific data member exists, but is it also possible to enumerate them all?

EDIT: I want to enumerate them in code, compile time is ok.

NFRCR
  • 5,304
  • 6
  • 32
  • 37
  • In what context? The compiler will know, and debug symbols will contain that sort of information. But you probably can't access either in your source code... – Mats Petersson Sep 14 '14 at 17:07
  • what do you mean when you say "enumerate"? Do you want to be able to process it one after another, like in array, even if they have different types? – GingerPlusPlus Sep 14 '14 at 17:14
  • 1
    I've lost count of the number of times this has been asked. Do you not _search_? – Lightness Races in Orbit Sep 14 '14 at 17:15
  • Have a look here: http://stackoverflow.com/questions/4167030/get-list-of-available-data-member-from-a-pod-struct-in-c?rq=1 – Christophe Sep 14 '14 at 17:35
  • The subject you are talking about is "reflection". The C++ language does not offer *reflection*, but you may come up with your own design. In any case, search the web for "stackoverflow c++ reflection" – Thomas Matthews Sep 14 '14 at 18:33

0 Answers0