Get attribute by name

后端 未结 5 2016
野的像风
野的像风 2020-11-30 13:15

I have a struct definition with about 25 elements

struct X { field 1; field 2; .. };    

and I\'m trying to fill it with some map values <

5条回答
  •  不知归路
    2020-11-30 13:35

    Short answer: no. This is C++, a statically compiled language, where the structure member names are converted by the compiler into memory offsets. It is not dynamic like PHP or Python where the runtime is involved with all variable references.

提交回复
热议问题