Use ranges in datafacade instead of vectors

Range type must use immutable references due to a
regression in `boost::any_range`.
References:
https://svn.boost.org/trac10/ticket/10493
https://stackoverflow.com/questions/42427395/boostany-range-with-optimization-level-o2-causes-crash/42427662
This commit is contained in:
Kajari Ghosh
2018-03-19 19:41:02 +01:00
committed by Patrick Niklaus
parent 282415bbc1
commit be123cd72f
14 changed files with 293 additions and 256 deletions
+10 -11
View File
@@ -101,8 +101,8 @@ std::vector<TurnData> generateTurns(const datafacade &facade,
// w
// uv is the "approach"
// vw is the "exit"
std::vector<EdgeWeight> approach_weight_vector;
std::vector<EdgeWeight> approach_duration_vector;
typename datafacade::BaseDataFacade::WeightsRangeT approach_weight_range;
typename datafacade::BaseDataFacade::DurationsRangeT approach_duration_range;
// Look at every node in the directed graph we created
for (const auto &startnode : sorted_startnodes)
@@ -151,27 +151,26 @@ std::vector<TurnData> generateTurns(const datafacade &facade,
if (edge_based_node_info.find(approachedge.edge_based_node_id)
->second.is_geometry_forward)
{
approach_weight_vector = facade.GetUncompressedForwardWeights(
approach_weight_range = facade.GetUncompressedForwardWeights(
edge_based_node_info.find(approachedge.edge_based_node_id)
->second.packed_geometry_id);
approach_duration_vector = facade.GetUncompressedForwardDurations(
approach_duration_range = facade.GetUncompressedForwardDurations(
edge_based_node_info.find(approachedge.edge_based_node_id)
->second.packed_geometry_id);
}
else
{
approach_weight_vector = facade.GetUncompressedReverseWeights(
approach_weight_range = facade.GetUncompressedReverseWeights(
edge_based_node_info.find(approachedge.edge_based_node_id)
->second.packed_geometry_id);
approach_duration_vector = facade.GetUncompressedReverseDurations(
approach_duration_range = facade.GetUncompressedReverseDurations(
edge_based_node_info.find(approachedge.edge_based_node_id)
->second.packed_geometry_id);
}
const auto sum_node_weight = std::accumulate(approach_weight_vector.begin(),
approach_weight_vector.end(),
EdgeWeight{0});
const auto sum_node_duration = std::accumulate(approach_duration_vector.begin(),
approach_duration_vector.end(),
const auto sum_node_weight = std::accumulate(
approach_weight_range.begin(), approach_weight_range.end(), EdgeWeight{0});
const auto sum_node_duration = std::accumulate(approach_duration_range.begin(),
approach_duration_range.end(),
EdgeWeight{0});
// The edge.weight is the whole edge weight, which includes the turn