Is there any known way to iterate through the element names of a structure at compile time to build a series of ?
I'd like to be able to "print" the entire structure to either a char or file stream like so,
myStruct.element1 => 'Value1'
element2 => 'Value2'
element3 => 'Value3'
Functionality similar to the PHP 'print_r' function.
I know that the names are not available at run time. I have built a macro that is close
#define __dump(a, x, y) fp_exception_log << "myStruct[" << x << "][" << y << "]." << #a << ": " << myStruct[x][y].a << std::endl
but I have to enter all the element names individually. (__dump(element1, 0, 0)... )If I could iterate through the struct to get the names, that would be great as the struct I am dealling with is quite long and subject to changes frequently.
Don't know if this can be done or not, just though I'd float it out there and see if any one has cracked this nut before.