mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-21 15:50:07 +01:00
refactor: Prefer <=> over multiple relational operators
Define `operator<=>` in classes that have all of `<`, `<=`, `>`, `>=`.
This commit is contained in:
@@ -270,16 +270,10 @@ public:
|
||||
}
|
||||
|
||||
inline bool operator==(const int64_t& rhs) const { return m_value == rhs; }
|
||||
inline bool operator<=(const int64_t& rhs) const { return m_value <= rhs; }
|
||||
inline bool operator< (const int64_t& rhs) const { return m_value < rhs; }
|
||||
inline bool operator>=(const int64_t& rhs) const { return m_value >= rhs; }
|
||||
inline bool operator> (const int64_t& rhs) const { return m_value > rhs; }
|
||||
inline auto operator<=>(const int64_t& rhs) const { return m_value <=> rhs; }
|
||||
|
||||
inline bool operator==(const CScriptNum& rhs) const { return operator==(rhs.m_value); }
|
||||
inline bool operator<=(const CScriptNum& rhs) const { return operator<=(rhs.m_value); }
|
||||
inline bool operator< (const CScriptNum& rhs) const { return operator< (rhs.m_value); }
|
||||
inline bool operator>=(const CScriptNum& rhs) const { return operator>=(rhs.m_value); }
|
||||
inline bool operator> (const CScriptNum& rhs) const { return operator> (rhs.m_value); }
|
||||
inline auto operator<=>(const CScriptNum& rhs) const { return operator<=>(rhs.m_value); }
|
||||
|
||||
inline CScriptNum operator+( const int64_t& rhs) const { return CScriptNum(m_value + rhs);}
|
||||
inline CScriptNum operator-( const int64_t& rhs) const { return CScriptNum(m_value - rhs);}
|
||||
|
||||
Reference in New Issue
Block a user