Fix osrm-contract, tests, on Windows

As part of graph contraction, node renumbering leads to
in-place permuting of graph state, including boolean vector elements.

std::vector<bool> returns proxy objects when referencing individual
bits. To correctly swap bool elements using MSVC, we need to explicitly
apply std::vector<bool>::swap.

Making this change fixes osrm-contract on Windows.

We also correct failing tests and other undefined behaviours
(mainly iterator access outside boundaries) highlighted by MSVC.
This commit is contained in:
Michael Bell
2020-11-14 18:02:56 +00:00
parent 98fd17589d
commit 96acdaf0d5
13 changed files with 153 additions and 62 deletions
+2 -2
View File
@@ -56,7 +56,7 @@ auto makeGraph(const MultiLevelPartition &mlp, const std::vector<MockEdge> &mock
return partitioner::MultiLevelGraph<EdgeData, osrm::storage::Ownership::Container>(
mlp, max_id + 1, edges);
}
}
} // namespace
BOOST_AUTO_TEST_SUITE(cell_customization_tests)
@@ -154,7 +154,7 @@ BOOST_AUTO_TEST_CASE(four_levels_test)
};
auto graph = makeGraph(mlp, edges);
std::vector<bool> node_filter(true, graph.GetNumberOfNodes());
std::vector<bool> node_filter(graph.GetNumberOfNodes(), true);
CellStorage storage(mlp, graph);
auto metric = storage.MakeMetric();