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@lists.boost.org> 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@lists.boost.org > https://lists.boost.org/mailman/listinfo.cgi/boost-users >
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org https://lists.boost.org/mailman/listinfo.cgi/boost-users