Boost Graph - adjacency_list in_edge_iterator are only input_iterator_tag?
Nic via Boost-users <[email protected]> Fri, 3 May 2024 12:48:46 -0700
| Newsgroups | gmane.comp.lib.boost.user |
|---|---|
| Message-ID | <CAGF0bkoNtyjigvhAHCs7+C4cg5Uv5TYq_rmkUvwe-CjrW5C5ag@mail.gmail.com> |
Hi,
Hopefully this is the right place for this. This with Boost 1.81.0 It looks
like boost::adjacency_list's in_edge_iterator, out_edge_iterator, and for
bidirectional graphs also edge_iterator all are only input iterators.
This seems a bit restrictive, and is regardless of the type of EdgeList
template parameter. For example, this code (which seems a relatively
reasonable thing to want to do) doesn't work:
https://godbolt.org/z/n3PdEYo49
It doesn't work because transform_view doesn't define iterator_category if
the iterator is not at least a forward iterator (I'm a bit confused as to
why that is, but that's not a boost-related thing).
I did some digging and found out why the iterator is always an input
iterator:
The iterators are defined as following:
template < class BaseIter, class VertexDescriptor, class EdgeDescriptor,
class Difference >
struct in_edge_iter
: iterator_adaptor< in_edge_iter< BaseIter, VertexDescriptor,
EdgeDescriptor, Difference >,
BaseIter, EdgeDescriptor, use_default, EdgeDescriptor, Difference
>
{
// ....
};
EdgeDescriptor is passed in as the reference type, but it is not a
reference so the iterator adaptor always chooses input_iterator_tag for the
iterator_category.
Does anyone know of a workaround, or know if this is the desired behavior
for edge iterators? Am I missing something obvious here?
Thank you very much,
Nicolas Morales
_______________________________________________
Boost-users mailing list
[email protected]
https://lists.boost.org/mailman/listinfo.cgi/boost-users