diff options
Diffstat (limited to 'pjlib/include/pj++/types.hpp')
-rw-r--r-- | pjlib/include/pj++/types.hpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/pjlib/include/pj++/types.hpp b/pjlib/include/pj++/types.hpp index e0c2e230..7e165a53 100644 --- a/pjlib/include/pj++/types.hpp +++ b/pjlib/include/pj++/types.hpp @@ -156,5 +156,19 @@ private: }; +// +// Macro to declare common object comparison operators. +// +#define PJ_DECLARE_OPERATORS(rhs_type) \ + bool operator!=(rhs_type rhs) const { \ + return !operator==(rhs); } \ + bool operator<=(rhs_type rhs) const { \ + return operator<(rhs) || operator==(rhs); } \ + bool operator>(rhs_type rhs) const { \ + return !operator<=(rhs); } \ + bool operator>=(rhs_type rhs) const { \ + return !operator<(rhs); } + + #endif /* __PJPP_TYPES_HPP__ */ |