Boost logo

Boost :

Subject: Re: [boost] Is Boost.Range broken?
From: Dave Handley (dave_at_[hidden])
Date: 2008-11-21 19:41:49


<snip>
>
> I'll let Tomas answer for himself fully. But in short:
>
> You used to be able to call member functions on default-constructed
> iterator_ranges, now you cannot. [Apologies for the hard-coded paths in
> the
> following code]:
>
> ---
>
> //#include "c:/boost/boost_1_34_0/boost/range/iterator_range.hpp"
> #include "c:/boost/boost_1_36_0/boost/range/iterator_range.hpp"
>
> #include <vector>
> #include <iostream>
> #include <cstddef>
>
> int main()
> {
> boost::iterator_range< std::vector<int>::const_iterator> r;
>
> bool b1 = r.empty(); //returns true in 1.34,
> //asserts in debug 1.35+, undefined
> behaviour in release
> std::size_t b2 = r.size(); //returns 0 in 1.34 ,
> //asserts in debug 1.35+, undefined
> behaviour in release
>
> std::cout << "\n\n" << b1 << b2 << "\n\n";
> }
>

Furthermore, the following code changes have occured:

boost::iterator_range<std::vector<int>::const_iterator> r;
bool b1 = r.is_singular(); // returns true in 1.34 and debug 1.35. Returns
false in release 1.35

Look at this code (copied directly from boost::iterator_range 1.37):

            bool is_singular() const
            {
                 #ifndef NDEBUG
                 return singular;
                 #else
                 return false;
                 #endif
            }

Taken from the iterator_range class. IMHO this is broken, the functionality
changes between debug and release in 1.35, as well as changing from 1.34 to
1.35. The assertions occur in virtually all the interface functions.

Dave


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