Boost logo

Boost Users :

Subject: Re: [Boost-users] boost::iterator_facade and assignment operation
From: Dave Abrahams (dave_at_[hidden])
Date: 2011-10-12 10:38:36

on Wed Oct 12 2011, Arun Ramasamy <> wrote:

> 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 is. My first guess is that you have added a data member with a
private operator=, but there isn't enough information in your post to be
sure. I suggest you:

a) reduce the problem to a *minimal* example that demonstrates the

b) post the example and the *full* error message here.

Dave Abrahams
BoostPro Computing

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