Use std::ranges::subrange instead of boost::iterator_range
This commit is contained in:
parent
8ae9abaa63
commit
01ab85192f
@ -14,7 +14,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
#include <ranges>
|
||||
|
||||
namespace osrm::engine::guidance
|
||||
{
|
||||
@ -220,14 +220,14 @@ inline auto RouteStep::LanesToTheLeft() const
|
||||
{
|
||||
const auto &description = intersections.front().lane_description;
|
||||
LaneID num_lanes_left = NumLanesToTheLeft();
|
||||
return boost::make_iterator_range(description.begin(), description.begin() + num_lanes_left);
|
||||
return std::ranges::subrange(description.begin(), description.begin() + num_lanes_left);
|
||||
}
|
||||
|
||||
inline auto RouteStep::LanesToTheRight() const
|
||||
{
|
||||
const auto &description = intersections.front().lane_description;
|
||||
LaneID num_lanes_right = NumLanesToTheRight();
|
||||
return boost::make_iterator_range(description.end() - num_lanes_right, description.end());
|
||||
return std::ranges::subrange(description.end() - num_lanes_right, description.end());
|
||||
}
|
||||
|
||||
} // namespace osrm::engine::guidance
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include <algorithm>
|
||||
#include <cctype>
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
namespace osrm::extractor
|
||||
{
|
||||
|
@ -26,7 +26,7 @@ template <typename RestrictionFilter> class NodeRestrictionMap
|
||||
// Find all restrictions applicable to (from,via,*) turns
|
||||
auto Restrictions(NodeID from, NodeID via) const
|
||||
{
|
||||
return getRange(from, via) | boost::adaptors::filtered(index_filter);
|
||||
return getRange(from, via) | std::views::filter(index_filter);
|
||||
};
|
||||
|
||||
// Find all restrictions applicable to (from,via,to) turns
|
||||
@ -34,7 +34,7 @@ template <typename RestrictionFilter> class NodeRestrictionMap
|
||||
{
|
||||
const auto turnFilter = [this, to](const auto &restriction)
|
||||
{ return index_filter(restriction) && restriction->IsTurnRestricted(to); };
|
||||
return getRange(from, via) | boost::adaptors::filtered(turnFilter);
|
||||
return getRange(from, via) | std::views::filter(turnFilter);
|
||||
};
|
||||
|
||||
private:
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include "util/node_based_graph.hpp"
|
||||
#include "util/std_hash.hpp"
|
||||
#include "util/typedefs.hpp"
|
||||
|
||||
#include <ranges>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace osrm::extractor
|
||||
@ -102,9 +102,9 @@ struct RestrictionGraph
|
||||
friend restriction_graph_details::transferBuilder;
|
||||
friend RestrictionGraph constructRestrictionGraph(const std::vector<TurnRestriction> &);
|
||||
|
||||
using EdgeRange = boost::iterator_range<std::vector<RestrictionEdge>::const_iterator>;
|
||||
using EdgeRange = std::ranges::subrange<std::vector<RestrictionEdge>::const_iterator>;
|
||||
using RestrictionRange =
|
||||
boost::iterator_range<std::vector<const TurnRestriction *>::const_iterator>;
|
||||
std::ranges::subrange<std::vector<const TurnRestriction *>::const_iterator>;
|
||||
using EdgeKey = std::pair<NodeID, NodeID>;
|
||||
|
||||
// Helper functions for iterating over node restrictions and edges
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
#include <boost/iterator/filter_iterator.hpp>
|
||||
#include <boost/iterator/iterator_facade.hpp>
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
#include <ranges>
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
@ -40,7 +40,7 @@ class BisectionGraphView
|
||||
// Iteration over all nodes (direct access into the node)
|
||||
ConstNodeIterator Begin() const;
|
||||
ConstNodeIterator End() const;
|
||||
auto Nodes() const { return boost::make_iterator_range(begin, end); }
|
||||
auto Nodes() const { return std::ranges::subrange(begin, end); }
|
||||
|
||||
// Re-Construct the ID of a node from a reference
|
||||
NodeID GetID(const NodeT &node) const;
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include "util/msb.hpp"
|
||||
|
||||
#include <boost/iterator/iterator_facade.hpp>
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
#include <ranges>
|
||||
|
||||
namespace osrm::util
|
||||
{
|
||||
@ -88,7 +88,7 @@ class BitIterator : public boost::iterator_facade<BitIterator<DataT>,
|
||||
// Returns range over all 1 bits of value
|
||||
template <typename T> auto makeBitRange(const T value)
|
||||
{
|
||||
return boost::make_iterator_range(BitIterator<T>{value}, BitIterator<T>{});
|
||||
return std::ranges::subrange(BitIterator<T>{value}, BitIterator<T>{});
|
||||
}
|
||||
} // namespace osrm::util
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include "engine/routing_algorithms/routing_base_ch.hpp"
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/range/iterator_range_core.hpp>
|
||||
#include <ranges>
|
||||
|
||||
#include <limits>
|
||||
#include <memory>
|
||||
@ -106,7 +106,7 @@ void forwardRoutingStep(const DataFacade<Algorithm> &facade,
|
||||
search_space_with_buckets.end(),
|
||||
heapNode.node,
|
||||
NodeBucket::Compare());
|
||||
for (const auto ¤t_bucket : boost::make_iterator_range(bucket_list))
|
||||
for (const auto ¤t_bucket : std::ranges::subrange(bucket_list.first, bucket_list.second))
|
||||
{
|
||||
// Get target id from bucket entry
|
||||
const auto column_index = current_bucket.column_index;
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include "engine/routing_algorithms/routing_base_mld.hpp"
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/range/iterator_range_core.hpp>
|
||||
#include <ranges>
|
||||
|
||||
#include <limits>
|
||||
#include <memory>
|
||||
@ -428,7 +428,7 @@ void forwardRoutingStep(const DataFacade<Algorithm> &facade,
|
||||
search_space_with_buckets.end(),
|
||||
heapNode.node,
|
||||
NodeBucket::Compare());
|
||||
for (const auto ¤t_bucket : boost::make_iterator_range(bucket_list))
|
||||
for (const auto ¤t_bucket : std::ranges::subrange(bucket_list.first, bucket_list.second))
|
||||
{
|
||||
// Get target id from bucket entry
|
||||
const auto column_idx = current_bucket.column_index;
|
||||
|
@ -968,11 +968,8 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
|
||||
buffer->continuous_data.push_back(edge_with_data);
|
||||
|
||||
// get conditional restrictions that apply to this turn
|
||||
const auto &restrictions =
|
||||
conditional_node_restriction_map.Restrictions(
|
||||
incoming_edge.node,
|
||||
outgoing_edge.node,
|
||||
outgoing_edge_target);
|
||||
auto restrictions = conditional_node_restriction_map.Restrictions(
|
||||
incoming_edge.node, outgoing_edge.node, outgoing_edge_target);
|
||||
for (const auto &restriction : restrictions)
|
||||
{
|
||||
buffer->conditionals.push_back(
|
||||
|
@ -424,13 +424,11 @@ double findEdgeLength(const IntersectionEdgeGeometries &geometries, const EdgeID
|
||||
}
|
||||
|
||||
template <typename RestrictionsRange>
|
||||
bool isTurnRestricted(const RestrictionsRange &restrictions, const NodeID to)
|
||||
bool isTurnRestricted(RestrictionsRange restrictions, const NodeID to)
|
||||
{
|
||||
// Check if any of the restrictions would prevent a turn to 'to'
|
||||
return std::any_of(restrictions.begin(),
|
||||
restrictions.end(),
|
||||
[&to](const auto &restriction)
|
||||
{ return restriction->IsTurnRestricted(to); });
|
||||
return std::ranges::any_of(
|
||||
restrictions, [&to](const auto &restriction) { return restriction->IsTurnRestricted(to); });
|
||||
}
|
||||
|
||||
bool isTurnAllowed(const util::NodeBasedDynamicGraph &graph,
|
||||
|
@ -276,16 +276,16 @@ RestrictionGraph constructRestrictionGraph(const std::vector<TurnRestriction> &t
|
||||
RestrictionGraph::RestrictionRange RestrictionGraph::GetRestrictions(RestrictionID id) const
|
||||
{
|
||||
const auto &node = nodes[id];
|
||||
return boost::make_iterator_range(restrictions.begin() + node.restrictions_begin_idx,
|
||||
restrictions.begin() + node.restrictions_begin_idx +
|
||||
node.num_restrictions);
|
||||
return std::ranges::subrange(restrictions.begin() + node.restrictions_begin_idx,
|
||||
restrictions.begin() + node.restrictions_begin_idx +
|
||||
node.num_restrictions);
|
||||
}
|
||||
|
||||
RestrictionGraph::EdgeRange RestrictionGraph::GetEdges(RestrictionID id) const
|
||||
{
|
||||
const auto &node = nodes[id];
|
||||
return boost::make_iterator_range(edges.begin() + node.edges_begin_idx,
|
||||
edges.begin() + node.edges_begin_idx + node.num_edges);
|
||||
return std::ranges::subrange(edges.begin() + node.edges_begin_idx,
|
||||
edges.begin() + node.edges_begin_idx + node.num_edges);
|
||||
}
|
||||
|
||||
} // namespace osrm::extractor
|
||||
|
Loading…
Reference in New Issue
Block a user