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


HI,
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.
Thanks
AR



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