I need to do a mapping between two sets of enums. The correspondence between enums is one to one.
For example
The first set:
Enum1{A, B, C, D};
Enumx...
Enumy...
The second set:
Enum2{A2, B2, C2, D2};
Enumx2...
Enumy2...
The map function:
Enum1 map(Enum2);
Enumx map(Enumx2);
Enumy map(Enumy2);
I'm searching for an elegant manner of doing this map. Can I use template specialization? or the enums are seen all as integers?
Example:
class MapHelper{
public:
template<typename From, To>
static To map(From from);
template<>
static Enum1 map<Enum2, Enum1>(Enum2 from){
return static_cast<Enum1>(from);
}
};