diff --git a/include/boost/pending/iterator_adaptors.hpp b/include/boost/pending/iterator_adaptors.hpp index a2f394d..f454d10 100644 --- a/include/boost/pending/iterator_adaptors.hpp +++ b/include/boost/pending/iterator_adaptors.hpp @@ -235,7 +235,7 @@ namespace detail { return &(*i); } - // Dummy version for iterators that don't support member access + // Dummy version for non-random access iterators template inline void advance_impl(Iter&, Diff, Cat) { } @@ -250,6 +250,21 @@ namespace detail { #endif } + // Dummy version for non-bidirectional iterators + template + inline void decrement_impl(Iter&, Cat) { } + + // Real version + template + inline typename Iter::pointer + decrement_impl(Iter& i, std::bidirectional_iterator_tag) { +#ifdef __MWERKS__ + i.policies().decrement(i.iter()); +#else + i.policies().decrement(i.iter()); +#endif + } + } // namespace detail //============================================================================ @@ -336,11 +351,7 @@ public: Self operator++(int) { Self tmp(*this); ++*this; return tmp; } Self& operator--() { -#ifdef __MWERKS__ - policies().decrement(iter()); -#else - policies().decrement(iter()); -#endif + detail::decrement_impl(*this, iterator_category()); return *this; }