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 >
26 store( static_cast< UnderlyingType >( flag ) )
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 );
89 #endif // WIBBLE_STRONGENUMFLAG_H friend constexpr This operator &(This a, This b) noexcept
Definition: strongenumflags.h:48
This & operator &=(This o) noexcept
Definition: strongenumflags.h:39
friend constexpr This operator|(This a, This b) noexcept
Definition: strongenumflags.h:44
std::integral_constant< bool, std::is_enum< E >::value &&!std::is_convertible< E, int >::value > is_enum_class
Definition: strongenumflags.h:16
constexpr bool has(Self x) const noexcept
Definition: strongenumflags.h:60
Definition: strongenumflags.h:19
This & operator|=(This o) noexcept
Definition: strongenumflags.h:34
friend constexpr bool operator!=(This a, This b) noexcept
Definition: strongenumflags.h:56
StrongEnumFlags< Self > This
Definition: strongenumflags.h:21
constexpr StrongEnumFlags(UnderlyingType st) noexcept
Definition: strongenumflags.h:28
constexpr StrongEnumFlags(Self flag) noexcept
Definition: strongenumflags.h:25
friend constexpr bool operator==(This a, This b) noexcept
Definition: strongenumflags.h:52
typename std::underlying_type< ProtectMode >::type UnderlyingType
Definition: strongenumflags.h:22
constexpr StrongEnumFlags() noexcept
Definition: strongenumflags.h:24