mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-23 01:21:42 +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:
@@ -43,10 +43,7 @@ class circular_buffer {
|
||||
++(*this);
|
||||
return retval;
|
||||
}
|
||||
bool operator==(const iterator& other) const {
|
||||
return m_buffer == other.m_buffer && m_index == other.m_index;
|
||||
}
|
||||
bool operator!=(const iterator& other) const { return !(*this == other); }
|
||||
bool operator==(const iterator&) const = default;
|
||||
reference operator*() { return (*m_buffer)[m_index]; }
|
||||
|
||||
private:
|
||||
@@ -74,12 +71,7 @@ class circular_buffer {
|
||||
++(*this);
|
||||
return retval;
|
||||
}
|
||||
bool operator==(const const_iterator& other) const {
|
||||
return m_buffer == other.m_buffer && m_index == other.m_index;
|
||||
}
|
||||
bool operator!=(const const_iterator& other) const {
|
||||
return !(*this == other);
|
||||
}
|
||||
bool operator==(const const_iterator&) const = default;
|
||||
const_reference operator*() const { return (*m_buffer)[m_index]; }
|
||||
|
||||
private:
|
||||
|
||||
@@ -38,10 +38,7 @@ class static_circular_buffer {
|
||||
++(*this);
|
||||
return retval;
|
||||
}
|
||||
bool operator==(const iterator& other) const {
|
||||
return m_buffer == other.m_buffer && m_index == other.m_index;
|
||||
}
|
||||
bool operator!=(const iterator& other) const { return !(*this == other); }
|
||||
bool operator==(const iterator&) const = default;
|
||||
reference operator*() { return (*m_buffer)[m_index]; }
|
||||
|
||||
private:
|
||||
@@ -69,12 +66,7 @@ class static_circular_buffer {
|
||||
++(*this);
|
||||
return retval;
|
||||
}
|
||||
bool operator==(const const_iterator& other) const {
|
||||
return m_buffer == other.m_buffer && m_index == other.m_index;
|
||||
}
|
||||
bool operator!=(const const_iterator& other) const {
|
||||
return !(*this == other);
|
||||
}
|
||||
bool operator==(const const_iterator&) const = default;
|
||||
const_reference operator*() const { return (*m_buffer)[m_index]; }
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user