Is it possible to iterate over all elements in a struct or class?

Viewed 575

Is it possible to iterate over all elements in a struct or class?

For example if I have a struct of three elements of different type:

struct A {
    classA a;
    classB b;
    classC c;
};

then I need some iterator such that a method next() would give me the value of the next element. The problem is that as you see, the values have different types.

3 Answers
Related