In this code below, is the conversion in function fn
guaranteed to get the u64
value back, for all possible u64
values? The use for this conversion from int->enum and back is to trigger overload resolution to choose a particular int function.
using u64 = unsigned long; // 64bits
enum class EnumT : u64 {};
void Fn(u64 v) {/*...*/}
void Fn(EnumT e) {
u64 v = u64(e);
// ...
}
int main() {
u64 e = 1337;
Fn(EnumT(e));
return 0;
}