Use lexicographical comparison in ESM3ExteriorCellRefId::operator<

This commit is contained in:
elsid 2023-04-08 16:20:50 +02:00
parent 8cd5b91b4a
commit bd10becb65
No known key found for this signature in database
GPG key ID: 4DE04C198CBA7625
2 changed files with 15 additions and 2 deletions

View file

@ -28,9 +28,14 @@ namespace ESM
int32_t getX() const { return mX; }
int32_t getY() const { return mY; }
constexpr bool operator==(ESM3ExteriorCellRefId rhs) const noexcept { return mX == rhs.mX && mY == rhs.mY; }
friend inline constexpr auto tie(const ESM3ExteriorCellRefId& value) noexcept
{
return std::tie(value.mX, value.mY);
}
constexpr bool operator<(ESM3ExteriorCellRefId rhs) const noexcept { return mX < rhs.mX && mY < rhs.mY; }
constexpr bool operator==(ESM3ExteriorCellRefId rhs) const noexcept { return tie(*this) == tie(rhs); }
constexpr bool operator<(ESM3ExteriorCellRefId rhs) const noexcept { return tie(*this) < tie(rhs); }
friend std::ostream& operator<<(std::ostream& stream, ESM3ExteriorCellRefId value);