I have a template function that operates on a generic type T
as input. I statically assert that T
is an enum.
However, I want to constrain it further so that C-style enums (i.e. without explicit underlying type) cannot be passed. Otherwise UB could occur due to casting ints outside of the range of the enum to said enum in the implementation.
Is it possible to achieve this? If so, how?
6