...
This compliant solution checks that the value is within the range of acceptable enumeration values before can be represented by the enumeration type before performing the conversion to guarantee there is no unspecified result. It further restricts the conversion does not result in an unspecified value. It does this by restricting the converted value to one for which there is a specific enumerator value.
...
This compliant solution uses a scoped enumeration, which has a fixed underlying type of type int
by default, allowing any value from the parameter to be converted into a valid enumeration value. It does not further restrict the converted value to one for which there is a specific enumerator value, but it could do so by using the previous compliant solution.
...