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:
@@ -38,8 +38,8 @@ void test_rw(const Offsets &offsets, const Data &data)
|
||||
|
||||
for (std::size_t index = 0; index < offsets.size() - 1; ++index)
|
||||
{
|
||||
typename IndexedData::ResultType expected_result(&data[offsets[index]],
|
||||
&data[offsets[index + 1]]);
|
||||
typename IndexedData::ResultType expected_result(data.begin() + offsets[index],
|
||||
data.begin() + offsets[index + 1]);
|
||||
BOOST_CHECK_EQUAL(expected_result, indexed_data.at(index));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user