Boost logo

Boost :

From: John Maddock (john_maddock_at_[hidden])
Date: 2002-05-24 06:15:38


OK the changes have been undone, and the docs updated to remove the
references to reverse_iterator.

> The main problem concerned std::reverse_iterator. After porting to
> boost.config we usually distinguish MSVC and non MSVC environments
regarding
> iterators in the following way:
>
> #ifdef BOOST_MSVC_STD_ITERATOR
>
> template <class I, class T, class R>
> class reverse_iterator:
> public std::reverse_iterator<I, T, R> {
> ...
> };
>
> #else
>
> template <class I>
> class reverse_iterator:
> public std::reverse_iterator<I> {
> ...
> };
>
> #endif
>
> This failed for one of our users with MSVC 6.0 and STL-Port 4.5.3. After
> some investigation I found the following defininition in _iterator_old.h:

You could use:

#if defined(BOOST_MSVC_STD_ITERATOR)\
  || defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)

However, that doesn't work for vc7 which has a conforming signature for
reverse_iterator but no partial specialisation support (so it doesn't work
with pointers). If you need to use reverse_iterator with pointers then you
will need to do the same thing that array.hpp does:

#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) &&
!defined(BOOST_MSVC_STD_ITERATOR)
        typedef std::reverse_iterator<iterator> reverse_iterator;
        typedef std::reverse_iterator<const_iterator>
const_reverse_iterator;
#elif defined(BOOST_MSVC) && (BOOST_MSVC == 1300)
        // workaround for broken reverse_iterator in VC7
        typedef std::reverse_iterator<std::_Ptrit<value_type,
difference_type, iterator,
                                      reference, iterator, reference> >
reverse_iterator;
        typedef std::reverse_iterator<std::_Ptrit<value_type,
difference_type, const_iterator,
                                  const_reference, iterator, reference> >
const_reverse_iterator;
#else
        // workaround for broken reverse_iterator implementations
        typedef std::reverse_iterator<iterator,T> reverse_iterator;
        typedef std::reverse_iterator<const_iterator,T>
const_reverse_iterator;
#endif

Regards,

John Maddock
http://ourworld.compuserve.com/homepages/john_maddock/index.htm


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk