Skip to content

Commit

Permalink
adding spaceship operator
Browse files Browse the repository at this point in the history
  • Loading branch information
vlntb committed Jan 24, 2025
1 parent 7b63b8d commit 2579458
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
7 changes: 3 additions & 4 deletions include/xrpl/resource/Charge.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,9 @@ class Charge

bool
operator==(Charge const&) const;
bool
operator!=(Charge const&) const;
bool
operator>=(Charge const&) const;

std::strong_ordering
operator<=>(Charge const&) const;

private:
value_type m_cost;
Expand Down
12 changes: 3 additions & 9 deletions src/libxrpl/resource/Charge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,10 @@ Charge::operator==(Charge const& c) const
return c.m_cost == m_cost;
}

bool
Charge::operator!=(Charge const& c) const
{
return c.m_cost != m_cost;
}

bool
Charge::operator>=(Charge const& c) const
std::strong_ordering
Charge::operator<=>(Charge const& c) const
{
return m_cost >= c.m_cost;
return m_cost <=> c.m_cost;
}

} // namespace Resource
Expand Down

0 comments on commit 2579458

Please sign in to comment.