I have an autogenerated structure type which is a container of various elements. Since the number of elements can vary (based on how the structure is generated), I would like to know (ideally in compilation time) the number of elements of currently generated structure.
Based on some input, the structure may look like this:
typedef struct _autoGenStruct {
int a,
int b,
int c
} autogenStruct
or like this:
typedef struct _autoGenStruct {
int a,
int b,
int c,
int d
} autoGenStruct
In the first case, I expect to get 3 elements, in the second 4. The element type is always integer. Is there a way how to do this in C/C++? Thanks.