reserve when possible

This commit is contained in:
Moritz Kobitzsch
2016-11-11 14:09:04 +01:00
parent 12ded539aa
commit f88ac989ea
14 changed files with 51 additions and 42 deletions
@@ -87,7 +87,8 @@ struct LengthLimitedCoordinateAccumulator
};
/*
* The SelectRoadByNameOnlyChoiceAndStraightness tries to follow a given name along a route. We offer methods to skip
* The SelectRoadByNameOnlyChoiceAndStraightness tries to follow a given name along a route. We
* offer methods to skip
* over bridges/similar situations if desired, following narrow turns
* This struct offers an example implementation of a possible road selector for traversing the
* node-based graph using the NodeBasedGraphWalker
@@ -115,14 +116,13 @@ struct SelectRoadByNameOnlyChoiceAndStraightness
// find the next intersection given a hop limit
struct IntersectionFinderAccumulator
{
IntersectionFinderAccumulator(const std::uint8_t hop_limit, const IntersectionGenerator &intersection_generator);
IntersectionFinderAccumulator(const std::uint8_t hop_limit,
const IntersectionGenerator &intersection_generator);
// true if the path has traversed enough distance
bool terminate();
// update the accumulator
void update(const NodeID from_node,
const EdgeID via_edge,
const NodeID to_node);
void update(const NodeID from_node, const EdgeID via_edge, const NodeID to_node);
std::uint8_t hops;
const std::uint8_t hop_limit;
@@ -136,8 +136,6 @@ struct IntersectionFinderAccumulator
Intersection intersection;
};
template <class accumulator_type, class selector_type>
boost::optional<std::pair<NodeID, EdgeID>>
NodeBasedGraphWalker::TraverseRoad(NodeID current_node_id,