
12 Jul
2004
12 Jul
'04
3:18 a.m.
David Abrahams <dave@boost-consulting.com> writes:
I'm getting ready to fix the issues we've discussed with postfix ++ (and by extension, --) in iterator_facade. Basically, the current implementation works for forward iterators but not for some input iterators:
{ self x = *this; ++*this; // <== here return x; }
The problem is that for many input iterators, all copies reference the same element. The marked line increments the iterator, which causes the current element of the sequence to be skipped, so
*a++
yields the /next/ element. To fix that, a++ needs to return a proxy type.
Fixed now in CVS, along with new tests. -- Dave Abrahams Boost Consulting http://www.boost-consulting.com