mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-10 09:32:29 +01:00
Simplify operators on TIdentifier using the spaceship operator
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <compare>
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
|
||||
@@ -62,43 +63,5 @@ public:
|
||||
return _handle == ValueType::Null;
|
||||
}
|
||||
|
||||
constexpr bool operator==(const ValueType other) const noexcept
|
||||
{
|
||||
return _handle == other;
|
||||
}
|
||||
|
||||
constexpr bool operator!=(const ValueType other) const noexcept
|
||||
{
|
||||
return _handle != other;
|
||||
}
|
||||
|
||||
constexpr bool operator==(const TIdentifier& other) const noexcept
|
||||
{
|
||||
return _handle == other._handle;
|
||||
}
|
||||
|
||||
constexpr bool operator!=(const TIdentifier& other) const noexcept
|
||||
{
|
||||
return _handle != other._handle;
|
||||
}
|
||||
|
||||
constexpr bool operator<(const TIdentifier& other) const noexcept
|
||||
{
|
||||
return ToUnderlying() < other.ToUnderlying();
|
||||
}
|
||||
|
||||
constexpr bool operator<=(const TIdentifier& other) const noexcept
|
||||
{
|
||||
return ToUnderlying() <= other.ToUnderlying();
|
||||
}
|
||||
|
||||
constexpr bool operator>(const TIdentifier& other) const noexcept
|
||||
{
|
||||
return ToUnderlying() > other.ToUnderlying();
|
||||
}
|
||||
|
||||
constexpr bool operator>=(const TIdentifier& other) const noexcept
|
||||
{
|
||||
return ToUnderlying() >= other.ToUnderlying();
|
||||
}
|
||||
auto operator<=>(const TIdentifier&) const = default;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user