Boost logo

Boost :

From: Stjepan Rajko (stipe_at_[hidden])
Date: 2008-04-23 21:10:29


On Wed, Apr 23, 2008 at 1:22 PM, Stjepan Rajko <stipe_at_[hidden]> wrote:
> Hello,
>
> I've been finding the circular_buffer library very helpful (thanks for
> a great lib!), but recently found the following behavior surprising
> (this is using a recent svn trunk, if it matters):
>
> boost::circular_buffer<int> one(3);
> boost::circular_buffer<int> two(one);
>
> std::cout<<one.capacity()<<std::endl; // outputs 3
> std::cout<<two.capacity()<<std::endl; // outputs 0, I was expecting 3
>
> Why does the copy constructor not copy the capacity? It seems like
> capacity is an essential property of circular_buffer, and as such I'd
> expect it to be copied as a part of copy construction.
>

After looking at the code, it looks like this is a bug. I submitted a
ticket with a guess at a patch:
http://svn.boost.org/trac/boost/ticket/1852

Stjepan


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