mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-25 01:41:43 +00:00
Use defaulted comparison operators in C++ (#4723)
Comparison operators which compared against every class member variable now use C++20's default comparison operators. Also remove operator!= that in C++20 is now auto-generated from operator==.
This commit is contained in:
@@ -520,14 +520,7 @@ class NetworkTableEntry final {
|
||||
* Equality operator. Returns true if both instances refer to the same
|
||||
* native handle.
|
||||
*/
|
||||
bool operator==(const NetworkTableEntry& oth) const {
|
||||
return m_handle == oth.m_handle;
|
||||
}
|
||||
|
||||
/** Inequality operator. */
|
||||
bool operator!=(const NetworkTableEntry& oth) const {
|
||||
return !(*this == oth);
|
||||
}
|
||||
bool operator==(const NetworkTableEntry&) const = default;
|
||||
|
||||
protected:
|
||||
/* Native handle */
|
||||
|
||||
@@ -688,14 +688,7 @@ class NetworkTableInstance final {
|
||||
* Equality operator. Returns true if both instances refer to the same
|
||||
* native handle.
|
||||
*/
|
||||
bool operator==(const NetworkTableInstance& other) const {
|
||||
return m_handle == other.m_handle;
|
||||
}
|
||||
|
||||
/** Inequality operator. */
|
||||
bool operator!=(const NetworkTableInstance& other) const {
|
||||
return !(*this == other);
|
||||
}
|
||||
bool operator==(const NetworkTableInstance&) const = default;
|
||||
|
||||
private:
|
||||
/* Native handle */
|
||||
|
||||
@@ -636,9 +636,6 @@ class Value final {
|
||||
};
|
||||
|
||||
bool operator==(const Value& lhs, const Value& rhs);
|
||||
inline bool operator!=(const Value& lhs, const Value& rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
/**
|
||||
* NetworkTable Value alias for similarity with Java.
|
||||
|
||||
@@ -278,10 +278,7 @@ class Topic {
|
||||
* Equality operator. Returns true if both instances refer to the same
|
||||
* native handle.
|
||||
*/
|
||||
bool operator==(const Topic& oth) const { return m_handle == oth.m_handle; }
|
||||
|
||||
/** Inequality operator. */
|
||||
bool operator!=(const Topic& oth) const { return !(*this == oth); }
|
||||
bool operator==(const Topic&) const = default;
|
||||
|
||||
protected:
|
||||
NT_Topic m_handle{0};
|
||||
|
||||
Reference in New Issue
Block a user