Structured bindings

This commit is contained in:
Michael Bell 2024-05-10 20:21:49 +01:00
parent 25434d4437
commit dcba4b7b35

View File

@ -495,9 +495,7 @@ UnpackedPath search(SearchEngineData<Algorithm> &engine_working_data,
for (auto const &packed_edge : packed_path) for (auto const &packed_edge : packed_path)
{ {
NodeID source, target; auto [source, target, overlay_edge] = packed_edge;
bool overlay_edge;
std::tie(source, target, overlay_edge) = packed_edge;
if (!overlay_edge) if (!overlay_edge)
{ // a base graph edge { // a base graph edge
unpacked_nodes.push_back(target); unpacked_nodes.push_back(target);
@ -517,19 +515,14 @@ UnpackedPath search(SearchEngineData<Algorithm> &engine_working_data,
forward_heap.Insert(source, {0}, {source}); forward_heap.Insert(source, {0}, {source});
reverse_heap.Insert(target, {0}, {target}); reverse_heap.Insert(target, {0}, {target});
// TODO: when structured bindings will be allowed change to auto [subpath_weight, subpath_nodes, subpath_edges] = search(engine_working_data,
// auto [subpath_weight, subpath_source, subpath_target, subpath] = ... facade,
EdgeWeight subpath_weight; forward_heap,
std::vector<NodeID> subpath_nodes; reverse_heap,
std::vector<EdgeID> subpath_edges; force_step_nodes,
std::tie(subpath_weight, subpath_nodes, subpath_edges) = search(engine_working_data, INVALID_EDGE_WEIGHT,
facade, sublevel,
forward_heap, parent_cell_id);
reverse_heap,
force_step_nodes,
INVALID_EDGE_WEIGHT,
sublevel,
parent_cell_id);
BOOST_ASSERT(!subpath_edges.empty()); BOOST_ASSERT(!subpath_edges.empty());
BOOST_ASSERT(subpath_nodes.size() > 1); BOOST_ASSERT(subpath_nodes.size() > 1);
BOOST_ASSERT(subpath_nodes.front() == source); BOOST_ASSERT(subpath_nodes.front() == source);
@ -612,10 +605,7 @@ double getNetworkDistance(SearchEngineData<Algorithm> &engine_working_data,
const PhantomEndpoints endpoints{source_phantom, target_phantom}; const PhantomEndpoints endpoints{source_phantom, target_phantom};
insertNodesInHeaps(forward_heap, reverse_heap, endpoints); insertNodesInHeaps(forward_heap, reverse_heap, endpoints);
EdgeWeight weight = INVALID_EDGE_WEIGHT; auto [weight, unpacked_nodes, unpacked_edges] = search(
std::vector<NodeID> unpacked_nodes;
std::vector<EdgeID> unpacked_edges;
std::tie(weight, unpacked_nodes, unpacked_edges) = search(
engine_working_data, facade, forward_heap, reverse_heap, {}, weight_upper_bound, endpoints); engine_working_data, facade, forward_heap, reverse_heap, {}, weight_upper_bound, endpoints);
if (weight == INVALID_EDGE_WEIGHT) if (weight == INVALID_EDGE_WEIGHT)