For a given struct e.g.
struct Foo {
int a;
std::string b;
};
std::string to_string(const Foo&);
I want to generate a body of to_string function. Is it possible to implement it with such interface? e.g.:
GENERATE_TO_STRING(Foo,a,b)
Assuming that every member has defined << operator for streams, or to_string function - doesn't really matter.
I'm asking specifically for a macro, because I can't make changes in the header file. So this is specific kind of "reflection".