diff options
| author | Shauren <shauren.trinity@gmail.com> | 2023-08-24 00:51:26 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2023-08-24 00:51:26 +0200 |
| commit | f0a862e71bc12d86a898901ef773475a7c964832 (patch) | |
| tree | d0dde0ae128a81734d0a2566aef34393b4bdecb3 /src/common/Utilities/SmartEnum.h | |
| parent | f108a50abf82abd0973878ef88fdab47a408238c (diff) | |
Core/Misc: Modernize comparison operators
Diffstat (limited to 'src/common/Utilities/SmartEnum.h')
| -rw-r--r-- | src/common/Utilities/SmartEnum.h | 9 |
1 files changed, 3 insertions, 6 deletions
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<Enum>()) {} 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<Enum>(_index + d); } value_type operator*() const { return operator[](0); } |
