From f0a862e71bc12d86a898901ef773475a7c964832 Mon Sep 17 00:00:00 2001 From: Shauren Date: Thu, 24 Aug 2023 00:51:26 +0200 Subject: Core/Misc: Modernize comparison operators --- src/common/Utilities/SmartEnum.h | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src/common/Utilities/SmartEnum.h') diff --git a/src/common/Utilities/SmartEnum.h b/src/common/Utilities/SmartEnum.h index 24e3c60bd30..3c58d433406 100644 --- a/src/common/Utilities/SmartEnum.h +++ b/src/common/Utilities/SmartEnum.h @@ -85,13 +85,10 @@ class EnumUtils Iterator() : _index(EnumUtils::Count()) {} explicit Iterator(size_t index) : _index(index) { } - bool operator==(const Iterator& other) const { return other._index == _index; } - bool operator!=(const Iterator& other) const { return !operator==(other); } + bool operator==(const Iterator& other) const = default; + std::strong_ordering operator<=>(const Iterator& other) const = default; + difference_type operator-(Iterator const& other) const { return _index - other._index; } - bool operator<(const Iterator& other) const { return _index < other._index; } - bool operator<=(const Iterator& other) const { return _index <= other._index; } - bool operator>(const Iterator& other) const { return _index > other._index; } - bool operator>=(const Iterator& other) const { return _index >= other._index; } value_type operator[](difference_type d) const { return FromIndex(_index + d); } value_type operator*() const { return operator[](0); } -- cgit v1.2.3