Skip to content

Commit 828b63e

Browse files
committed
Use std::equal instead of hand-rolled loop
1 parent 391359c commit 828b63e

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

tests/test-middle.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -516,13 +516,11 @@ static void check_way_nodes(std::shared_ptr<middle_pgsql_t> const &mid,
516516
REQUIRE(mid_q->nodes_get_list(&way.nodes()) == way.nodes().size());
517517
REQUIRE(way.nodes().size() == nodes.size());
518518

519-
auto it = way.nodes().cbegin();
520-
for (auto const *nptr : nodes) {
521-
REQUIRE(nptr->id() == it->ref());
522-
REQUIRE(nptr->location() == it->location());
523-
++it;
524-
}
525-
REQUIRE(it == way.nodes().cend());
519+
REQUIRE(std::equal(way.nodes().cbegin(), way.nodes().cend(), nodes.cbegin(),
520+
[](osmium::NodeRef const &nr, osmium::Node const *node) {
521+
return nr.ref() == node->id() &&
522+
nr.location() == node->location();
523+
}));
526524
}
527525

528526
/// Return true if the way with the specified id is not in the mid.

0 commit comments

Comments
 (0)