Boost logo

Boost Users :

From: Bill Buklis (boostuser_at_[hidden])
Date: 2006-01-23 17:09:34


Is this a bug or am I expecting it to do something that it shouldn't?
Does anyone know a workaround for this (at least temporarily)?

Compiler: VC 7.1
boost: 1.33.0

Description:
  The "base" function for reverse iterators in the pointer container classes

do not return the underlying iterator type as expected. It appears that
"base" returns a reverse iterator instead. This is not specific with
ptr_vector. All the pointer containers seem to have this problem.

#include <boost/ptr_container/ptr_vector.hpp>

void sample()
{
  // the type of the vector does not matter for this
  typedef boost::ptr_vector<DWORD> boostvector;
  boostvector boostvec;

  boostvector::reverse_iterator rboostIt = boostvec.rbegin();

  // The following line does NOT compile.
  boostvector::iterator boostIt = rboostIt.base();

  // For comparison of code that DOES compile
  typedef std::vector<DWORD> stdvector;
  stdvector stdvec;

  stdvector::reverse_iterator rstdIt = stdvec.rbegin();

  // The following line DOES compile.
  stdvector::iterator stdIt = rstdIt.base();
}


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net