Boost logo

Boost :

Subject: Re: [boost] [container] stable_vector::back() is broken in Boost 1.53
From: Cromwell Enage (sponage_at_[hidden])
Date: 2013-04-07 10:11:28


Stefan Strasser wrote: > Zitat von Klaim - Joël Lamotte wrote: > > So it's a VS only bug... > > Someone confirmed the bug in the ticket but say it's fixed in trunk. > > it must fail on all compilers using 1.53, as it's because of out-of-bounds vector access. > is it intentional that container::vector::operator[] doesn't assert n < size()? > would have caught this bug. The trunk version works for me on the Darwin toolset (MacOSX gcc).  I wrote a different test program: #include <boost/utility.hpp> #include <boost/container/stable_vector.hpp> #include <boost/test/minimal.hpp> int test_main(int argc, char** argv) {     boost::container::stable_vector<int> values;     values.emplace_back(42);     boost::container::stable_vector<int>::const_iterator value_itr = (         values.begin()     );     int const& value_at = values.at(0);     int const& indexed_value = values[0];     int const& back_value = values.back();     BOOST_CHECK(boost::addressof(*value_itr) == boost::addressof(value_at));     BOOST_CHECK(         boost::addressof(*value_itr) == boost::addressof(indexed_value)     );     BOOST_CHECK(boost::addressof(*value_itr) == boost::addressof(back_value));     BOOST_CHECK(boost::addressof(value_at) == boost::addressof(indexed_value));     BOOST_CHECK(boost::addressof(value_at) == boost::addressof(back_value));     BOOST_CHECK(         boost::addressof(indexed_value) == boost::addressof(back_value)     );     return 0; } HTH, Cromwell D. Enage


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