Opened 6 years ago
Last modified 6 years ago
#12852 new Bugs
Resizing fills the circular buffer
Reported by: | Owned by: | Jan Gaspar | |
---|---|---|---|
Milestone: | To Be Determined | Component: | circular_buffer |
Version: | Boost 1.63.0 | Severity: | Problem |
Keywords: | resize, full | Cc: |
Description
As the following block of code demonstrates, resizing a circular buffer fills it with values and thus full() reports true when one would expect it to be false.
boost::circular_buffer<double> cb(3); std::cout << cb.full() << std::endl; for (auto i : cb) std::cout << i << " "; std::cout << std::endl; cb.resize(4); std::cout << cb.full() << std::endl; for (auto i : cb) std::cout << i << " "; std::cout << std::endl;
Change History (3)
comment:1 by , 6 years ago
comment:2 by , 6 years ago
This is an expected behaviour. What you want is set_capacity() I guess. Please read resize() and set_capacity() documentation.
comment:3 by , 6 years ago
Oh, right. Thanks! The documentation for this library was somewhat difficult to find from its homepage and I had not previously found set_capacity().
Note:
See TracTickets
for help on using tickets.
This is an expected behaviour. What you want is set_capacity() I guess. Please read resize() and set_capacity() documentation.