From cc4a9c0508641beeba90d0e0fc80a948f3492f38 Mon Sep 17 00:00:00 2001 From: Gregory Tsipenyuk Date: Tue, 10 Dec 2024 16:18:32 -0500 Subject: [PATCH] Address reviewer's feedback. --- include/xrpl/protocol/Issue.h | 5 ++++- include/xrpl/protocol/MPTIssue.h | 19 +++++++++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/include/xrpl/protocol/Issue.h b/include/xrpl/protocol/Issue.h index 60182698ee6..83ef337c357 100644 --- a/include/xrpl/protocol/Issue.h +++ b/include/xrpl/protocol/Issue.h @@ -58,6 +58,9 @@ class Issue bool native() const; + + friend constexpr std::weak_ordering + operator<=>(Issue const& lhs, Issue const& rhs); }; bool @@ -95,7 +98,7 @@ operator==(Issue const& lhs, Issue const& rhs) /** Strict weak ordering. */ /** @{ */ -[[nodiscard]] inline constexpr std::weak_ordering +[[nodiscard]] constexpr std::weak_ordering operator<=>(Issue const& lhs, Issue const& rhs) { if (auto const c{lhs.currency <=> rhs.currency}; c != 0) diff --git a/include/xrpl/protocol/MPTIssue.h b/include/xrpl/protocol/MPTIssue.h index 46f28dd87e1..028051ab1ae 100644 --- a/include/xrpl/protocol/MPTIssue.h +++ b/include/xrpl/protocol/MPTIssue.h @@ -51,8 +51,11 @@ class MPTIssue void setJson(Json::Value& jv) const; - auto - operator<=>(MPTIssue const&) const = default; + friend constexpr bool + operator==(MPTIssue const& lhs, MPTIssue const& rhs); + + friend constexpr std::weak_ordering + operator<=>(MPTIssue const& lhs, MPTIssue const& rhs); bool native() const @@ -61,6 +64,18 @@ class MPTIssue } }; +constexpr bool +operator==(MPTIssue const& lhs, MPTIssue const& rhs) +{ + return lhs.mptID_ == rhs.mptID_; +} + +constexpr std::weak_ordering +operator<=>(MPTIssue const& lhs, MPTIssue const& rhs) +{ + return lhs.mptID_ <=> rhs.mptID_; +} + /** MPT is a non-native token. */ inline bool