added !operator for enum classes

This commit is contained in:
Andrei Yankovich 2020-11-14 00:56:58 +03:00
parent ffc95d077b
commit e634961b4a

View File

@ -74,6 +74,17 @@ constexpr inline T operator ^ (T lhs, T rhs)
return static_cast<T>(static_cast<int>(lhs) ^ static_cast<int>(rhs)); return static_cast<T>(static_cast<int>(lhs) ^ static_cast<int>(rhs));
} }
template <typename T>
constexpr inline bool operator ! (T lhs)
{
static_assert(std::is_enum<T>::value,
"template parameter is not an enum type");
return !static_cast<bool>(lhs);
}
// TO DO need to testing. I am think this is does not work. // TO DO need to testing. I am think this is does not work.
//template <class IntegerType> //template <class IntegerType>
//constexpr IntegerType static_mul(const char* str, unsigned char depth, unsigned char index = 0) noexcept { //constexpr IntegerType static_mul(const char* str, unsigned char depth, unsigned char index = 0) noexcept {