forked from OpenSoaring/OpenSoar
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
100 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
diff --git a/src/Geo/Flat/FlatGeoPoint.hpp b/src/Geo/Flat/FlatGeoPoint.hpp | ||
index 0e684e652d..5f69b8dc24 100644 | ||
--- a/src/Geo/Flat/FlatGeoPoint.hpp | ||
+++ b/src/Geo/Flat/FlatGeoPoint.hpp | ||
@@ -69,8 +69,9 @@ struct FlatGeoPoint : IntPoint2D { | ||
return ::DotProduct(*this, other); | ||
} | ||
|
||
- constexpr bool operator==(const FlatGeoPoint &) const noexcept = default; | ||
- constexpr bool operator!=(const FlatGeoPoint &) const noexcept = default; | ||
+ constexpr bool operator==(const FlatGeoPoint &other) const noexcept { | ||
+ return IntPoint2D::operator==(other); | ||
+ } | ||
|
||
[[gnu::pure]] | ||
bool Sort(const FlatGeoPoint& sp) const noexcept { | ||
@@ -107,8 +108,9 @@ struct AFlatGeoPoint : public FlatGeoPoint { | ||
y = (y >> 2) << 2; | ||
} | ||
|
||
- constexpr bool operator==(const AFlatGeoPoint &) const noexcept = default; | ||
- constexpr bool operator!=(const AFlatGeoPoint &) const noexcept = default; | ||
+ constexpr bool operator==(const AFlatGeoPoint &other) const noexcept { | ||
+ return FlatGeoPoint::operator==(other) && (altitude == other.altitude); | ||
+ } | ||
|
||
/** | ||
* Ordering operator, used for set ordering. Uses lexicographic comparison. | ||
diff --git a/src/Geo/GeoPoint.hpp b/src/Geo/GeoPoint.hpp | ||
index 6e3a35d478..557354011f 100644 | ||
--- a/src/Geo/GeoPoint.hpp | ||
+++ b/src/Geo/GeoPoint.hpp | ||
@@ -263,8 +263,13 @@ struct GeoPoint { | ||
[[gnu::pure]] | ||
GeoPoint Middle(const GeoPoint &other) const noexcept; | ||
|
||
- constexpr bool operator==(const GeoPoint &) const noexcept = default; | ||
- constexpr bool operator!=(const GeoPoint &) const noexcept = default; | ||
+ // constexpr bool operator==(const GeoPoint &) const noexcept = default; | ||
+ constexpr bool Equals(const GeoPoint other) const noexcept { | ||
+ return longitude == other.longitude && latitude == other.latitude; | ||
+ } | ||
+ constexpr bool operator==(const GeoPoint other) const noexcept { | ||
+ return Equals(other); | ||
+ } | ||
}; | ||
|
||
static_assert(std::is_trivial<GeoPoint>::value, "type is not trivial"); | ||
diff --git a/src/Math/Point2D.hpp b/src/Math/Point2D.hpp | ||
index 49e05dac5b..f291901769 100644 | ||
--- a/src/Math/Point2D.hpp | ||
+++ b/src/Math/Point2D.hpp | ||
@@ -32,8 +32,10 @@ struct Point2D { | ||
:x(static_cast<scalar_type>(src.x)), | ||
y(static_cast<scalar_type>(src.y)) {} | ||
|
||
- constexpr bool operator==(const Point2D<T, PT> &) const noexcept = default; | ||
- constexpr bool operator!=(const Point2D<T, PT> &) const noexcept = default; | ||
+ // constexpr bool operator==(const Point2D<T, PT> &) const noexcept = default; | ||
+ constexpr bool operator==(const Point2D<T, PT> &other) const noexcept { | ||
+ return x == other.x && y == other.y; | ||
+ } | ||
|
||
constexpr Point2D<T, PT> operator+(Point2D<T, PT> other) const noexcept { | ||
return { scalar_type(x + other.x), scalar_type(y + other.y) }; | ||
diff --git a/src/PageSettings.hpp b/src/PageSettings.hpp | ||
index c6a56bd661..6642c0e54a 100644 | ||
--- a/src/PageSettings.hpp | ||
+++ b/src/PageSettings.hpp | ||
@@ -33,8 +33,12 @@ struct PageLayout | ||
panel = 0; | ||
} | ||
|
||
- constexpr bool operator==(const InfoBoxConfig &other) const noexcept = default; | ||
- constexpr bool operator!=(const InfoBoxConfig &other) const noexcept = default; | ||
+ // constexpr bool operator==(const InfoBoxConfig &other) const noexcept = default; | ||
+ bool operator==(const InfoBoxConfig &other) const { | ||
+ return enabled == other.enabled && | ||
+ auto_switch == other.auto_switch && | ||
+ panel == other.panel; | ||
+ } | ||
}; | ||
|
||
bool valid; | ||
@@ -138,8 +142,13 @@ struct PageLayout | ||
std::span<char> buffer, | ||
const bool concise=false) const noexcept; | ||
|
||
- constexpr bool operator==(const PageLayout &other) const noexcept = default; | ||
- constexpr bool operator!=(const PageLayout &other) const noexcept = default; | ||
+ // constexpr bool operator==(const PageLayout &other) const noexcept = default; | ||
+ bool operator==(const PageLayout &other) const { | ||
+ return valid == other.valid && | ||
+ main == other.main && | ||
+ bottom == other.bottom && | ||
+ infobox_config == other.infobox_config; | ||
+ } | ||
}; | ||
|
||
struct PageSettings { |
File renamed without changes.