From 10ffdf1d0c42a3c8ac2671060a655ced691c558b Mon Sep 17 00:00:00 2001 From: gregtatcam Date: Wed, 11 Dec 2024 11:45:24 -0500 Subject: [PATCH] Address reviewer's feedback --- include/xrpl/protocol/STIssue.h | 37 +++++++++++++++------------------ 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/include/xrpl/protocol/STIssue.h b/include/xrpl/protocol/STIssue.h index c9a5245eb84..f5c183fc0ce 100644 --- a/include/xrpl/protocol/STIssue.h +++ b/include/xrpl/protocol/STIssue.h @@ -76,6 +76,15 @@ class STIssue final : public STBase, CountedObject bool isDefault() const override; + friend constexpr std::weak_ordering + operator<=>(STIssue const& lhs, STIssue const& rhs); + + friend constexpr bool + operator==(STIssue const& lhs, Asset const& rhs); + + friend constexpr std::weak_ordering + operator<=>(STIssue const& lhs, Asset const& rhs); + private: STBase* copy(std::size_t n, void* buf) const override; @@ -129,34 +138,22 @@ STIssue::setIssue(Asset const& asset) asset_ = asset; } -inline bool -operator==(STIssue const& lhs, STIssue const& rhs) -{ - return lhs.value() == rhs.value(); -} - -inline bool -operator!=(STIssue const& lhs, STIssue const& rhs) -{ - return !operator==(lhs, rhs); -} - -inline bool -operator<(STIssue const& lhs, STIssue const& rhs) +constexpr std::weak_ordering +operator<=>(STIssue const& lhs, STIssue const& rhs) { - return lhs.value() < rhs.value(); + return lhs.asset_ <=> rhs.asset_; } -inline bool +constexpr bool operator==(STIssue const& lhs, Asset const& rhs) { - return lhs.value() == rhs; + return lhs.asset_ == rhs; } -inline bool -operator<(STIssue const& lhs, Asset const& rhs) +constexpr std::weak_ordering +operator<=>(STIssue const& lhs, Asset const& rhs) { - return lhs.value() < rhs; + return lhs.asset_ <=> rhs; } } // namespace ripple