Force correct type deduction for irange on windows

This commit is contained in:
Patrick Niklaus 2016-04-12 12:42:16 +02:00
parent 621ed970da
commit 7416653874
12 changed files with 45 additions and 33 deletions

View File

@ -342,7 +342,7 @@ class GraphContractor
// remaining graph
std::vector<NodeID> new_node_id_from_orig_id_map(number_of_nodes, SPECIAL_NODEID);
for (const auto new_node_id : util::irange<std::size_t>(0, remaining_nodes.size()))
for (const auto new_node_id : util::irange<std::size_t>(0UL, remaining_nodes.size()))
{
auto &node = remaining_nodes[new_node_id];
BOOST_ASSERT(node_priorities.size() > node.id);
@ -352,7 +352,7 @@ class GraphContractor
}
// build forward and backward renumbering map and remap ids in remaining_nodes
for (const auto new_node_id : util::irange<std::size_t>(0, remaining_nodes.size()))
for (const auto new_node_id : util::irange<std::size_t>(0UL, remaining_nodes.size()))
{
auto &node = remaining_nodes[new_node_id];
// create renumbering maps in both directions
@ -362,7 +362,7 @@ class GraphContractor
}
// walk over all nodes
for (const auto source :
util::irange<NodeID>(0, contractor_graph->GetNumberOfNodes()))
util::irange<NodeID>(0UL, contractor_graph->GetNumberOfNodes()))
{
for (auto current_edge : contractor_graph->GetAdjacentEdgeRange(source))
{

View File

@ -82,7 +82,7 @@ class RouteAPI : public BaseAPI
legs.reserve(number_of_legs);
leg_geometries.reserve(number_of_legs);
for (auto idx : util::irange(0UL, number_of_legs))
for (auto idx : util::irange<std::size_t>(0UL, number_of_legs))
{
const auto &phantoms = segment_end_coordinates[idx];
const auto &path_data = unpacked_path_segments[idx];
@ -155,7 +155,7 @@ class RouteAPI : public BaseAPI
}
std::vector<util::json::Value> step_geometries;
for (const auto idx : util::irange(0UL, legs.size()))
for (const auto idx : util::irange<std::size_t>(0UL, legs.size()))
{
auto &leg_geometry = leg_geometries[idx];
std::transform(

View File

@ -103,7 +103,7 @@ class TableAPI final : public BaseAPI
std::size_t number_of_columns) const
{
util::json::Array json_table;
for (const auto row : util::irange<std::size_t>(0, number_of_rows))
for (const auto row : util::irange<std::size_t>(0UL, number_of_rows))
{
util::json::Array json_row;
auto row_begin_iterator = values.begin() + (row * number_of_columns);

View File

@ -77,10 +77,10 @@ class TripAPI final : public RouteAPI
};
std::vector<TripIndex> input_idx_to_trip_idx(parameters.coordinates.size());
for (auto sub_trip_index : util::irange(0u, static_cast<unsigned>(sub_trips.size())))
for (auto sub_trip_index : util::irange<unsigned>(0u, sub_trips.size()))
{
for (auto point_index :
util::irange(0u, static_cast<unsigned>(sub_trips[sub_trip_index].size())))
util::irange<unsigned>(0u, sub_trips[sub_trip_index].size()))
{
input_idx_to_trip_idx[sub_trips[sub_trip_index][point_index]] =
TripIndex{sub_trip_index, point_index};

View File

@ -69,7 +69,7 @@ template <class CandidateLists> struct HiddenMarkovModel
path_distances.resize(candidates_list.size());
pruned.resize(candidates_list.size());
breakage.resize(candidates_list.size());
for (const auto i : util::irange<std::size_t>(0u, candidates_list.size()))
for (const auto i : util::irange<std::size_t>(0UL, candidates_list.size()))
{
const auto &num_candidates = candidates_list[i].size();
// add empty vectors
@ -107,7 +107,7 @@ template <class CandidateLists> struct HiddenMarkovModel
{
BOOST_ASSERT(initial_timestamp < num_points);
for (const auto s : util::irange<std::size_t>(0u, viterbi[initial_timestamp].size()))
for (const auto s : util::irange<std::size_t>(0UL, viterbi[initial_timestamp].size()))
{
viterbi[initial_timestamp][s] = emission_log_probabilities[initial_timestamp][s];
parents[initial_timestamp][s] = std::make_pair(initial_timestamp, s);

View File

@ -122,7 +122,7 @@ class BasePlugin
const bool use_hints = !parameters.hints.empty();
const bool use_bearings = !parameters.bearings.empty();
for (const auto i : util::irange<std::size_t>(0, parameters.coordinates.size()))
for (const auto i : util::irange<std::size_t>(0UL, parameters.coordinates.size()))
{
if (use_hints && parameters.hints[i] &&
parameters.hints[i]->IsValid(parameters.coordinates[i], facade))
@ -161,7 +161,7 @@ class BasePlugin
const bool use_radiuses = !parameters.radiuses.empty();
BOOST_ASSERT(parameters.IsValid());
for (const auto i : util::irange<std::size_t>(0, parameters.coordinates.size()))
for (const auto i : util::irange<std::size_t>(0UL, parameters.coordinates.size()))
{
if (use_hints && parameters.hints[i] &&
parameters.hints[i]->IsValid(parameters.coordinates[i], facade))
@ -221,7 +221,7 @@ class BasePlugin
const bool use_radiuses = !parameters.radiuses.empty();
BOOST_ASSERT(parameters.IsValid());
for (const auto i : util::irange<std::size_t>(0, parameters.coordinates.size()))
for (const auto i : util::irange<std::size_t>(0UL, parameters.coordinates.size()))
{
if (use_hints && parameters.hints[i] &&
parameters.hints[i]->IsValid(parameters.coordinates[i], facade))

View File

@ -84,19 +84,25 @@ class AlternativeRouting final
int upper_bound_to_shortest_path_distance = INVALID_EDGE_WEIGHT;
NodeID middle_node = SPECIAL_NODEID;
const EdgeWeight min_edge_offset =
std::min(phantom_node_pair.source_phantom.forward_segment_id.enabled ? -phantom_node_pair.source_phantom.GetForwardWeightPlusOffset() : 0,
phantom_node_pair.source_phantom.reverse_segment_id.enabled ? -phantom_node_pair.source_phantom.GetReverseWeightPlusOffset() : 0);
std::min(phantom_node_pair.source_phantom.forward_segment_id.enabled
? -phantom_node_pair.source_phantom.GetForwardWeightPlusOffset()
: 0,
phantom_node_pair.source_phantom.reverse_segment_id.enabled
? -phantom_node_pair.source_phantom.GetReverseWeightPlusOffset()
: 0);
if (phantom_node_pair.source_phantom.forward_segment_id.enabled)
{
BOOST_ASSERT(phantom_node_pair.source_phantom.forward_segment_id.id != SPECIAL_SEGMENTID);
BOOST_ASSERT(phantom_node_pair.source_phantom.forward_segment_id.id !=
SPECIAL_SEGMENTID);
forward_heap1.Insert(phantom_node_pair.source_phantom.forward_segment_id.id,
-phantom_node_pair.source_phantom.GetForwardWeightPlusOffset(),
phantom_node_pair.source_phantom.forward_segment_id.id);
}
if (phantom_node_pair.source_phantom.reverse_segment_id.enabled)
{
BOOST_ASSERT(phantom_node_pair.source_phantom.reverse_segment_id.id != SPECIAL_SEGMENTID);
BOOST_ASSERT(phantom_node_pair.source_phantom.reverse_segment_id.id !=
SPECIAL_SEGMENTID);
forward_heap1.Insert(phantom_node_pair.source_phantom.reverse_segment_id.id,
-phantom_node_pair.source_phantom.GetReverseWeightPlusOffset(),
phantom_node_pair.source_phantom.reverse_segment_id.id);
@ -104,14 +110,16 @@ class AlternativeRouting final
if (phantom_node_pair.target_phantom.forward_segment_id.enabled)
{
BOOST_ASSERT(phantom_node_pair.target_phantom.forward_segment_id.id != SPECIAL_SEGMENTID);
BOOST_ASSERT(phantom_node_pair.target_phantom.forward_segment_id.id !=
SPECIAL_SEGMENTID);
reverse_heap1.Insert(phantom_node_pair.target_phantom.forward_segment_id.id,
phantom_node_pair.target_phantom.GetForwardWeightPlusOffset(),
phantom_node_pair.target_phantom.forward_segment_id.id);
}
if (phantom_node_pair.target_phantom.reverse_segment_id.enabled)
{
BOOST_ASSERT(phantom_node_pair.target_phantom.reverse_segment_id.id != SPECIAL_SEGMENTID);
BOOST_ASSERT(phantom_node_pair.target_phantom.reverse_segment_id.id !=
SPECIAL_SEGMENTID);
reverse_heap1.Insert(phantom_node_pair.target_phantom.reverse_segment_id.id,
phantom_node_pair.target_phantom.GetReverseWeightPlusOffset(),
phantom_node_pair.target_phantom.reverse_segment_id.id);
@ -308,9 +316,11 @@ class AlternativeRouting final
BOOST_ASSERT(!packed_shortest_path.empty());
raw_route_data.unpacked_path_segments.resize(1);
raw_route_data.source_traversed_in_reverse.push_back(
(packed_shortest_path.front() != phantom_node_pair.source_phantom.forward_segment_id.id));
(packed_shortest_path.front() !=
phantom_node_pair.source_phantom.forward_segment_id.id));
raw_route_data.target_traversed_in_reverse.push_back(
(packed_shortest_path.back() != phantom_node_pair.target_phantom.forward_segment_id.id));
(packed_shortest_path.back() !=
phantom_node_pair.target_phantom.forward_segment_id.id));
super::UnpackPath(
// -- packed input
@ -329,10 +339,12 @@ class AlternativeRouting final
RetrievePackedAlternatePath(forward_heap1, reverse_heap1, forward_heap2, reverse_heap2,
s_v_middle, v_t_middle, packed_alternate_path);
raw_route_data.alt_source_traversed_in_reverse.push_back((
packed_alternate_path.front() != phantom_node_pair.source_phantom.forward_segment_id.id));
raw_route_data.alt_source_traversed_in_reverse.push_back(
(packed_alternate_path.front() !=
phantom_node_pair.source_phantom.forward_segment_id.id));
raw_route_data.alt_target_traversed_in_reverse.push_back(
(packed_alternate_path.back() != phantom_node_pair.target_phantom.forward_segment_id.id));
(packed_alternate_path.back() !=
phantom_node_pair.target_phantom.forward_segment_id.id));
// unpack the alternate path
super::UnpackPath(packed_alternate_path.begin(), packed_alternate_path.end(),
@ -429,9 +441,9 @@ class AlternativeRouting final
// partial unpacking, compute sharing
// First partially unpack s-->v until paths deviate, note length of common path.
const int64_t s_v_min_path_size =
static_cast<int64_t>(std::min(packed_s_v_path.size(), packed_shortest_path.size())) - 1;
for (const int64_t current_node : util::irange<int64_t>(0, s_v_min_path_size))
const auto s_v_min_path_size =
std::min(packed_s_v_path.size(), packed_shortest_path.size()) - 1;
for (const auto current_node : util::irange<std::size_t>(0UL, s_v_min_path_size))
{
if (packed_s_v_path[current_node] == packed_shortest_path[current_node] &&
packed_s_v_path[current_node + 1] == packed_shortest_path[current_node + 1])

View File

@ -244,14 +244,14 @@ class MapMatching final : public BasicRoutingInterface<DataFacadeT, MapMatching<
((haversine_distance + max_distance_delta) * 0.25) * 10;
// compute d_t for this timestamp and the next one
for (const auto s : util::irange<std::size_t>(0u, prev_viterbi.size()))
for (const auto s : util::irange<std::size_t>(0UL, prev_viterbi.size()))
{
if (prev_pruned[s])
{
continue;
}
for (const auto s_prime : util::irange<std::size_t>(0u, current_viterbi.size()))
for (const auto s_prime : util::irange<std::size_t>(0UL, current_viterbi.size()))
{
const double emission_pr = emission_log_probabilities[t][s_prime];
double new_value = prev_viterbi[s] + emission_pr;

View File

@ -227,7 +227,7 @@ class ShortestPathRouting final
raw_route_data.shortest_path_length = shortest_path_length;
for (const auto current_leg : util::irange<std::size_t>(0, packed_leg_begin.size() - 1))
for (const auto current_leg : util::irange<std::size_t>(0UL, packed_leg_begin.size() - 1))
{
auto leg_begin = total_packed_path.begin() + packed_leg_begin[current_leg];
auto leg_end = total_packed_path.begin() + packed_leg_begin[current_leg + 1];

View File

@ -626,7 +626,7 @@ Contractor::WriteContractedGraph(unsigned max_node_id,
int number_of_used_edges = 0;
util::StaticGraph<EdgeData>::EdgeArrayEntry current_edge;
for (const auto edge : util::irange<std::size_t>(0, contracted_edge_list.size()))
for (const auto edge : util::irange<std::size_t>(0UL, contracted_edge_list.size()))
{
// some self-loops are required for oneway handling. Need to assertthat we only keep these
// (TODO)

View File

@ -168,7 +168,7 @@ Status MatchPlugin::HandleRequest(const api::MatchParameters &parameters,
}
std::vector<InternalRouteResult> sub_routes(sub_matchings.size());
for (auto index : util::irange(0UL, sub_matchings.size()))
for (auto index : util::irange<std::size_t>(0UL, sub_matchings.size()))
{
BOOST_ASSERT(sub_matchings[index].nodes.size() > 1);

View File

@ -544,7 +544,7 @@ void Extractor::BuildRTree(std::vector<EdgeBasedNode> node_based_edge_list,
// Filter node based edges based on startpoint
auto out_iter = node_based_edge_list.begin();
auto in_iter = node_based_edge_list.begin();
for (auto index : util::irange<std::size_t>(0, node_is_startpoint.size()))
for (auto index : util::irange<std::size_t>(0UL, node_is_startpoint.size()))
{
BOOST_ASSERT(in_iter != node_based_edge_list.end());
if (node_is_startpoint[index])