I think its possible to use Variadic template arguments introduced in C++11 for initializing a map which the keys are ints and values are string notation of given arguments.
If its possible i could simply create a map from Enum name to its string representation like this :
auto map = EnumStringMap<EnumType::Type1, EnumType::Type2>();
I can initialize a list with enum int representations via this template
template<typename... Ts> auto enumList(Ts... args){
QList<int> res = {args...};
return res;
}
auto enums = enumList<int, int>(Enums::Enum1, Enums::Enum2);
I think it should be possible with STRINGFY C macro to get string representation of expression
#define STRINGIFY(x) #x
#define TOSTRING(x) STRINGIFY(x)
But i can't figure out how to convert type name or type value to its string representation, so is it possible at all? My goal is to produce a map of which hold the string representation of enumrations in compile time.
The approaches like MOC used by qt isn't right for me, because i should enclose the enums in QObject which is heavy and non copyable.