Boost logo

Boost :

Subject: [boost] [range] [1.40] iterator_range::size broken for non-random access iterators
From: Ryan Gallagher (ryan.gallagher_at_[hidden])
Date: 2009-08-21 15:52:03

We were just upgrading from 1.34.1 to 1.39.0 and I ran into this
issue which I note is still in the trunk (and I would assume the
1.40 candidate).

The definition of iterator_range::size is using operator- where
it should be using std::distance as it did in boost 1.34 days:

difference_type size() const
   BOOST_ASSERT( !is_singular() );
   return m_End - m_Begin;

It used to be:

                return std::distance<IteratorT>( m_Begin, m_End );
                return std::distance( m_Begin, m_End );

I'm not sure why it would have changed but it's no longer working with
bi-directional iterators, etc. Can we put back the old version?
Can we get this fixed for 1.40? Thanks,


Boost list run by bdawes at, gregod at, cpdaniel at, john at