Skip to content

Commit 2b44613

Browse files
committed
Simplify equality operators
std::vector has operator==() and operator!=() which work fine for us here.
1 parent b72dc44 commit 2b44613

File tree

2 files changed

+1
-21
lines changed

2 files changed

+1
-21
lines changed

src/geom.cpp

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,11 @@
99

1010
#include "geom.hpp"
1111

12-
#include <algorithm>
13-
1412
namespace geom {
1513

16-
bool operator==(point_list_t const &a, point_list_t const &b) noexcept
17-
{
18-
return std::equal(a.cbegin(), a.cend(), b.cbegin(), b.cend());
19-
}
20-
21-
bool operator!=(point_list_t const &a, point_list_t const &b) noexcept
22-
{
23-
return !(a == b);
24-
}
25-
2614
bool operator==(polygon_t const &a, polygon_t const &b) noexcept
2715
{
28-
return (a.outer() == b.outer()) &&
29-
std::equal(a.inners().cbegin(), a.inners().cend(),
30-
b.inners().cbegin(), b.inners().cend());
16+
return (a.outer() == b.outer()) && (a.inners() == b.inners());
3117
}
3218

3319
bool operator!=(polygon_t const &a, polygon_t const &b) noexcept

src/geom.hpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,6 @@ class point_list_t : public std::vector<point_t>
105105
: std::vector<point_t>(list.begin(), list.end())
106106
{}
107107

108-
friend bool operator==(point_list_t const &a,
109-
point_list_t const &b) noexcept;
110-
111-
friend bool operator!=(point_list_t const &a,
112-
point_list_t const &b) noexcept;
113-
114108
}; // class point_list_t
115109

116110
class linestring_t : public point_list_t

0 commit comments

Comments
 (0)