9 template <
typename TDerived,
typename TBase>
11 static constexpr
bool value =
false;
14 #define SPH_EXTEND_ENUM(TDerived, TBase) \
16 struct IsExtended<TDerived, TBase> { \
17 static constexpr bool value = true; \
23 template <
typename TBase>
26 using TValue = std::underlying_type_t<TBase>;
36 : value(TValue(value)) {}
39 template <typename TDerived, typename = std::enable_if_t<IsExtended<TDerived, TBase>::value>>
41 : value(TValue(value)) {}
44 operator TBase()
const {
49 template <typename TDerived, typename = std::enable_if_t<IsExtended<TDerived, TBase>::value>>
50 explicit operator TDerived()
const {
51 return TDerived(value);
55 return value < other.value;
59 return value == other.value;
63 return TBase(value) == other;
66 template <typename TDerived, typename = std::enable_if_t<IsExtended<TDerived, TBase>::value>>
68 return TDerived(value) == other;
72 return value != other.value;
78 static constexpr
bool value =
false;
81 template <
typename TEnum>
83 static constexpr
bool value =
true;
#define NAMESPACE_SPH_END
Few non-standard type traits.
Helper type allowing to "derive" from enum class.
ExtendedEnum(const TBase value)
Implicit constructor from base.
bool operator==(const TDerived &other) const
bool operator<(const ExtendedEnum &other) const
bool operator==(const ExtendedEnum &other) const
bool operator!=(const ExtendedEnum &other) const
ExtendedEnum(const TDerived value)
Implicit constructor from derived.
bool operator==(const TBase &other) const
static constexpr bool value
static constexpr bool value