lundi 15 octobre 2018

Generating a format string from a user defined class?

Is there any relatively simple way with template metaprogramming or similar to take a struct like:

struct data { 
     int32_t off;
     int16_t len;
     int8_t  bla;
};

and generate a format string from it?

Something like format<data>() == "OFF/SL LEN/SI BLA/SB"

That's not the actual format I need, but something of a simple textual nature would be good.

Aucun commentaire:

Enregistrer un commentaire