Consider the following:
typedef struct {
int a;
int b;
int c;
int d;
} ABCD;
typedef std::vector VecABCD;
Say
Let's add one more option, unfortunately an ugly one. It's possible to take the relative address from start of the struct ABCD to it's member by offsetof -function. Deliver return value to function and it can do counting using relative location from the start of each struct. If your types may differ from int, you may want to deliver also the sizeof information.