I would like to know how to write a C++ function to print the attributes of a generic struct. For example,
struct a {
std::string field_1;
std::string field_2;
std::string field_3;
};
struct b {
int a;
int b;
int c;
};
The function would take struct of form 'a' or 'b'as inputs and generate outputs. Perhaps a template could be used -- if so how would one build it?