Add True and False tests for bitwise enums

This commit is contained in:
Jack Andersen 2019-04-02 18:29:35 -10:00
parent 3a6ee9a70c
commit 630119350b
1 changed files with 8 additions and 0 deletions

View File

@ -60,6 +60,14 @@
constexpr type operator~(type key) { \
using T = std::underlying_type_t<type>; \
return type(~static_cast<T>(key)); \
} \
constexpr bool True(type key) { \
using T = std::underlying_type_t<type>; \
return static_cast<T>(key) != 0; \
} \
constexpr bool False(type key) { \
using T = std::underlying_type_t<type>; \
return static_cast<T>(key) == 0; \
}
#endif