Premise:
I have a variadic template function that accepts PODs (plain-old data structure) with homogeneous member types.
An acceptable POD may be composed entirely of 4-byte integers XOR 4-byte floats.
Internally, the variadic parameter is coerced to a pointer of the underlying type and utilized as a primitive array.
Problem:
Currently, the template function requires the user to provide some additional information about the formatting of these PODs; such as in the following:
Declaration
template<typename ...U>
void foo(const char *format, U... bars);
Usage
Blah much, wow; // Underlying type is integral.
Bleh such, params; // underlying type is float.
//...
foo("iffi",much,params,such,wow);
It works, but I would like to bypass the formatting string.
Question:
Is there a way to evaluate the underlying type at compile-time?
Edit: The layout of the structure and the names of its members are not known until compile-time. That is, the user of the library is providing an arbitrary homogeneous POD.