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:
Tyler Veness
2022-11-27 21:01:01 -08:00
committed by GitHub
parent 135c13958f
commit 42b6d4e3f7
39 changed files with 25 additions and 367 deletions

View File

@@ -58,10 +58,6 @@ constexpr bool Rotation2d::operator==(const Rotation2d& other) const {
: std::hypot(Cos() - other.Cos(), Sin() - other.Sin())) < 1E-9;
}
constexpr bool Rotation2d::operator!=(const Rotation2d& other) const {
return !operator==(other);
}
constexpr Rotation2d Rotation2d::RotateBy(const Rotation2d& other) const {
return {Cos() * other.Cos() - Sin() * other.Sin(),
Cos() * other.Sin() + Sin() * other.Cos()};