Robert Dailey wrote:
On Wed, Sep 17, 2008 at 6:21 AM, Daniel Krügler
wrote: I guess you want:
<snip>
Alternatively you could do this:
<snip>
Well I don't want to return by value, and I most certainly don't want to return a const reference (Since this Pass object must be mutable). For now I did a const_cast in the dereference() function and now I'm returning a non-const reference.
If there is no solution to this, then this is broken. Any chance boost can fix this? I really don't think it makes much since for constness to be an issue here when I never designed my iterator to be const to begin with.
Of-course there exists a solution, but I misunderstood your original request. I think you should declare your member as mutable, which is the safest way here. If you would use const_cast you would land on UB island if someone tries to work with a const PassIterator. - Daniel