Boost logo

Boost Users :

From: Jeremy Murphy (jeremy.william.murphy_at_[hidden])
Date: 2024-05-10 06:32:43


It doesn't sound ideal. So is it just missing the & in the list of template
arguments to iterator_adaptor?

Jeremy

On Sun, 5 May 2024 at 09:48, Nic via Boost-users <
boost-users_at_[hidden]> wrote:

> 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
> Boost-users_at_[hidden]
> https://lists.boost.org/mailman/listinfo.cgi/boost-users
>



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net