mirror of
https://github.com/aantron/better-enums.git
synced 2025-12-06 16:56:42 +08:00
add comparison operators between ::_enumerated types & Enum types.
This commit is contained in:
parent
520d8ee390
commit
ad5ed9ba0b
36
enum.h
36
enum.h
@ -933,26 +933,62 @@ BETTER_ENUMS_IGNORE_ATTRIBUTES_BEGIN \
|
||||
BETTER_ENUMS_UNUSED BETTER_ENUMS_CONSTEXPR_ \
|
||||
inline bool operator ==(const Enum &a, const Enum &b) \
|
||||
{ return a._to_integral() == b._to_integral(); } \
|
||||
BETTER_ENUMS_UNUSED BETTER_ENUMS_CONSTEXPR_ \
|
||||
inline bool operator ==(const Enum::_enumerated &a, const Enum &b) \
|
||||
{ return a == b._to_integral(); } \
|
||||
BETTER_ENUMS_UNUSED BETTER_ENUMS_CONSTEXPR_ \
|
||||
inline bool operator ==(const Enum &a, const Enum::_enumerated &b) \
|
||||
{ return a._to_integral() == b; } \
|
||||
\
|
||||
BETTER_ENUMS_UNUSED BETTER_ENUMS_CONSTEXPR_ \
|
||||
inline bool operator !=(const Enum &a, const Enum &b) \
|
||||
{ return a._to_integral() != b._to_integral(); } \
|
||||
BETTER_ENUMS_UNUSED BETTER_ENUMS_CONSTEXPR_ \
|
||||
inline bool operator !=(const Enum::_enumerated &a, const Enum &b) \
|
||||
{ return a != b._to_integral(); } \
|
||||
BETTER_ENUMS_UNUSED BETTER_ENUMS_CONSTEXPR_ \
|
||||
inline bool operator !=(const Enum &a, const Enum::_enumerated &b) \
|
||||
{ return a._to_integral() != b; } \
|
||||
\
|
||||
BETTER_ENUMS_UNUSED BETTER_ENUMS_CONSTEXPR_ \
|
||||
inline bool operator <(const Enum &a, const Enum &b) \
|
||||
{ return a._to_integral() < b._to_integral(); } \
|
||||
BETTER_ENUMS_UNUSED BETTER_ENUMS_CONSTEXPR_ \
|
||||
inline bool operator <(const Enum::_enumerated &a, const Enum &b) \
|
||||
{ return a < b._to_integral(); } \
|
||||
BETTER_ENUMS_UNUSED BETTER_ENUMS_CONSTEXPR_ \
|
||||
inline bool operator <(const Enum &a, const Enum::_enumerated &b) \
|
||||
{ return a._to_integral() < b; } \
|
||||
\
|
||||
BETTER_ENUMS_UNUSED BETTER_ENUMS_CONSTEXPR_ \
|
||||
inline bool operator <=(const Enum &a, const Enum &b) \
|
||||
{ return a._to_integral() <= b._to_integral(); } \
|
||||
BETTER_ENUMS_UNUSED BETTER_ENUMS_CONSTEXPR_ \
|
||||
inline bool operator <=(const Enum::_enumerated &a, const Enum &b) \
|
||||
{ return a <= b._to_integral(); } \
|
||||
BETTER_ENUMS_UNUSED BETTER_ENUMS_CONSTEXPR_ \
|
||||
inline bool operator <=(const Enum &a, const Enum::_enumerated &b) \
|
||||
{ return a._to_integral() <= b; } \
|
||||
\
|
||||
BETTER_ENUMS_UNUSED BETTER_ENUMS_CONSTEXPR_ \
|
||||
inline bool operator >(const Enum &a, const Enum &b) \
|
||||
{ return a._to_integral() > b._to_integral(); } \
|
||||
BETTER_ENUMS_UNUSED BETTER_ENUMS_CONSTEXPR_ \
|
||||
inline bool operator >(const Enum::_enumerated &a, const Enum &b) \
|
||||
{ return a > b._to_integral(); } \
|
||||
BETTER_ENUMS_UNUSED BETTER_ENUMS_CONSTEXPR_ \
|
||||
inline bool operator >(const Enum &a, const Enum::_enumerated &b) \
|
||||
{ return a._to_integral() > b; } \
|
||||
\
|
||||
BETTER_ENUMS_UNUSED BETTER_ENUMS_CONSTEXPR_ \
|
||||
inline bool operator >=(const Enum &a, const Enum &b) \
|
||||
{ return a._to_integral() >= b._to_integral(); } \
|
||||
BETTER_ENUMS_UNUSED BETTER_ENUMS_CONSTEXPR_ \
|
||||
inline bool operator >=(const Enum::_enumerated &a, const Enum &b) \
|
||||
{ return a >= b._to_integral(); } \
|
||||
BETTER_ENUMS_UNUSED BETTER_ENUMS_CONSTEXPR_ \
|
||||
inline bool operator >=(const Enum &a, const Enum::_enumerated &b) \
|
||||
{ return a._to_integral() >= b; } \
|
||||
BETTER_ENUMS_IGNORE_ATTRIBUTES_END \
|
||||
\
|
||||
\
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user