3 #if __cplusplus < 201103L
4 #error "strongenumflag is only supported with c++11 or newer"
9 #ifndef WIBBLE_STRONGENUMFLAG_H
10 #define WIBBLE_STRONGENUMFLAG_H
14 template<
typename E >
16 std::is_enum< E >::value && !std::is_convertible< E, int >::value >;
18 template<
typename Self >
45 return This( a.store | b.store );
49 return This( a.store & b.store );
53 return a.store == b.store;
57 return a.store != b.store;
60 constexpr
bool has( Self x )
const noexcept {
64 constexpr
operator bool() const noexcept {
73 template<
typename Self,
typename =
typename
74 std::enable_if< is_enum_class< Self >::value >::type >
77 return Ret( a ) | Ret( b );
80 template<
typename Self,
typename =
typename
81 std::enable_if< is_enum_class< Self >::value >::type >
84 return Ret( a ) & Ret( b );
std::integral_constant< bool, std::is_enum< E >::value &&!std::is_convertible< E, int >::value > is_enum_class
Definition: strongenumflags.h:16
constexpr StrongEnumFlags< Self > operator&(Self a, Self b) noexcept
Definition: strongenumflags.h:82
constexpr StrongEnumFlags< Self > operator|(Self a, Self b) noexcept
Definition: strongenumflags.h:75
Definition: strongenumflags.h:19
constexpr friend This operator&(This a, This b) noexcept
Definition: strongenumflags.h:48
constexpr StrongEnumFlags() noexcept
Definition: strongenumflags.h:24
This & operator|=(This o) noexcept
Definition: strongenumflags.h:34
constexpr StrongEnumFlags(Self flag) noexcept
Definition: strongenumflags.h:25
constexpr friend bool operator==(This a, This b) noexcept
Definition: strongenumflags.h:52
This & operator&=(This o) noexcept
Definition: strongenumflags.h:39
typename std::underlying_type< Self >::type UnderlyingType
Definition: strongenumflags.h:22
constexpr StrongEnumFlags(UnderlyingType st) noexcept
Definition: strongenumflags.h:28
StrongEnumFlags< Self > This
Definition: strongenumflags.h:21
constexpr friend bool operator!=(This a, This b) noexcept
Definition: strongenumflags.h:56
constexpr friend This operator|(This a, This b) noexcept
Definition: strongenumflags.h:44
constexpr bool has(Self x) const noexcept
Definition: strongenumflags.h:60