diff options
author | crupest <crupest@outlook.com> | 2021-08-13 15:24:39 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2021-08-13 15:24:39 +0800 |
commit | 202e9feed09f7cb7d41c004d414283b262a95204 (patch) | |
tree | 7d36a349452bfd172ec8e27a389c0e0cedab2f97 /include/cru/common/Base.hpp | |
parent | 2e379441f69c4fd3049d186f76b25457e6250282 (diff) | |
download | cru-202e9feed09f7cb7d41c004d414283b262a95204.tar.gz cru-202e9feed09f7cb7d41c004d414283b262a95204.tar.bz2 cru-202e9feed09f7cb7d41c004d414283b262a95204.zip |
...
Diffstat (limited to 'include/cru/common/Base.hpp')
-rw-r--r-- | include/cru/common/Base.hpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/include/cru/common/Base.hpp b/include/cru/common/Base.hpp index 5ed1e763..2f76385e 100644 --- a/include/cru/common/Base.hpp +++ b/include/cru/common/Base.hpp @@ -42,6 +42,31 @@ classname() = default; \ ~classname() override = default; +#define CRU_DEFINE_COMPARE_OPERATORS(classname) \ + inline bool operator==(const classname& left, const classname& right) { \ + return left.Compare(right) == 0; \ + } \ + \ + inline bool operator!=(const classname& left, const classname& right) { \ + return left.Compare(right) != 0; \ + } \ + \ + inline bool operator<(const classname& left, const classname& right) { \ + return left.Compare(right) < 0; \ + } \ + \ + inline bool operator<=(const classname& left, const classname& right) { \ + return left.Compare(right) <= 0; \ + } \ + \ + inline bool operator>(const classname& left, const classname& right) { \ + return left.Compare(right) > 0; \ + } \ + \ + inline bool operator>=(const classname& left, const classname& right) { \ + return left.Compare(right) >= 0; \ + } + namespace cru { class CRU_BASE_API Object { public: |