diff --git a/src/flags.hh b/src/flags.hh index a3cbc5e0..10e05187 100644 --- a/src/flags.hh +++ b/src/flags.hh @@ -10,7 +10,7 @@ template struct WithBitOps : std::false_type {}; template -using EnumStorageType = typename std::underlying_type::type; +using UnderlyingType = typename std::underlying_type::type; template using EnableIfWithBitOps = typename std::enable_if::value>::type; @@ -18,33 +18,33 @@ using EnableIfWithBitOps = typename std::enable_if::value>::ty template> constexpr Flags operator|(Flags lhs, Flags rhs) { - return (Flags)((EnumStorageType) lhs | (EnumStorageType) rhs); + return (Flags)((UnderlyingType) lhs | (UnderlyingType) rhs); } template> Flags& operator|=(Flags& lhs, Flags rhs) { - (EnumStorageType&) lhs |= (EnumStorageType) rhs; + (UnderlyingType&) lhs |= (UnderlyingType) rhs; return lhs; } template> constexpr bool operator&(Flags lhs, Flags rhs) { - return ((EnumStorageType) lhs & (EnumStorageType) rhs) != 0; + return ((UnderlyingType) lhs & (UnderlyingType) rhs) == (UnderlyingType)rhs; } template> Flags& operator&=(Flags& lhs, Flags rhs) { - (EnumStorageType&) lhs &= (EnumStorageType) rhs; + (UnderlyingType&) lhs &= (UnderlyingType) rhs; return lhs; } template> constexpr Flags operator~(Flags lhs) { - return (Flags)(~(EnumStorageType)lhs); + return (Flags)(~(UnderlyingType)lhs); } }