Use std::ranges::subrange instead of boost::iterator_range
This commit is contained in:
parent
8671fa7272
commit
2faaeb7756
@ -100,9 +100,9 @@ class CellCustomizer
|
|||||||
distances.front() =
|
distances.front() =
|
||||||
inserted ? heap.GetData(destination).distance : INVALID_EDGE_DISTANCE;
|
inserted ? heap.GetData(destination).distance : INVALID_EDGE_DISTANCE;
|
||||||
|
|
||||||
weights.advance_begin(1);
|
weights.advance(1);
|
||||||
durations.advance_begin(1);
|
durations.advance(1);
|
||||||
distances.advance_begin(1);
|
distances.advance(1);
|
||||||
}
|
}
|
||||||
BOOST_ASSERT(weights.empty());
|
BOOST_ASSERT(weights.empty());
|
||||||
BOOST_ASSERT(durations.empty());
|
BOOST_ASSERT(durations.empty());
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
#include <boost/iterator/iterator_facade.hpp>
|
#include <boost/iterator/iterator_facade.hpp>
|
||||||
#include <boost/range/iterator_range.hpp>
|
#include <boost/range/iterator_range.hpp>
|
||||||
|
#include <ranges>
|
||||||
#include <tbb/parallel_sort.h>
|
#include <tbb/parallel_sort.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
@ -128,19 +128,19 @@ template <storage::Ownership Ownership> class CellStorageImpl
|
|||||||
|
|
||||||
friend class ::boost::iterator_core_access;
|
friend class ::boost::iterator_core_access;
|
||||||
ValuePtrT current;
|
ValuePtrT current;
|
||||||
const std::size_t stride;
|
std::size_t stride;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename ValuePtr> auto GetOutRange(const ValuePtr ptr, const NodeID node) const
|
template <typename ValuePtr> auto GetOutRange(const ValuePtr ptr, const NodeID node) const
|
||||||
{
|
{
|
||||||
auto iter = std::find(source_boundary, source_boundary + num_source_nodes, node);
|
auto iter = std::find(source_boundary, source_boundary + num_source_nodes, node);
|
||||||
if (iter == source_boundary + num_source_nodes)
|
if (iter == source_boundary + num_source_nodes)
|
||||||
return boost::make_iterator_range(ptr, ptr);
|
return std::ranges::subrange(ptr, ptr);
|
||||||
|
|
||||||
auto row = std::distance(source_boundary, iter);
|
auto row = std::distance(source_boundary, iter);
|
||||||
auto begin = ptr + num_destination_nodes * row;
|
auto begin = ptr + num_destination_nodes * row;
|
||||||
auto end = begin + num_destination_nodes;
|
auto end = begin + num_destination_nodes;
|
||||||
return boost::make_iterator_range(begin, end);
|
return std::ranges::subrange(begin, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename ValuePtr> auto GetInRange(const ValuePtr ptr, const NodeID node) const
|
template <typename ValuePtr> auto GetInRange(const ValuePtr ptr, const NodeID node) const
|
||||||
@ -148,14 +148,14 @@ template <storage::Ownership Ownership> class CellStorageImpl
|
|||||||
auto iter =
|
auto iter =
|
||||||
std::find(destination_boundary, destination_boundary + num_destination_nodes, node);
|
std::find(destination_boundary, destination_boundary + num_destination_nodes, node);
|
||||||
if (iter == destination_boundary + num_destination_nodes)
|
if (iter == destination_boundary + num_destination_nodes)
|
||||||
return boost::make_iterator_range(ColumnIterator<ValuePtr>{},
|
return std::ranges::subrange(ColumnIterator<ValuePtr>{},
|
||||||
ColumnIterator<ValuePtr>{});
|
ColumnIterator<ValuePtr>{});
|
||||||
|
|
||||||
auto column = std::distance(destination_boundary, iter);
|
auto column = std::distance(destination_boundary, iter);
|
||||||
auto begin = ColumnIterator<ValuePtr>{ptr + column, num_destination_nodes};
|
auto begin = ColumnIterator<ValuePtr>{ptr + column, num_destination_nodes};
|
||||||
auto end = ColumnIterator<ValuePtr>{
|
auto end = ColumnIterator<ValuePtr>{
|
||||||
ptr + column + num_source_nodes * num_destination_nodes, num_destination_nodes};
|
ptr + column + num_source_nodes * num_destination_nodes, num_destination_nodes};
|
||||||
return boost::make_iterator_range(begin, end);
|
return std::ranges::subrange(begin, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -173,13 +173,13 @@ template <storage::Ownership Ownership> class CellStorageImpl
|
|||||||
|
|
||||||
auto GetSourceNodes() const
|
auto GetSourceNodes() const
|
||||||
{
|
{
|
||||||
return boost::make_iterator_range(source_boundary, source_boundary + num_source_nodes);
|
return std::ranges::subrange(source_boundary, source_boundary + num_source_nodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto GetDestinationNodes() const
|
auto GetDestinationNodes() const
|
||||||
{
|
{
|
||||||
return boost::make_iterator_range(destination_boundary,
|
return std::ranges::subrange(destination_boundary,
|
||||||
destination_boundary + num_destination_nodes);
|
destination_boundary + num_destination_nodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
CellImpl(const CellData &data,
|
CellImpl(const CellData &data,
|
||||||
|
@ -148,8 +148,8 @@ void relaxOutgoingEdges(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
++destination;
|
++destination;
|
||||||
shortcut_durations.advance_begin(1);
|
shortcut_durations.advance(1);
|
||||||
shortcut_distances.advance_begin(1);
|
shortcut_distances.advance(1);
|
||||||
}
|
}
|
||||||
BOOST_ASSERT(shortcut_durations.empty());
|
BOOST_ASSERT(shortcut_durations.empty());
|
||||||
BOOST_ASSERT(shortcut_distances.empty());
|
BOOST_ASSERT(shortcut_distances.empty());
|
||||||
@ -169,8 +169,8 @@ void relaxOutgoingEdges(
|
|||||||
if (shortcut_weight != INVALID_EDGE_WEIGHT && heapNode.node != to)
|
if (shortcut_weight != INVALID_EDGE_WEIGHT && heapNode.node != to)
|
||||||
{
|
{
|
||||||
const auto to_weight = heapNode.weight + shortcut_weight;
|
const auto to_weight = heapNode.weight + shortcut_weight;
|
||||||
const auto to_duration = heapNode.data.duration + shortcut_durations.front();
|
const auto to_duration = heapNode.data.duration + *shortcut_durations.begin();
|
||||||
const auto to_distance = heapNode.data.distance + shortcut_distances.front();
|
const auto to_distance = heapNode.data.distance + *shortcut_distances.begin();
|
||||||
const auto toHeapNode = query_heap.GetHeapNodeIfWasInserted(to);
|
const auto toHeapNode = query_heap.GetHeapNodeIfWasInserted(to);
|
||||||
if (!toHeapNode)
|
if (!toHeapNode)
|
||||||
{
|
{
|
||||||
@ -189,8 +189,8 @@ void relaxOutgoingEdges(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
++source;
|
++source;
|
||||||
shortcut_durations.advance_begin(1);
|
shortcut_durations.advance(1);
|
||||||
shortcut_distances.advance_begin(1);
|
shortcut_distances.advance(1);
|
||||||
}
|
}
|
||||||
BOOST_ASSERT(shortcut_durations.empty());
|
BOOST_ASSERT(shortcut_durations.empty());
|
||||||
BOOST_ASSERT(shortcut_distances.empty());
|
BOOST_ASSERT(shortcut_distances.empty());
|
||||||
|
Loading…
Reference in New Issue
Block a user