Boost logo

Boost Users :

Subject: [Boost-users] iterator_facade and distance()
From: Andrej van der Zee (andrejvanderzee_at_[hidden])
Date: 2011-04-15 20:55:31


I am trying to implement an iterator using boost::iterator_facade. It
works fine but it is very slow, I think because the distance()
function takes lineair time as it is seems to be implemented in terms
of increment(). I would like to implement the distance() function
myself but I am not sure how. I tried to implement distance_to() like

 class const_data_stream_iterator :
    public boost::iterator_facade<const_data_stream_iterator,
    char const,

      typedef boost::iterator_facade<const_data_stream_iterator, char
const, boost::forward_traversal_tag> facade_t;


      friend class boost::iterator_core_access;

difference_to(const_data_stream_iterator & to) const

But this does not work. How can I do this?

Thank you,

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at