Hello *!
I defined a custom bidi-iterator and assumed it was going to support std::advance(iterator, Difference n), where n can be negative for random access and bidirectional iterators.
The definition of my iterator's facade base looks like:
struct my_iter
: boost::iterator_facade
< my_iter
, const byte
, boost::bidirectional_traversal_tag
, const byte
>
{
// some impl stuff follows...
};
My tests show that calling:
advance(instance_of_my_iter, N) works fine (increment implementation is called)
advance(instance_of_my_iter, -N) does not work, because increment (instead of decrement) is called as well
For the advance implementation is stated there that it is only gets called for Random Access Iterators. C++ Standard clearly defines that N-Parameter to std::advance can be negative to random access and bidi iterators. Implementing void advance member in my_iter still results in the call to increment member. Can someone give me any suggestions or is it a bug in the iterator lib?
My compiler is gcc 4.3 under Debian Linux with Kernal 2.6.26. and Boost 1.42.
With Kind Regards,
Ovanes