1
0
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:
ζeh Matt
2025-03-20 19:12:38 +02:00
parent cac21504cd
commit 49182eb448

View File

@@ -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;
};