Boost logo

Boost :

Subject: Re: [boost] bug in boost::container ??
From: Daniel James (daniel_at_[hidden])
Date: 2013-04-18 10:45:27


On 18 April 2013 15:36, Antony Polukhin <antoshkka_at_[hidden]> wrote:
> 2013/4/18 Olaf Peter <ope-devel_at_[hidden]>:
>> Hi,
>>
>> the attached example confuses me, I've got:
>>
>> $ g++ -Wall boost_container_bug.cpp -o boost_container_bug &&
>> ./boost_container_bug
>> (size=4 [1, 2, 3, 4, 0, 4])
>
> On MSVC11 with boost 1.53 outputs:
> (size=4 [1, 2, 3, 4])
>
> What version of boost are you using?

The bug is in trunk. See the definition of operator- in:

https://svn.boost.org/trac/boost/changeset/83126/trunk/boost/container/vector.hpp

Should be trivial to fix. A workaround is to use "end() + (-1)"
instead of "end() - 1".


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