diff --git a/src/flags.hh b/src/flags.hh index 10e05187..2b68751b 100644 --- a/src/flags.hh +++ b/src/flags.hh @@ -28,10 +28,18 @@ Flags& operator|=(Flags& lhs, Flags rhs) return lhs; } -template> -constexpr bool operator&(Flags lhs, Flags rhs) +template +struct TestableFlags { - return ((UnderlyingType) lhs & (UnderlyingType) rhs) == (UnderlyingType)rhs; + Flags value; + constexpr operator bool() const { return (UnderlyingType)value; } + constexpr operator Flags() const { return value; } +}; + +template> +constexpr TestableFlags operator&(Flags lhs, Flags rhs) +{ + return { (Flags)((UnderlyingType) lhs & (UnderlyingType) rhs) }; } template>