|
Boost Users : |
From: Andreas Rose (pirx_at_[hidden])
Date: 2007-02-28 14:49:43
Hello,
I'm new to circular_buffer. After reading the documentation i expect the
following should work:
const int c = 5;
boost::circular_buffer<int> cb1(c);
assert(cb1.capacity() == c);
boost::circular_buffer<int> cb2(cb1);
assert(cb2.capacity() == c); //failed, capacity() returns 0
But it does'nt work. After looking into the code of circular_buffer, i
think the copy c'tor should be changed into something like this:
circular_buffer(const circular_buffer<T, Alloc>& cb)
: m_size(cb.size()), m_alloc(cb.get_allocator()) {
initialize(cb.capacity());
BOOST_TRY {
cb_details::uninitialized_copy(cb.begin(), cb.end(), m_buff, m_alloc);
} BOOST_CATCH(...) {
deallocate(m_buff, cb.capacity());
BOOST_RETHROW
}
BOOST_CATCH_END
}
Or do i missunderstand the documentation?
I'm using vs2003 and the latest version of circular_buffer from
boost-sandbox in ordinary debug mode.
Thanks.
Andreas Rose
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net