Copyright © 2003-2013 Jan Gaspar
Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Table of Contents
A printer-friendly PDF version of this manual is also available.
A Circular Buffer.
The term circular buffer (also called a ring or cyclic buffer) refers to an area in memory which is used to store incoming data. When the buffer is filled, new data is written starting at the beginning of the buffer and overwriting the old.
is a STL compliant container.
It is a kind of sequence similar to std::list or std::deque. It supports random access iterators, constant time insert and erase operations at the beginning or the end of the buffer and interoperability with std algorithms.
especially designed to provide fixed capacity
storage. When its capacity is exhausted, newly inserted elements will cause
elements to be overwritten, either at the beginning or end of the buffer (depending
on what insert operation is used).
allocates memory when created, when the capacity is adjusted explicitly, or
as necessary to accommodate resizing or assign operations.
There is also a
The predictive memory allocation is similar to typical
implementation. Memory is automatically freed as the size of the container
The memory allocation process of the space-optimized circular buffer. The
of the capacity controller represents the minimal guaranteed amount of allocated
memory. The allocated memory will never drop under this value. The default
value of the
set to 0. The
can be set using the constructor parameter
capacity_control or the function
The space-optimized version is, of course, a little slower.
Last revised: August 14, 2019 at 12:10:19 GMT