Skip to content

Commit acd5aee

Browse files
committed
Take the operator< out of the endpoint_t struct
This is to avoid confusion with the equality operator which uses a different logic.
1 parent 32a50ba commit acd5aee

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/geom.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -145,13 +145,6 @@ void make_multiline(osmium::memory::Buffer const &ways, double split_at,
145145
{
146146
return id == rhs.id;
147147
}
148-
149-
bool operator<(endpoint_t const &rhs) const noexcept
150-
{
151-
return std::tuple<osmid_t, std::size_t, bool>(id, n, is_front) <
152-
std::tuple<osmid_t, std::size_t, bool>(rhs.id, rhs.n,
153-
rhs.is_front);
154-
}
155148
};
156149

157150
std::vector<endpoint_t> endpoints;
@@ -182,7 +175,11 @@ void make_multiline(osmium::memory::Buffer const &ways, double split_at,
182175
}
183176

184177
// sort by node id
185-
std::sort(endpoints.begin(), endpoints.end());
178+
std::sort(endpoints.begin(), endpoints.end(), [
179+
](endpoint_t const &a, endpoint_t const &b) noexcept {
180+
return std::tuple<osmid_t, std::size_t, bool>(a.id, a.n, a.is_front) <
181+
std::tuple<osmid_t, std::size_t, bool>(b.id, b.n, b.is_front);
182+
});
186183

187184
// now fill the connection list based on the sorted list
188185
for (auto it = std::adjacent_find(endpoints.cbegin(), endpoints.cend());

0 commit comments

Comments
 (0)