Problem
I want to create a range from two iterators returned by a function.
I used the answer to a related question to create a new subrange using range-v3:
auto [it1, it2] = out_edges(u, _graph);
return ranges::subrange(it1, it2) | ranges::views::transform([](auto it){return it->target();});
But my compiler tells me: error: no viable constructor or deduction guide for deduction of template arguments of 'subrange'
I don't understand the error and do not know how I am supposed to define the required deduction guide.
Iterator type
The iterator type is the following:
class out_edge_iterator
: public boost::iterator_adaptor<out_edge_iterator,
vertex_descriptor const *,
edge_descriptor,
forward_traversal_tag,
edge_descriptor>
{
vertex_descriptor const *last;
vertex_descriptor source;
public:
out_edge_iterator(Vertex const *first, Vertex const *last, Vertex source)
: out_edge_iterator::iterator_adaptor_(first), last(last),
source(source)
{
BOOST_ASSERT(source != null_vertex());
post_increment();
}
private:
edge_descriptor dereference() const
{
return edge_descriptor(source, *this->base_reference());
}
void post_increment()
{
while (this->base_reference() != last
&& *this->base_reference() == null_vertex())
{
this->base_reference()++;
}
}
void increment()
{
this->base_reference()++;
post_increment();
}
friend class boost::iterator_core_access;
};
Config:
- OS Macos Ventura M1.
- Apple clang version 14.0.3 (clang-1403.0.22.14.1)
- Target: arm64-apple-darwin22.5.0
- Thread model: posix
- range-v3 version 0.12.0
- C++20