Fix for_each_indexed util function

- Fix typo in util function name for_each_indexed.
- Use the overloaded functions for_each_indexed and for_each_pair
  with a container argument where possible to improve readability.
This commit is contained in:
Michael Bell
2021-10-22 12:00:07 +01:00
parent 2c81083406
commit 04c2167c2d
6 changed files with 8 additions and 23 deletions
+2 -2
View File
@@ -747,7 +747,7 @@ ExtractionContainers::ReferencedWays ExtractionContainers::IdentifyManeuverOverr
// Then, populate the values in that hashtable for only the ways
// referenced
util::for_each_indexed(ways_list.cbegin(), ways_list.cend(), set_ids);
util::for_each_indexed(ways_list, set_ids);
TIMER_STOP(identify_maneuver_override_ways);
log << "ok, after " << TIMER_SEC(identify_maneuver_override_ways) << "s";
@@ -972,7 +972,7 @@ ExtractionContainers::ReferencedWays ExtractionContainers::IdentifyRestrictionWa
}
};
util::for_each_indexed(ways_list.cbegin(), ways_list.cend(), set_ids);
util::for_each_indexed(ways_list, set_ids);
TIMER_STOP(identify_restriction_ways);
log << "ok, after " << TIMER_SEC(identify_restriction_ways) << "s";
+2 -6
View File
@@ -421,9 +421,7 @@ void ExtractorCallbacks::ProcessWay(const osmium::Way &input_way, const Extracti
parsed_way.forward_travel_mode,
parsed_way.is_left_hand_driving});
util::for_each_pair(
nodes.cbegin(),
nodes.cend(),
[&](const osmium::NodeRef &first_node, const osmium::NodeRef &last_node) {
nodes, [&](const osmium::NodeRef &first_node, const osmium::NodeRef &last_node) {
NodeBasedEdgeWithOSM edge = {
OSMNodeID{static_cast<std::uint64_t>(first_node.ref())},
OSMNodeID{static_cast<std::uint64_t>(last_node.ref())},
@@ -457,9 +455,7 @@ void ExtractorCallbacks::ProcessWay(const osmium::Way &input_way, const Extracti
parsed_way.backward_travel_mode,
parsed_way.is_left_hand_driving});
util::for_each_pair(
nodes.cbegin(),
nodes.cend(),
[&](const osmium::NodeRef &first_node, const osmium::NodeRef &last_node) {
nodes, [&](const osmium::NodeRef &first_node, const osmium::NodeRef &last_node) {
NodeBasedEdgeWithOSM edge = {
OSMNodeID{static_cast<std::uint64_t>(first_node.ref())},
OSMNodeID{static_cast<std::uint64_t>(last_node.ref())},
+1 -2
View File
@@ -215,8 +215,7 @@ void buildGraph(RestrictionGraph &rg, const std::vector<TurnRestriction> &restri
if (restriction.Type() == RestrictionType::WAY_RESTRICTION)
{
const auto &way_restriction = restriction.AsWayRestriction();
util::for_each_pair(way_restriction.via.begin(),
way_restriction.via.end(),
util::for_each_pair(way_restriction.via,
[&](NodeID from, NodeID to) { builder.next(from, to); });
}
builder.end(restriction);