I have an idea of mapping enum values to corresponding data types, at compile time with templates. How can i do this?
e.g.
enum DataType {
UNSINGED_INT; // uint32_t
INT; // int32_t
UNSIGNED_CHAR; // uint8_t
CHAR; // int8_t
}
auto type = MapToDataType<DataType::UNSIGNED_CHAR>; // type will be uint8_t in this case
Aucun commentaire:
Enregistrer un commentaire