This question has already been answered:
- Listing the structure fields 3 responses
I want to create a function that will run over all the fields of the class and set them to values, either 0 if the field is numeric, or an empty string, if the field is string.
Something like that func<Class>(obj);
Since all the classes are different and their fields are different, and in C ++ there is almost no runtime, then apparently this should be done at the compilation stage, apparently through templates.
Is it possible, or is the C ++ template engine not developed enough to do such things?
Maybe there is some kind of trick with macros?