Boost logo

Boost Users :

Subject: [Boost-users] boost::iterator_facade and assignment operation
From: Arun Ramasamy (aramasamy_at_[hidden])
Date: 2011-10-12 09:17:19

I'm using the boost iterator_facade class to implement a random access
iterator for my class. When I try to assign the iterators to one
another, the compiler fails saying

'operator =' function is unavailable".

Sample code from my implementation below:

|class MyClass{
     class Iterator : public boost::iterator_facade<Iterator, T,
boost::bidirectional_traversal_tag>{ protected:
         void increment();
         bool equal(const Iterator& rhs)const; //etc
|| //... Note - no method implemented to support assignment |
| }

I'd assumed that it'll be possible to assign iterators to each other.
Why is the assignment operator not supported by iterator_facade. It
implements other operations (like ++ and ==)by making the derived
version implement private methods (like increment and equal). Am I
missing something. The boost documentation doesn't mention why this is
not supported.

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