Enumerate members of a structure?

前端 未结 6 895
渐次进展
渐次进展 2021-01-13 10:02

Is there a way to enumerate the members of a structure (struct | class) in C++ or C? I need to get the member name, type, and value. I\'ve used the following sample code b

6条回答
  •  情话喂你
    2021-01-13 10:17

    simplest way - switch to Objective-C OR Objective-C++. That languages have good introspection and are full-compatible with C/C++ sources.

    also You can use m4/cog/... for simultaneous generation structure and his description from some meta-description.

提交回复
热议问题