Boost.Circular_buffer C++ Reference
The type of the elements stored in the circular_buffer.
The allocator type used for all internal memory management.
Circular buffer - a STL compliant container.
Type Requirements TThe T has to be SGIAssignable (SGI STL defined combination of Assignable and CopyConstructible). Moreover T has to be DefaultConstructible if supplied as a default parameter when invoking some of the circular_buffer's methods e.g. insert(iterator pos, const value_type& item = value_type()). And EqualityComparable and/or LessThanComparable if the circular_buffer will be compared with another container.
Type Requirements AllocThe Alloc has to meet the allocator requirements imposed by STL.
Default Allocstd::allocator<T>
For detailed documentation of the circular_buffer visit: http://www.boost.org/libs/circular_buffer/doc/circular_buffer.html The type of this circular_buffer. circular_buffer< T, Alloc >
The type of elements stored in the circular_buffer. boost::container::allocator_traits< Alloc >::value_type
A pointer to an element. boost::container::allocator_traits< Alloc >::pointer
A const pointer to the element. boost::container::allocator_traits< Alloc >::const_pointer
A reference to an element. boost::container::allocator_traits< Alloc >::reference
A const reference to an element. boost::container::allocator_traits< Alloc >::const_reference
The distance type. (A signed integral type used to represent the distance between two iterators.) boost::container::allocator_traits< Alloc >::difference_type
The size type. (An unsigned integral type that can represent any non-negative value of the container's distance type.) boost::container::allocator_traits< Alloc >::size_type
The type of an allocator used in the circular_buffer. Alloc
A const (random access) iterator used to iterate through the circular_buffer. cb_details::iterator< circular_buffer< T, Alloc >, cb_details::const_traits< boost::container::allocator_traits< Alloc > > >
A (random access) iterator used to iterate through the circular_buffer. cb_details::iterator< circular_buffer< T, Alloc >, cb_details::nonconst_traits< boost::container::allocator_traits< Alloc > > >
A const iterator used to iterate backwards through a circular_buffer. boost::reverse_iterator< const_iterator >
An iterator used to iterate backwards through a circular_buffer. boost::reverse_iterator< iterator >
An array range. (A typedef for the std::pair where its first element is a pointer to a beginning of an array and its second element represents a size of the array.) std::pair< pointer, size_type >
A range of a const array. (A typedef for the std::pair where its first element is a pointer to a beginning of a const array and its second element represents a size of the const array.) std::pair< const_pointer, size_type >
The capacity type. (Same as size_type - defined for consistency with the __cbso class. size_type
A type representing the "best" way to pass the value_type to a method. const value_type &
A type representing rvalue from param type. On compilers without rvalue references support this type is the Boost.Moves type used for emulation. value_type &&
allocator_typeGet the allocator.
Exception SafetyNo-throw.
Iterator InvalidationDoes not invalidate any iterators.
ComplexityConstant (in the size of the circular_buffer).
See Also:get_allocator() for obtaining an allocator reference.
The allocator. Nothing.
allocator_type &Get the allocator reference.
Exception SafetyNo-throw.
Iterator InvalidationDoes not invalidate any iterators.
ComplexityConstant (in the size of the circular_buffer).
This method was added in order to optimize obtaining of the allocator with a state, although use of stateful allocators in STL is discouraged.
See Also:get_allocator() const
A reference to the allocator. Nothing.
iteratorGet the iterator pointing to the beginning of the circular_buffer.
Exception SafetyNo-throw.
Iterator InvalidationDoes not invalidate any iterators.
ComplexityConstant (in the size of the circular_buffer).
See Also:end(), rbegin(), rend()
A random access iterator pointing to the first element of the circular_buffer. If the circular_buffer is empty it returns an iterator equal to the one returned by end(). Nothing.
iteratorGet the iterator pointing to the end of the circular_buffer.
Exception SafetyNo-throw.
Iterator InvalidationDoes not invalidate any iterators.
ComplexityConstant (in the size of the circular_buffer).
See Also:begin(), rbegin(), rend()
A random access iterator pointing to the element "one behind" the last element of the circular_buffer. If the circular_buffer is empty it returns an iterator equal to the one returned by begin(). Nothing.
const_iteratorGet the const iterator pointing to the beginning of the circular_buffer.
Exception SafetyNo-throw.
Iterator InvalidationDoes not invalidate any iterators.
ComplexityConstant (in the size of the circular_buffer).
See Also:end() const, rbegin() const, rend() const
A const random access iterator pointing to the first element of the circular_buffer. If the circular_buffer is empty it returns an iterator equal to the one returned by end() const. Nothing.
const_iteratorGet the const iterator pointing to the end of the circular_buffer.
Exception SafetyNo-throw.
Iterator InvalidationDoes not invalidate any iterators.
ComplexityConstant (in the size of the circular_buffer).
See Also:begin() const, rbegin() const, rend() const
A const random access iterator pointing to the element "one behind" the last element of the circular_buffer. If the circular_buffer is empty it returns an iterator equal to the one returned by begin() const const. Nothing.
reverse_iteratorGet the iterator pointing to the beginning of the "reversed" circular_buffer.
Exception SafetyNo-throw.
Iterator InvalidationDoes not invalidate any iterators.
ComplexityConstant (in the size of the circular_buffer).
See Also:rend(), begin(), end()
A reverse random access iterator pointing to the last element of the circular_buffer. If the circular_buffer is empty it returns an iterator equal to the one returned by rend(). Nothing.
reverse_iteratorGet the iterator pointing to the end of the "reversed" circular_buffer.
Exception SafetyNo-throw.
Iterator InvalidationDoes not invalidate any iterators.
ComplexityConstant (in the size of the circular_buffer).
See Also:rbegin(), begin(), end()
A reverse random access iterator pointing to the element "one before" the first element of the circular_buffer. If the circular_buffer is empty it returns an iterator equal to the one returned by rbegin(). Nothing.
const_reverse_iteratorGet the const iterator pointing to the beginning of the "reversed" circular_buffer.
Exception SafetyNo-throw.
Iterator InvalidationDoes not invalidate any iterators.
ComplexityConstant (in the size of the circular_buffer).
See Also:rend() const, begin() const, end() const
A const reverse random access iterator pointing to the last element of the circular_buffer. If the circular_buffer is empty it returns an iterator equal to the one returned by rend() const. Nothing.
const_reverse_iteratorGet the const iterator pointing to the end of the "reversed" circular_buffer.
Exception SafetyNo-throw.
Iterator InvalidationDoes not invalidate any iterators.
ComplexityConstant (in the size of the circular_buffer).
See Also:rbegin() const, begin() const, end() const
A const reverse random access iterator pointing to the element "one before" the first element of the circular_buffer. If the circular_buffer is empty it returns an iterator equal to the one returned by rbegin() const. Nothing.
referencesize_typeThe position of the element. Get the element at the index position.
Exception SafetyNo-throw.
Iterator InvalidationDoes not invalidate any iterators.
ComplexityConstant (in the size of the circular_buffer).
See Also:at()
0 <= index && index < size() A reference to the element at the index position. Nothing.
const_referencesize_typeThe position of the element. Get the element at the index position.
Exception SafetyNo-throw.
Iterator InvalidationDoes not invalidate any iterators.
ComplexityConstant (in the size of the circular_buffer).
See Also:at() const
0 <= index && index < size() A const reference to the element at the index position. Nothing.
referencesize_typeThe position of the element. Get the element at the index position.
Exception SafetyStrong.
Iterator InvalidationDoes not invalidate any iterators.
ComplexityConstant (in the size of the circular_buffer).
See Also:operator[]
A reference to the element at the index position. <code>std::out_of_range</code> when the index is invalid (when index >= size()).
const_referencesize_typeThe position of the element. Get the element at the index position.
Exception SafetyStrong.
Iterator InvalidationDoes not invalidate any iterators.
ComplexityConstant (in the size of the circular_buffer).
See Also:operator[] const
A const reference to the element at the index position. <code>std::out_of_range</code> when the index is invalid (when index >= size()).
referenceGet the first element.
Exception SafetyNo-throw.
Iterator InvalidationDoes not invalidate any iterators.
ComplexityConstant (in the size of the circular_buffer).
See Also:back()
!empty() A reference to the first element of the circular_buffer. Nothing.
referenceGet the last element.
Exception SafetyNo-throw.
Iterator InvalidationDoes not invalidate any iterators.
ComplexityConstant (in the size of the circular_buffer).
See Also:front()
!empty() A reference to the last element of the circular_buffer. Nothing.
const_referenceGet the first element.
Exception SafetyNo-throw.
Iterator InvalidationDoes not invalidate any iterators.
ComplexityConstant (in the size of the circular_buffer).
See Also:back() const
!empty() A const reference to the first element of the circular_buffer. Nothing.
const_referenceGet the last element.
Exception SafetyNo-throw.
Iterator InvalidationDoes not invalidate any iterators.
ComplexityConstant (in the size of the circular_buffer).
See Also:front() const
!empty() A const reference to the last element of the circular_buffer. Nothing.
array_rangeGet the first continuous array of the internal buffer. This method in combination with array_two() can be useful when passing the stored data into a legacy C API as an array. Suppose there is a circular_buffer of capacity 10, containing 7 characters 'a', 'b', ..., 'g' where buff[0] == 'a', buff[1] == 'b', ... and buff[6] == 'g':
circular_buffer<char> buff(10);
The internal representation is often not linear and the state of the internal buffer may look like this:
|e|f|g| | | |a|b|c|d|
end ___^
begin _______^
where |a|b|c|d| represents the "array one", |e|f|g| represents the "array two" and | | | | is a free space.
Now consider a typical C style function for writing data into a file:
int write(int file_desc, char* buff, int num_bytes);
There are two ways how to write the content of the circular_buffer into a file. Either relying on array_one() and array_two() methods and calling the write function twice:
array_range ar = buff.array_one();
write(file_desc, ar.first, ar.second);
ar = buff.array_two();
write(file_desc, ar.first, ar.second);
Or relying on the linearize() method:
write(file_desc, buff.linearize(), buff.size());
Since the complexity of array_one() and array_two() methods is constant the first option is suitable when calling the write method is "cheap". On the other hand the second option is more suitable when calling the write method is more "expensive" than calling the linearize() method whose complexity is linear.
Exception SafetyNo-throw.
Iterator InvalidationDoes not invalidate any iterators.
ComplexityConstant (in the size of the circular_buffer).
In general invoking any method which modifies the internal state of the circular_buffer may delinearize the internal buffer and invalidate the array ranges returned by array_one() and array_two() (and their const versions).
In the case the internal buffer is linear e.g. |a|b|c|d|e|f|g| | | | the "array one" is represented by |a|b|c|d|e|f|g| and the "array two" does not exist (the array_two() method returns an array with the size 0).
See Also:array_two(), linearize()
The array range of the first continuous array of the internal buffer. In the case the circular_buffer is empty the size of the returned array is 0. Nothing.
array_rangeGet the second continuous array of the internal buffer. This method in combination with array_one() can be useful when passing the stored data into a legacy C API as an array.
Exception SafetyNo-throw.
Iterator InvalidationDoes not invalidate any iterators.
ComplexityConstant (in the size of the circular_buffer).
See Also:array_one()
The array range of the second continuous array of the internal buffer. In the case the internal buffer is linear or the circular_buffer is empty the size of the returned array is 0. Nothing.
const_array_rangeGet the first continuous array of the internal buffer. This method in combination with array_two() const can be useful when passing the stored data into a legacy C API as an array.
Exception SafetyNo-throw.
Iterator InvalidationDoes not invalidate any iterators.
ComplexityConstant (in the size of the circular_buffer).
See Also:array_two() const; array_one() for more details how to pass data into a legacy C API.
The array range of the first continuous array of the internal buffer. In the case the circular_buffer is empty the size of the returned array is 0. Nothing.
const_array_rangeGet the second continuous array of the internal buffer. This method in combination with array_one() const can be useful when passing the stored data into a legacy C API as an array.
Exception SafetyNo-throw.
Iterator InvalidationDoes not invalidate any iterators.
ComplexityConstant (in the size of the circular_buffer).
See Also:array_one() const
The array range of the second continuous array of the internal buffer. In the case the internal buffer is linear or the circular_buffer is empty the size of the returned array is 0. Nothing.
pointerLinearize the internal buffer into a continuous array. This method can be useful when passing the stored data into a legacy C API as an array.
Exception SafetyBasic; no-throw if the operations in the Throws section do not throw anything.
Iterator InvalidationInvalidates all iterators pointing to the circular_buffer (except iterators equal to end()); does not invalidate any iterators if the postcondition (the Effect) is already met prior calling this method.
ComplexityLinear (in the size of the circular_buffer); constant if the postcondition (the Effect) is already met.
In general invoking any method which modifies the internal state of the circular_buffer may delinearize the internal buffer and invalidate the returned pointer.
See Also:array_one() and array_two() for the other option how to pass data into a legacy C API; is_linearized(), rotate(const_iterator)
&(*this)[0] < &(*this)[1] < ... < &(*this)[size() - 1] A pointer to the beginning of the array or 0 if empty. <a href="circular_buffer/implementation.html#circular_buffer.implementation.exceptions_of_move_if_noexcept_t">Exceptions of move_if_noexcept(T&).
boolIs the circular_buffer linearized?
Exception SafetyNo-throw.
Iterator InvalidationDoes not invalidate any iterators.
ComplexityConstant (in the size of the circular_buffer).
See Also:linearize(), array_one(), array_two()
true if the internal buffer is linearized into a continuous array (i.e. the circular_buffer meets a condition &(*this)[0] < &(*this)[1] < ... < &(*this)[size() - 1]); false otherwise. Nothing.
voidconst_iteratorThe new beginning. Rotate elements in the circular_buffer. A more effective implementation of std::rotate.
Exception SafetyBasic; no-throw if the circular_buffer is full or new_begin points to begin() or if the operations in the Throws section do not throw anything.
Iterator InvalidationIf m < n invalidates iterators pointing to the last m elements (including new_begin, but not iterators equal to end()) else invalidates iterators pointing to the first n elements; does not invalidate any iterators if the circular_buffer is full.
ComplexityLinear (in (std::min)(m, n)); constant if the circular_buffer is full.
See Also:std::rotate
new_begin is a valid iterator pointing to the circular_buffer except its end. Before calling the method suppose:
m == std::distance(new_begin, end())
n == std::distance(begin(), new_begin)
val_0 == *new_begin, val_1 == *(new_begin + 1), ... val_m == *(new_begin + m)
val_r1 == *(new_begin - 1), val_r2 == *(new_begin - 2), ... val_rn == *(new_begin - n)
then after call to the method:
val_0 == (*this)[0] && val_1 == (*this)[1] && ... && val_m == (*this)[m - 1] && val_r1 == (*this)[m + n - 1] && val_r2 == (*this)[m + n - 2] && ... && val_rn == (*this)[m] See Exceptions of move_if_noexcept(T&).
size_typeGet the number of elements currently stored in the circular_buffer.
Exception SafetyNo-throw.
Iterator InvalidationDoes not invalidate any iterators.
ComplexityConstant (in the size of the circular_buffer).
See Also:capacity(), max_size(), reserve(), resize(size_type, const_reference)
The number of elements stored in the circular_buffer. Nothing.
size_typeGet the largest possible size or capacity of the circular_buffer. (It depends on allocator's max_size()).
Exception SafetyNo-throw.
Iterator InvalidationDoes not invalidate any iterators.
ComplexityConstant (in the size of the circular_buffer).
See Also:size(), capacity(), reserve()
The maximum size/capacity the circular_buffer can be set to. Nothing.
boolIs the circular_buffer empty?
Exception SafetyNo-throw.
Iterator InvalidationDoes not invalidate any iterators.
ComplexityConstant (in the size of the circular_buffer).
See Also:full()
true if there are no elements stored in the circular_buffer; false otherwise. Nothing.
boolIs the circular_buffer full?
Exception SafetyNo-throw.
Iterator InvalidationDoes not invalidate any iterators.
ComplexityConstant (in the size of the circular_buffer).
See Also:empty()
true if the number of elements stored in the circular_buffer equals the capacity of the circular_buffer; false otherwise. Nothing.
size_typeGet the maximum number of elements which can be inserted into the circular_buffer without overwriting any of already stored elements.
Exception SafetyNo-throw.
Iterator InvalidationDoes not invalidate any iterators.
ComplexityConstant (in the size of the circular_buffer).
See Also:capacity(), size(), max_size()
capacity() - size() Nothing.
capacity_typeGet the capacity of the circular_buffer.
Exception SafetyNo-throw.
Iterator InvalidationDoes not invalidate any iterators.
ComplexityConstant (in the size of the circular_buffer).
See Also:reserve(), size(), max_size(), set_capacity(capacity_type)
The maximum number of elements which can be stored in the circular_buffer. Nothing.
voidcapacity_typeThe new capacity. Change the capacity of the circular_buffer.
Exception SafetyStrong.
Iterator InvalidationInvalidates all iterators pointing to the circular_buffer (except iterators equal to end()) if the new capacity is different from the original.
ComplexityLinear (in min[size(), new_capacity]).
See Also:rset_capacity(capacity_type), resize(size_type, const_reference)
If T is a move only type, then compiler shall support noexcept modifiers and move constructor of T must be marked with it (must not throw exceptions). capacity() == new_capacity && size() <= new_capacity
If the current number of elements stored in the circular_buffer is greater than the desired new capacity then number of [size() - new_capacity] last elements will be removed and the new size will be equal to new_capacity. An allocation error if memory is exhausted, (std::bad_alloc if the standard allocator is used). Whatever T::T(const T&) throws or nothing if T::T(T&&) is noexcept.
voidsize_typeThe new size. param_value_typevalue_type()The element the circular_buffer will be filled with in order to gain the requested size. (See the Effect.) Change the size of the circular_buffer.
Exception SafetyBasic.
Iterator InvalidationInvalidates all iterators pointing to the circular_buffer (except iterators equal to end()) if the new size is greater than the current capacity. Invalidates iterators pointing to the removed elements if the new size is lower that the original size. Otherwise it does not invalidate any iterator.
ComplexityLinear (in the new size of the circular_buffer).
See Also:rresize(size_type, const_reference), set_capacity(capacity_type)
size() == new_size && capacity() >= new_size
If the new size is greater than the current size, copies of item will be inserted at the back of the of the circular_buffer in order to achieve the desired size. In the case the resulting size exceeds the current capacity the capacity will be set to new_size.
If the current number of elements stored in the circular_buffer is greater than the desired new size then number of [size() - new_size] last elements will be removed. (The capacity will remain unchanged.) An allocation error if memory is exhausted (std::bad_alloc if the standard allocator is used). Whatever T::T(const T&) throws or nothing if T::T(T&&) is noexcept.
voidcapacity_typeThe new capacity. Change the capacity of the circular_buffer.
Exception SafetyStrong.
Iterator InvalidationInvalidates all iterators pointing to the circular_buffer (except iterators equal to end()) if the new capacity is different from the original.
ComplexityLinear (in min[size(), new_capacity]).
See Also:set_capacity(capacity_type), rresize(size_type, const_reference)
If T is a move only type, then compiler shall support noexcept modifiers and move constructor of T must be marked with it (must not throw exceptions). capacity() == new_capacity && size() <= new_capacity
If the current number of elements stored in the circular_buffer is greater than the desired new capacity then number of [size() - new_capacity] first elements will be removed and the new size will be equal to new_capacity. An allocation error if memory is exhausted (std::bad_alloc if the standard allocator is used). Whatever T::T(const T&) throws or nothing if T::T(T&&) is noexcept.
voidsize_typeThe new size. param_value_typevalue_type()The element the circular_buffer will be filled with in order to gain the requested size. (See the Effect.) Change the size of the circular_buffer.
Exception SafetyBasic.
Iterator InvalidationInvalidates all iterators pointing to the circular_buffer (except iterators equal to end()) if the new size is greater than the current capacity. Invalidates iterators pointing to the removed elements if the new size is lower that the original size. Otherwise it does not invalidate any iterator.
ComplexityLinear (in the new size of the circular_buffer).
See Also:resize(size_type, const_reference), rset_capacity(capacity_type)
size() == new_size && capacity() >= new_size
If the new size is greater than the current size, copies of item will be inserted at the front of the of the circular_buffer in order to achieve the desired size. In the case the resulting size exceeds the current capacity the capacity will be set to new_size.
If the current number of elements stored in the circular_buffer is greater than the desired new size then number of [size() - new_size] first elements will be removed. (The capacity will remain unchanged.) An allocation error if memory is exhausted (std::bad_alloc if the standard allocator is used). Whatever T::T(const T&) throws or nothing if T::T(T&&) is noexcept.
voidsize_typeThe number of elements the circular_buffer will be filled with. param_value_typeThe element the circular_buffer will be filled with. Assign n items into the circular_buffer. The content of the circular_buffer will be removed and replaced with n copies of the item.
Exception SafetyBasic.
Iterator InvalidationInvalidates all iterators pointing to the circular_buffer (except iterators equal to end()).
ComplexityLinear (in the n).
See Also:operator=, assign(capacity_type, size_type, const_reference), assign(InputIterator, InputIterator), assign(capacity_type, InputIterator, InputIterator)
capacity() == n && size() == n && (*this)[0] == item && (*this)[1] == item && ... && (*this) [n - 1] == item An allocation error if memory is exhausted (std::bad_alloc if the standard allocator is used). Whatever T::T(const T&) throws.
voidcapacity_typeThe new capacity. size_typeThe number of elements the circular_buffer will be filled with. param_value_typeThe element the circular_buffer will be filled with. Assign n items into the circular_buffer specifying the capacity. The capacity of the circular_buffer will be set to the specified value and the content of the circular_buffer will be removed and replaced with n copies of the item.
Exception SafetyBasic.
Iterator InvalidationInvalidates all iterators pointing to the circular_buffer (except iterators equal to end()).
ComplexityLinear (in the n).
See Also:operator=, assign(size_type, const_reference), assign(InputIterator, InputIterator), assign(capacity_type, InputIterator, InputIterator)
capacity >= n capacity() == buffer_capacity && size() == n && (*this)[0] == item && (*this)[1] == item && ... && (*this) [n - 1] == item An allocation error if memory is exhausted (std::bad_alloc if the standard allocator is used). Whatever T::T(const T&) throws.
void
InputIteratorThe beginning of the range to be copied. InputIteratorThe end of the range to be copied. Assign a copy of the range into the circular_buffer. The content of the circular_buffer will be removed and replaced with copies of elements from the specified range.
Exception SafetyBasic.
Iterator InvalidationInvalidates all iterators pointing to the circular_buffer (except iterators equal to end()).
ComplexityLinear (in the std::distance(first, last)).
See Also:operator=, assign(size_type, const_reference), assign(capacity_type, size_type, const_reference), assign(capacity_type, InputIterator, InputIterator)
Valid range [first, last).
first and last have to meet the requirements of InputIterator. capacity() == std::distance(first, last) && size() == std::distance(first, last) && (*this)[0]== *first && (*this)[1] == *(first + 1) && ... && (*this)[std::distance(first, last) - 1] == *(last - 1) An allocation error if memory is exhausted (std::bad_alloc if the standard allocator is used). Whatever T::T(const T&) throws.
void
capacity_typeThe new capacity. InputIteratorThe beginning of the range to be copied. InputIteratorThe end of the range to be copied. Assign a copy of the range into the circular_buffer specifying the capacity. The capacity of the circular_buffer will be set to the specified value and the content of the circular_buffer will be removed and replaced with copies of elements from the specified range.
Exception SafetyBasic.
Iterator InvalidationInvalidates all iterators pointing to the circular_buffer (except iterators equal to end()).
ComplexityLinear (in std::distance(first, last); in min[capacity, std::distance(first, last)] if the InputIterator is a RandomAccessIterator).
See Also:operator=, assign(size_type, const_reference), assign(capacity_type, size_type, const_reference), assign(InputIterator, InputIterator)
Valid range [first, last).
first and last have to meet the requirements of InputIterator. capacity() == buffer_capacity && size() <= std::distance(first, last) && (*this)[0]== *(last - buffer_capacity) && (*this)[1] == *(last - buffer_capacity + 1) && ... && (*this)[buffer_capacity - 1] == *(last - 1)
If the number of items to be copied from the range [first, last) is greater than the specified buffer_capacity then only elements from the range [last - buffer_capacity, last) will be copied. An allocation error if memory is exhausted (std::bad_alloc if the standard allocator is used). Whatever T::T(const T&) throws.
voidcircular_buffer< T, Alloc > &The circular_buffer whose content will be swapped. Swap the contents of two circular_buffers.
Exception SafetyNo-throw.
Iterator InvalidationInvalidates all iterators of both circular_buffers. (On the other hand the iterators still point to the same elements but within another container. If you want to rely on this feature you have to turn the Debug Support off otherwise an assertion will report an error if such invalidated iterator is used.)
ComplexityConstant (in the size of the circular_buffer).
See Also:swap(circular_buffer<T, Alloc>&, circular_buffer<T, Alloc>&)
this contains elements of cb and vice versa; the capacity of this equals to the capacity of cb and vice versa. Nothing.
voidparam_value_typeThe element to be inserted. Insert a new element at the end of the circular_buffer.
Exception SafetyBasic; no-throw if the operation in the Throws section does not throw anything.
Iterator InvalidationDoes not invalidate any iterators with the exception of iterators pointing to the overwritten element.
ComplexityConstant (in the size of the circular_buffer).
See Also:push_front(const_reference), pop_back(), pop_front()
if capacity() > 0 then back() == item
If the circular_buffer is full, the first element will be removed. If the capacity is 0, nothing will be inserted. Whatever T::T(const T&) throws. Whatever T::operator = (const T&) throws.
voidrvalue_typeThe element to be inserted. Insert a new element at the end of the circular_buffer using rvalue references or rvalues references emulation.
Exception SafetyBasic; no-throw if the operation in the Throws section does not throw anything.
Iterator InvalidationDoes not invalidate any iterators with the exception of iterators pointing to the overwritten element.
ComplexityConstant (in the size of the circular_buffer).
See Also:push_front(const_reference), pop_back(), pop_front()
if capacity() > 0 then back() == item
If the circular_buffer is full, the first element will be removed. If the capacity is 0, nothing will be inserted. Whatever T::T(T&&) throws. Whatever T::operator = (T&&) throws.
voidInsert a new default-constructed element at the end of the circular_buffer.
Exception SafetyBasic; no-throw if the operation in the Throws section does not throw anything.
Iterator InvalidationDoes not invalidate any iterators with the exception of iterators pointing to the overwritten element.
ComplexityConstant (in the size of the circular_buffer).
See Also:push_front(const_reference), pop_back(), pop_front()
if capacity() > 0 then back() == item
If the circular_buffer is full, the first element will be removed. If the capacity is 0, nothing will be inserted. Whatever T::T() throws. Whatever T::T(T&&) throws. Whatever T::operator = (T&&) throws.
voidparam_value_typeThe element to be inserted. Insert a new element at the beginning of the circular_buffer.
Exception SafetyBasic; no-throw if the operation in the Throws section does not throw anything.
Iterator InvalidationDoes not invalidate any iterators with the exception of iterators pointing to the overwritten element.
ComplexityConstant (in the size of the circular_buffer).
See Also:push_back(const_reference), pop_back(), pop_front()
if capacity() > 0 then front() == item
If the circular_buffer is full, the last element will be removed. If the capacity is 0, nothing will be inserted. Whatever T::T(const T&) throws. Whatever T::operator = (const T&) throws.
voidrvalue_typeThe element to be inserted. Insert a new element at the beginning of the circular_buffer using rvalue references or rvalues references emulation.
Exception SafetyBasic; no-throw if the operation in the Throws section does not throw anything.
Iterator InvalidationDoes not invalidate any iterators with the exception of iterators pointing to the overwritten element.
ComplexityConstant (in the size of the circular_buffer).
See Also:push_back(const_reference), pop_back(), pop_front()
if capacity() > 0 then front() == item
If the circular_buffer is full, the last element will be removed. If the capacity is 0, nothing will be inserted. Whatever T::T(T&&) throws. Whatever T::operator = (T&&) throws.
voidInsert a new default-constructed element at the beginning of the circular_buffer.
Exception SafetyBasic; no-throw if the operation in the Throws section does not throw anything.
Iterator InvalidationDoes not invalidate any iterators with the exception of iterators pointing to the overwritten element.
ComplexityConstant (in the size of the circular_buffer).
See Also:push_back(const_reference), pop_back(), pop_front()
if capacity() > 0 then front() == item
If the circular_buffer is full, the last element will be removed. If the capacity is 0, nothing will be inserted. Whatever T::T() throws. Whatever T::T(T&&) throws. Whatever T::operator = (T&&) throws.
voidRemove the last element from the circular_buffer.
Exception SafetyNo-throw.
Iterator InvalidationInvalidates only iterators pointing to the removed element.
ComplexityConstant (in the size of the circular_buffer).
See Also:pop_front(), push_back(const_reference), push_front(const_reference)
!empty() The last element is removed from the circular_buffer. Nothing.
voidRemove the first element from the circular_buffer.
Exception SafetyNo-throw.
Iterator InvalidationInvalidates only iterators pointing to the removed element.
ComplexityConstant (in the size of the circular_buffer).
See Also:pop_back(), push_back(const_reference), push_front(const_reference)
!empty() The first element is removed from the circular_buffer. Nothing.
iteratoriteratorAn iterator specifying the position where the item will be inserted. param_value_typeThe element to be inserted. Insert an element at the specified position.
Exception SafetyBasic; no-throw if the operation in the Throws section does not throw anything.
Iterator InvalidationInvalidates iterators pointing to the elements at the insertion point (including pos) and iterators behind the insertion point (towards the end; except iterators equal to end()). It also invalidates iterators pointing to the overwritten element.
ComplexityLinear (in std::distance(pos, end())).
See Also:insert(iterator, size_type, value_type), insert(iterator, InputIterator, InputIterator), rinsert(iterator, value_type), rinsert(iterator, size_type, value_type), rinsert(iterator, InputIterator, InputIterator)
pos is a valid iterator pointing to the circular_buffer or its end. The item will be inserted at the position pos.
If the circular_buffer is full, the first element will be overwritten. If the circular_buffer is full and the pos points to begin(), then the item will not be inserted. If the capacity is 0, nothing will be inserted. Iterator to the inserted element or begin() if the item is not inserted. (See the Effect.) Whatever T::T(const T&) throws. Whatever T::operator = (const T&) throws. Exceptions of move_if_noexcept(T&).
iteratoriteratorAn iterator specifying the position where the item will be inserted. rvalue_typeThe element to be inserted. Insert an element at the specified position.
Exception SafetyBasic; no-throw if the operation in the Throws section does not throw anything.
Iterator InvalidationInvalidates iterators pointing to the elements at the insertion point (including pos) and iterators behind the insertion point (towards the end; except iterators equal to end()). It also invalidates iterators pointing to the overwritten element.
ComplexityLinear (in std::distance(pos, end())).
See Also:insert(iterator, size_type, value_type), insert(iterator, InputIterator, InputIterator), rinsert(iterator, value_type), rinsert(iterator, size_type, value_type), rinsert(iterator, InputIterator, InputIterator)
pos is a valid iterator pointing to the circular_buffer or its end. The item will be inserted at the position pos.
If the circular_buffer is full, the first element will be overwritten. If the circular_buffer is full and the pos points to begin(), then the item will not be inserted. If the capacity is 0, nothing will be inserted. Iterator to the inserted element or begin() if the item is not inserted. (See the Effect.) Whatever T::T(T&&) throws. Whatever T::operator = (T&&) throws. Exceptions of move_if_noexcept(T&).
iteratoriteratorAn iterator specifying the position where the item will be inserted. Insert a default-constructed element at the specified position.
Exception SafetyBasic; no-throw if the operation in the Throws section does not throw anything.
Iterator InvalidationInvalidates iterators pointing to the elements at the insertion point (including pos) and iterators behind the insertion point (towards the end; except iterators equal to end()). It also invalidates iterators pointing to the overwritten element.
ComplexityLinear (in std::distance(pos, end())).
See Also:insert(iterator, size_type, value_type), insert(iterator, InputIterator, InputIterator), rinsert(iterator, value_type), rinsert(iterator, size_type, value_type), rinsert(iterator, InputIterator, InputIterator)
pos is a valid iterator pointing to the circular_buffer or its end. The item will be inserted at the position pos.
If the circular_buffer is full, the first element will be overwritten. If the circular_buffer is full and the pos points to begin(), then the item will not be inserted. If the capacity is 0, nothing will be inserted. Iterator to the inserted element or begin() if the item is not inserted. (See the Effect.) Whatever T::T() throws. Whatever T::T(T&&) throws. Whatever T::operator = (T&&) throws. Exceptions of move_if_noexcept(T&).
voiditeratorAn iterator specifying the position where the items will be inserted. size_typeThe number of items the to be inserted. param_value_typeThe element whose copies will be inserted. Insert n copies of the item at the specified position.
Exception SafetyBasic; no-throw if the operations in the Throws section do not throw anything.
Iterator InvalidationInvalidates iterators pointing to the elements at the insertion point (including pos) and iterators behind the insertion point (towards the end; except iterators equal to end()). It also invalidates iterators pointing to the overwritten elements.
ComplexityLinear (in min[capacity(), std::distance(pos, end()) + n]).
ExampleConsider a circular_buffer with the capacity of 6 and the size of 4. Its internal buffer may look like the one below.
|1|2|3|4| | |
p ___^
After inserting 5 elements at the position p:
insert(p, (size_t)5, 0);
actually only 4 elements get inserted and elements 1 and 2 are overwritten. This is due to the fact the insert operation preserves the capacity. After insertion the internal buffer looks like this:
|0|0|0|0|3|4|
For comparison if the capacity would not be preserved the internal buffer would then result in |1|2|0|0|0|0|0|3|4|.
See Also:insert(iterator, value_type), insert(iterator, InputIterator, InputIterator), rinsert(iterator, value_type), rinsert(iterator, size_type, value_type), rinsert(iterator, InputIterator, InputIterator)
pos is a valid iterator pointing to the circular_buffer or its end. The number of min[n, (pos - begin()) + reserve()] elements will be inserted at the position pos.
The number of min[pos - begin(), max[0, n - reserve()]] elements will be overwritten at the beginning of the circular_buffer.
(See Example for the explanation.) Whatever T::T(const T&) throws. Whatever T::operator = (const T&) throws. Exceptions of move_if_noexcept(T&).
void
iteratorAn iterator specifying the position where the range will be inserted. InputIteratorThe beginning of the range to be inserted. InputIteratorThe end of the range to be inserted. Insert the range [first, last) at the specified position.
Exception SafetyBasic; no-throw if the operations in the Throws section do not throw anything.
Iterator InvalidationInvalidates iterators pointing to the elements at the insertion point (including pos) and iterators behind the insertion point (towards the end; except iterators equal to end()). It also invalidates iterators pointing to the overwritten elements.
ComplexityLinear (in [std::distance(pos, end()) + std::distance(first, last)]; in min[capacity(), std::distance(pos, end()) + std::distance(first, last)] if the InputIterator is a RandomAccessIterator).
ExampleConsider a circular_buffer with the capacity of 6 and the size of 4. Its internal buffer may look like the one below.
|1|2|3|4| | |
p ___^
After inserting a range of elements at the position p:
int array[] = { 5, 6, 7, 8, 9 };
insert(p, array, array + 5);
actually only elements 6, 7, 8 and 9 from the specified range get inserted and elements 1 and 2 are overwritten. This is due to the fact the insert operation preserves the capacity. After insertion the internal buffer looks like this:
|6|7|8|9|3|4|
For comparison if the capacity would not be preserved the internal buffer would then result in |1|2|5|6|7|8|9|3|4|.
See Also:insert(iterator, value_type), insert(iterator, size_type, value_type), rinsert(iterator, value_type), rinsert(iterator, size_type, value_type), rinsert(iterator, InputIterator, InputIterator)
pos is a valid iterator pointing to the circular_buffer or its end.
Valid range [first, last) where first and last meet the requirements of an InputIterator. Elements from the range [first + max[0, distance(first, last) - (pos - begin()) - reserve()], last) will be inserted at the position pos.
The number of min[pos - begin(), max[0, distance(first, last) - reserve()]] elements will be overwritten at the beginning of the circular_buffer.
(See Example for the explanation.) Whatever T::T(const T&) throws if the InputIterator is not a move iterator. Whatever T::operator = (const T&) throws if the InputIterator is not a move iterator. Whatever T::T(T&&) throws if the InputIterator is a move iterator. Whatever T::operator = (T&&) throws if the InputIterator is a move iterator.
iteratoriteratorAn iterator specifying the position before which the item will be inserted. param_value_typeThe element to be inserted. Insert an element before the specified position.
Exception SafetyBasic; no-throw if the operations in the Throws section do not throw anything.
Iterator InvalidationInvalidates iterators pointing to the elements before the insertion point (towards the beginning and excluding pos). It also invalidates iterators pointing to the overwritten element.
ComplexityLinear (in std::distance(begin(), pos)).
See Also:rinsert(iterator, size_type, value_type), rinsert(iterator, InputIterator, InputIterator), insert(iterator, value_type), insert(iterator, size_type, value_type), insert(iterator, InputIterator, InputIterator)
pos is a valid iterator pointing to the circular_buffer or its end. The item will be inserted before the position pos.
If the circular_buffer is full, the last element will be overwritten. If the circular_buffer is full and the pos points to end(), then the item will not be inserted. If the capacity is 0, nothing will be inserted. Iterator to the inserted element or end() if the item is not inserted. (See the Effect.) Whatever T::T(const T&) throws. Whatever T::operator = (const T&) throws. Exceptions of move_if_noexcept(T&).
iteratoriteratorAn iterator specifying the position before which the item will be inserted. rvalue_typeThe element to be inserted. Insert an element before the specified position.
Exception SafetyBasic; no-throw if the operations in the Throws section do not throw anything.
Iterator InvalidationInvalidates iterators pointing to the elements before the insertion point (towards the beginning and excluding pos). It also invalidates iterators pointing to the overwritten element.
ComplexityLinear (in std::distance(begin(), pos)).
See Also:rinsert(iterator, size_type, value_type), rinsert(iterator, InputIterator, InputIterator), insert(iterator, value_type), insert(iterator, size_type, value_type), insert(iterator, InputIterator, InputIterator)
pos is a valid iterator pointing to the circular_buffer or its end. The item will be inserted before the position pos.
If the circular_buffer is full, the last element will be overwritten. If the circular_buffer is full and the pos points to end(), then the item will not be inserted. If the capacity is 0, nothing will be inserted. Iterator to the inserted element or end() if the item is not inserted. (See the Effect.) Whatever T::T(T&&) throws. Whatever T::operator = (T&&) throws. Exceptions of move_if_noexcept(T&).
iteratoriteratorAn iterator specifying the position before which the item will be inserted. Insert an element before the specified position.
Exception SafetyBasic; no-throw if the operations in the Throws section do not throw anything.
Iterator InvalidationInvalidates iterators pointing to the elements before the insertion point (towards the beginning and excluding pos). It also invalidates iterators pointing to the overwritten element.
ComplexityLinear (in std::distance(begin(), pos)).
See Also:rinsert(iterator, size_type, value_type), rinsert(iterator, InputIterator, InputIterator), insert(iterator, value_type), insert(iterator, size_type, value_type), insert(iterator, InputIterator, InputIterator)
pos is a valid iterator pointing to the circular_buffer or its end. The item will be inserted before the position pos.
If the circular_buffer is full, the last element will be overwritten. If the circular_buffer is full and the pos points to end(), then the item will not be inserted. If the capacity is 0, nothing will be inserted. Iterator to the inserted element or end() if the item is not inserted. (See the Effect.) Whatever T::T() throws. Whatever T::T(T&&) throws. Whatever T::operator = (T&&) throws. Exceptions of move_if_noexcept(T&).
voiditeratorAn iterator specifying the position where the items will be inserted. size_typeThe number of items the to be inserted. param_value_typeThe element whose copies will be inserted. Insert n copies of the item before the specified position.
Exception SafetyBasic; no-throw if the operations in the Throws section do not throw anything.
Iterator InvalidationInvalidates iterators pointing to the elements before the insertion point (towards the beginning and excluding pos). It also invalidates iterators pointing to the overwritten elements.
ComplexityLinear (in min[capacity(), std::distance(begin(), pos) + n]).
ExampleConsider a circular_buffer with the capacity of 6 and the size of 4. Its internal buffer may look like the one below.
|1|2|3|4| | |
p ___^
After inserting 5 elements before the position p:
rinsert(p, (size_t)5, 0);
actually only 4 elements get inserted and elements 3 and 4 are overwritten. This is due to the fact the rinsert operation preserves the capacity. After insertion the internal buffer looks like this:
|1|2|0|0|0|0|
For comparison if the capacity would not be preserved the internal buffer would then result in |1|2|0|0|0|0|0|3|4|.
See Also:rinsert(iterator, value_type), rinsert(iterator, InputIterator, InputIterator), insert(iterator, value_type), insert(iterator, size_type, value_type), insert(iterator, InputIterator, InputIterator)
pos is a valid iterator pointing to the circular_buffer or its end. The number of min[n, (end() - pos) + reserve()] elements will be inserted before the position pos.
The number of min[end() - pos, max[0, n - reserve()]] elements will be overwritten at the end of the circular_buffer.
(See Example for the explanation.) Whatever T::T(const T&) throws. Whatever T::operator = (const T&) throws. Exceptions of move_if_noexcept(T&).
void
iteratorAn iterator specifying the position where the range will be inserted. InputIteratorThe beginning of the range to be inserted. InputIteratorThe end of the range to be inserted. Insert the range [first, last) before the specified position.
Exception SafetyBasic; no-throw if the operations in the Throws section do not throw anything.
Iterator InvalidationInvalidates iterators pointing to the elements before the insertion point (towards the beginning and excluding pos). It also invalidates iterators pointing to the overwritten elements.
ComplexityLinear (in [std::distance(begin(), pos) + std::distance(first, last)]; in min[capacity(), std::distance(begin(), pos) + std::distance(first, last)] if the InputIterator is a RandomAccessIterator).
ExampleConsider a circular_buffer with the capacity of 6 and the size of 4. Its internal buffer may look like the one below.
|1|2|3|4| | |
p ___^
After inserting a range of elements before the position p:
int array[] = { 5, 6, 7, 8, 9 };
insert(p, array, array + 5);
actually only elements 5, 6, 7 and 8 from the specified range get inserted and elements 3 and 4 are overwritten. This is due to the fact the rinsert operation preserves the capacity. After insertion the internal buffer looks like this:
|1|2|5|6|7|8|
For comparison if the capacity would not be preserved the internal buffer would then result in |1|2|5|6|7|8|9|3|4|.
See Also:rinsert(iterator, value_type), rinsert(iterator, size_type, value_type), insert(iterator, value_type), insert(iterator, size_type, value_type), insert(iterator, InputIterator, InputIterator)
pos is a valid iterator pointing to the circular_buffer or its end.
Valid range [first, last) where first and last meet the requirements of an InputIterator. Elements from the range [first, last - max[0, distance(first, last) - (end() - pos) - reserve()]) will be inserted before the position pos.
The number of min[end() - pos, max[0, distance(first, last) - reserve()]] elements will be overwritten at the end of the circular_buffer.
(See Example for the explanation.) Whatever T::T(const T&) throws if the InputIterator is not a move iterator. Whatever T::operator = (const T&) throws if the InputIterator is not a move iterator. Whatever T::T(T&&) throws if the InputIterator is a move iterator. Whatever T::operator = (T&&) throws if the InputIterator is a move iterator.
iteratoriteratorAn iterator pointing at the element to be removed. Remove an element at the specified position.
Exception SafetyBasic; no-throw if the operation in the Throws section does not throw anything.
Iterator InvalidationInvalidates iterators pointing to the erased element and iterators pointing to the elements behind the erased element (towards the end; except iterators equal to end()).
ComplexityLinear (in std::distance(pos, end())).
See Also:erase(iterator, iterator), rerase(iterator), rerase(iterator, iterator), erase_begin(size_type), erase_end(size_type), clear()
pos is a valid iterator pointing to the circular_buffer (but not an end()). The element at the position pos is removed. Iterator to the first element remaining beyond the removed element or end() if no such element exists. <a href="circular_buffer/implementation.html#circular_buffer.implementation.exceptions_of_move_if_noexcept_t">Exceptions of move_if_noexcept(T&).
iteratoriteratorThe beginning of the range to be removed. iteratorThe end of the range to be removed. Erase the range [first, last).
Exception SafetyBasic; no-throw if the operation in the Throws section does not throw anything.
Iterator InvalidationInvalidates iterators pointing to the erased elements and iterators pointing to the elements behind the erased range (towards the end; except iterators equal to end()).
ComplexityLinear (in std::distance(first, end())).
See Also:erase(iterator), rerase(iterator), rerase(iterator, iterator), erase_begin(size_type), erase_end(size_type), clear()
Valid range [first, last). The elements from the range [first, last) are removed. (If first == last nothing is removed.) Iterator to the first element remaining beyond the removed elements or end() if no such element exists. <a href="circular_buffer/implementation.html#circular_buffer.implementation.exceptions_of_move_if_noexcept_t">Exceptions of move_if_noexcept(T&).
iteratoriteratorAn iterator pointing at the element to be removed. Remove an element at the specified position.
Exception SafetyBasic; no-throw if the operation in the Throws section does not throw anything.
Iterator InvalidationInvalidates iterators pointing to the erased element and iterators pointing to the elements in front of the erased element (towards the beginning).
ComplexityLinear (in std::distance(begin(), pos)).
This method is symetric to the erase(iterator) method and is more effective than erase(iterator) if the iterator pos is close to the beginning of the circular_buffer. (See the Complexity.)
See Also:erase(iterator), erase(iterator, iterator), rerase(iterator, iterator), erase_begin(size_type), erase_end(size_type), clear()
pos is a valid iterator pointing to the circular_buffer (but not an end()). The element at the position pos is removed. Iterator to the first element remaining in front of the removed element or begin() if no such element exists. <a href="circular_buffer/implementation.html#circular_buffer.implementation.exceptions_of_move_if_noexcept_t">Exceptions of move_if_noexcept(T&).
iteratoriteratorThe beginning of the range to be removed. iteratorThe end of the range to be removed. Erase the range [first, last).
Exception SafetyBasic; no-throw if the operation in the Throws section does not throw anything.
Iterator InvalidationInvalidates iterators pointing to the erased elements and iterators pointing to the elements in front of the erased range (towards the beginning).
ComplexityLinear (in std::distance(begin(), last)).
This method is symetric to the erase(iterator, iterator) method and is more effective than erase(iterator, iterator) if std::distance(begin(), first) is lower that std::distance(last, end()).
See Also:erase(iterator), erase(iterator, iterator), rerase(iterator), erase_begin(size_type), erase_end(size_type), clear()
Valid range [first, last). The elements from the range [first, last) are removed. (If first == last nothing is removed.) Iterator to the first element remaining in front of the removed elements or begin() if no such element exists. <a href="circular_buffer/implementation.html#circular_buffer.implementation.exceptions_of_move_if_noexcept_t">Exceptions of move_if_noexcept(T&).
voidsize_typeThe number of elements to be removed. Remove first n elements (with constant complexity for scalar types).
Exception SafetyBasic; no-throw if the operation in the Throws section does not throw anything. (I.e. no throw in case of scalars.)
Iterator InvalidationInvalidates iterators pointing to the first n erased elements.
ComplexityConstant (in n) for scalar types; linear for other types.
This method has been specially designed for types which do not require an explicit destructruction (e.g. integer, float or a pointer). For these scalar types a call to a destructor is not required which makes it possible to implement the "erase from beginning" operation with a constant complexity. For non-sacalar types the complexity is linear (hence the explicit destruction is needed) and the implementation is actually equivalent to rerase(begin(), begin() + n).
See Also:erase(iterator), erase(iterator, iterator), rerase(iterator), rerase(iterator, iterator), erase_end(size_type), clear()
n <= size() The n elements at the beginning of the circular_buffer will be removed. <a href="circular_buffer/implementation.html#circular_buffer.implementation.exceptions_of_move_if_noexcept_t">Exceptions of move_if_noexcept(T&).
voidsize_typeThe number of elements to be removed. Remove last n elements (with constant complexity for scalar types).
Exception SafetyBasic; no-throw if the operation in the Throws section does not throw anything. (I.e. no throw in case of scalars.)
Iterator InvalidationInvalidates iterators pointing to the last n erased elements.
ComplexityConstant (in n) for scalar types; linear for other types.
This method has been specially designed for types which do not require an explicit destructruction (e.g. integer, float or a pointer). For these scalar types a call to a destructor is not required which makes it possible to implement the "erase from end" operation with a constant complexity. For non-sacalar types the complexity is linear (hence the explicit destruction is needed) and the implementation is actually equivalent to erase(end() - n, end()).
See Also:erase(iterator), erase(iterator, iterator), rerase(iterator), rerase(iterator, iterator), erase_begin(size_type), clear()
n <= size() The n elements at the end of the circular_buffer will be removed. <a href="circular_buffer/implementation.html#circular_buffer.implementation.exceptions_of_move_if_noexcept_t">Exceptions of move_if_noexcept(T&).
voidRemove all stored elements from the circular_buffer.
Exception SafetyNo-throw.
Iterator InvalidationInvalidates all iterators pointing to the circular_buffer (except iterators equal to end()).
ComplexityConstant (in the size of the circular_buffer) for scalar types; linear for other types.
See Also:~circular_buffer(), erase(iterator), erase(iterator, iterator), rerase(iterator), rerase(iterator, iterator), erase_begin(size_type), erase_end(size_type)
size() == 0 Nothing.
const allocator_type &allocator_type()The allocator. Create an empty circular_buffer with zero capacity.
ComplexityConstant.
Since Boost version 1.36 the behaviour of this constructor has changed. Now the constructor does not allocate any memory and both capacity and size are set to zero. Also note when inserting an element into a circular_buffer with zero capacity (e.g. by push_back(const_reference) or insert(iterator, value_type)) nothing will be inserted and the size (as well as capacity) remains zero.
You can explicitly set the capacity by calling the set_capacity(capacity_type) method or you can use the other constructor with the capacity specified.
See Also:circular_buffer(capacity_type, const allocator_type& alloc), set_capacity(capacity_type)
capacity() == 0 && size() == 0 Nothing.
capacity_typeThe maximum number of elements which can be stored in the circular_buffer. const allocator_type &allocator_type()The allocator. Create an empty circular_buffer with the specified capacity.
ComplexityConstant.
capacity() == buffer_capacity && size() == 0 An allocation error if memory is exhausted (std::bad_alloc if the standard allocator is used).
size_typeThe number of elements the created circular_buffer will be filled with. param_value_typeThe element the created circular_buffer will be filled with. const allocator_type &allocator_type()The allocator. Create a full circular_buffer with the specified capacity and filled with n copies of item.
ComplexityLinear (in the n).
capacity() == n && full() && (*this)[0] == item && (*this)[1] == item && ... && (*this)[n - 1] == item An allocation error if memory is exhausted (std::bad_alloc if the standard allocator is used). Whatever T::T(const T&) throws.
capacity_typeThe capacity of the created circular_buffer. size_typeThe number of elements the created circular_buffer will be filled with. param_value_typeThe element the created circular_buffer will be filled with. const allocator_type &allocator_type()The allocator. Create a circular_buffer with the specified capacity and filled with n copies of item.
ComplexityLinear (in the n).
buffer_capacity >= n capacity() == buffer_capacity && size() == n && (*this)[0] == item && (*this)[1] == item && ... && (*this)[n - 1] == item An allocation error if memory is exhausted (std::bad_alloc if the standard allocator is used). Whatever T::T(const T&) throws.
const circular_buffer< T, Alloc > &The circular_buffer to be copied. The copy constructor. Creates a copy of the specified circular_buffer.
ComplexityLinear (in the size of cb).
*this == cb An allocation error if memory is exhausted (std::bad_alloc if the standard allocator is used). Whatever T::T(const T&) throws.
circular_buffer< T, Alloc > &&circular_buffer to 'steal' value from. The move constructor. Move constructs a circular_buffer from cb, leaving cb empty.
Constant.
C++ compiler with rvalue references support. cb.empty() Nothing.
InputIteratorThe beginning of the range to be copied. InputIteratorThe end of the range to be copied. const allocator_type &allocator_type()The allocator. Create a full circular_buffer filled with a copy of the range.
ComplexityLinear (in the std::distance(first, last)).
Valid range [first, last).
first and last have to meet the requirements of InputIterator. capacity() == std::distance(first, last) && full() && (*this)[0]== *first && (*this)[1] == *(first + 1) && ... && (*this)[std::distance(first, last) - 1] == *(last - 1) An allocation error if memory is exhausted (std::bad_alloc if the standard allocator is used). Whatever T::T(const T&) throws.
capacity_typeThe capacity of the created circular_buffer. InputIteratorThe beginning of the range to be copied. InputIteratorThe end of the range to be copied. const allocator_type &allocator_type()The allocator. Create a circular_buffer with the specified capacity and filled with a copy of the range.
ComplexityLinear (in std::distance(first, last); in min[capacity, std::distance(first, last)] if the InputIterator is a RandomAccessIterator).
Valid range [first, last).
first and last have to meet the requirements of InputIterator. capacity() == buffer_capacity && size() <= std::distance(first, last) && (*this)[0]== *(last - buffer_capacity) && (*this)[1] == *(last - buffer_capacity + 1) && ... && (*this)[buffer_capacity - 1] == *(last - 1)
If the number of items to be copied from the range [first, last) is greater than the specified buffer_capacity then only elements from the range [last - buffer_capacity, last) will be copied. An allocation error if memory is exhausted (std::bad_alloc if the standard allocator is used). Whatever T::T(const T&) throws.
The destructor. Destroys the circular_buffer.
Iterator InvalidationInvalidates all iterators pointing to the circular_buffer (including iterators equal to end()).
ComplexityConstant (in the size of the circular_buffer) for scalar types; linear for other types.
See Also:clear()
Nothing.
circular_buffer< T, Alloc > &const circular_buffer< T, Alloc > &The circular_buffer to be copied. The assign operator. Makes this circular_buffer to become a copy of the specified circular_buffer.
Exception SafetyStrong.
Iterator InvalidationInvalidates all iterators pointing to this circular_buffer (except iterators equal to end()).
ComplexityLinear (in the size of cb).
See Also:assign(size_type, const_reference), assign(capacity_type, size_type, const_reference), assign(InputIterator, InputIterator), assign(capacity_type, InputIterator, InputIterator)
*this == cb An allocation error if memory is exhausted (std::bad_alloc if the standard allocator is used). Whatever T::T(const T&) throws.
circular_buffer< T, Alloc > &circular_buffer< T, Alloc > &&circular_buffer to 'steal' value from. Move assigns content of cb to *this, leaving cb empty.
ComplexityConstant.
C++ compiler with rvalue references support. cb.empty() Nothing.
void
ValT
void
ValT
iterator
iteratorValT
iterator
iteratorValT
voidsize_typeCheck if the index is valid.
void
Pointer &Increment the pointer.
void
Pointer &Decrement the pointer.
Pointer
Pointerdifference_typeAdd n to the pointer.
Pointer
Pointerdifference_typeSubtract n from the pointer.
pointerpointerMap the null pointer to virtual end of circular buffer.
pointersize_typeAllocate memory.
voidpointersize_typeDeallocate memory.
boolconst_pointerDoes the pointer point to the uninitialized memory?
voidpointerparam_value_typeReplace an element.
voidpointerrvalue_typeReplace an element.
voidboolpointerparam_value_typeConstruct or replace an element. construct has to be set to true if and only if pos points to an uninitialized memory.
voidboolpointerrvalue_typeConstruct or replace an element. construct has to be set to true if and only if pos points to an uninitialized memory.
voidpointerDestroy an item.
voidpointerDestroy an item only if it has been constructed.
voidDestroy the whole content of the circular buffer.
voidconst true_type &Specialized destroy_content method.
voidconst false_type &Specialized destroy_content method.
voidDestroy content and free allocated memory.
voidcapacity_typeInitialize the internal buffer.
voidcapacity_typeparam_value_typeInitialize the internal buffer.
void
IntegralTypeIntegralTypeconst true_type &Specialized initialize method.
void
IteratorIteratorconst false_type &Specialized initialize method.
void
InputIteratorInputIteratorconst std::input_iterator_tag &Specialized initialize method.
void
ForwardIteratorForwardIteratorconst std::forward_iterator_tag &Specialized initialize method.
void
capacity_typeIntegralTypeIntegralTypeconst true_type &Specialized initialize method.
void
capacity_typeIteratorIteratorconst false_type &Specialized initialize method.
void
capacity_typeInputIteratorInputIteratorconst std::input_iterator_tag &Specialized initialize method.
void
capacity_typeForwardIteratorForwardIteratorconst std::forward_iterator_tag &Specialized initialize method.
void
capacity_typeForwardIteratorForwardIteratorsize_typeInitialize the circular buffer.
voidpointerpointercapacity_typeReset the circular buffer.
voidcircular_buffer< T, Alloc > &const true_type &Specialized method for swapping the allocator.
voidcircular_buffer< T, Alloc > &const false_type &Specialized method for swapping the allocator.
void
IntegralTypeIntegralTypeconst true_type &Specialized assign method.
void
IteratorIteratorconst false_type &Specialized assign method.
void
InputIteratorInputIteratorconst std::input_iterator_tag &Specialized assign method.
void
ForwardIteratorForwardIteratorconst std::forward_iterator_tag &Specialized assign method.
void
capacity_typeIntegralTypeIntegralTypeconst true_type &Specialized assign method.
void
capacity_typeIteratorIteratorconst false_type &Specialized assign method.
void
capacity_typeInputIteratorInputIteratorconst std::input_iterator_tag &Specialized assign method.
void
capacity_typeForwardIteratorForwardIteratorconst std::forward_iterator_tag &Specialized assign method.
void
capacity_typesize_typeconst Functor &Helper assign method.
iterator
const iterator &ValTHelper insert method.
void
const iterator &IntegralTypeIntegralTypeconst true_type &Specialized insert method.
void
const iterator &IteratorIteratorconst false_type &Specialized insert method.
void
iteratorInputIteratorInputIteratorconst std::input_iterator_tag &Specialized insert method.
void
const iterator &ForwardIteratorForwardIteratorconst std::forward_iterator_tag &Specialized insert method.
void
const iterator &size_typeconst Wrapper &Helper insert method.
void
const iterator &IntegralTypeIntegralTypeconst true_type &Specialized rinsert method.
void
const iterator &IteratorIteratorconst false_type &Specialized rinsert method.
void
iteratorInputIteratorInputIteratorconst std::input_iterator_tag &Specialized insert method.
void
const iterator &ForwardIteratorForwardIteratorconst std::forward_iterator_tag &Specialized rinsert method.
void
const iterator &size_typeconst Wrapper &Helper rinsert method.
voidsize_typeconst true_type &Specialized erase_begin method.
voidsize_typeconst false_type &Specialized erase_begin method.
voidsize_typeconst true_type &Specialized erase_end method.
voidsize_typeconst false_type &Specialized erase_end method.
bool
const circular_buffer< T, Alloc > &The circular_buffer to compare. const circular_buffer< T, Alloc > &The circular_buffer to compare. Compare two circular_buffers element-by-element to determine if they are equal.
ComplexityLinear (in the size of the circular_buffers).
Iterator InvalidationDoes not invalidate any iterators.
lhs.size() == rhs.size() && std::equal(lhs.begin(), lhs.end(), rhs.begin()) Nothing.
bool
const circular_buffer< T, Alloc > &The circular_buffer to compare. const circular_buffer< T, Alloc > &The circular_buffer to compare. Compare two circular_buffers element-by-element to determine if the left one is lesser than the right one.
ComplexityLinear (in the size of the circular_buffers).
Iterator InvalidationDoes not invalidate any iterators.
std::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()) Nothing.
bool
const circular_buffer< T, Alloc > &The circular_buffer to compare. const circular_buffer< T, Alloc > &The circular_buffer to compare. Compare two circular_buffers element-by-element to determine if they are non-equal.
ComplexityLinear (in the size of the circular_buffers).
Iterator InvalidationDoes not invalidate any iterators.
See Also:operator==(const circular_buffer<T,Alloc>&, const circular_buffer<T,Alloc>&)
!(lhs == rhs) Nothing.
bool
const circular_buffer< T, Alloc > &The circular_buffer to compare. const circular_buffer< T, Alloc > &The circular_buffer to compare. Compare two circular_buffers element-by-element to determine if the left one is greater than the right one.
ComplexityLinear (in the size of the circular_buffers).
Iterator InvalidationDoes not invalidate any iterators.
See Also:operator<(const circular_buffer<T,Alloc>&, const circular_buffer<T,Alloc>&)
rhs < lhs Nothing.
bool
const circular_buffer< T, Alloc > &The circular_buffer to compare. const circular_buffer< T, Alloc > &The circular_buffer to compare. Compare two circular_buffers element-by-element to determine if the left one is lesser or equal to the right one.
ComplexityLinear (in the size of the circular_buffers).
Iterator InvalidationDoes not invalidate any iterators.
See Also:operator<(const circular_buffer<T,Alloc>&, const circular_buffer<T,Alloc>&)
!(rhs < lhs) Nothing.
bool
const circular_buffer< T, Alloc > &The circular_buffer to compare. const circular_buffer< T, Alloc > &The circular_buffer to compare. Compare two circular_buffers element-by-element to determine if the left one is greater or equal to the right one.
ComplexityLinear (in the size of the circular_buffers).
Iterator InvalidationDoes not invalidate any iterators.
See Also:operator<(const circular_buffer<T,Alloc>&, const circular_buffer<T,Alloc>&)
!(lhs < rhs) Nothing.
void
circular_buffer< T, Alloc > &The circular_buffer whose content will be swapped with rhs. circular_buffer< T, Alloc > &The circular_buffer whose content will be swapped with lhs. Swap the contents of two circular_buffers.
ComplexityConstant (in the size of the circular_buffers).
Iterator InvalidationInvalidates all iterators of both circular_buffers. (On the other hand the iterators still point to the same elements but within another container. If you want to rely on this feature you have to turn the Debug Support off otherwise an assertion will report an error if such invalidated iterator is used.)
See Also:swap(circular_buffer<T, Alloc>&)
lhs contains elements of rhs and vice versa. Nothing.
boost::circular_buffer< T, Alloc >Space optimized circular buffer container adaptor. T must be a copyable class or must have an noexcept move constructor and move assignment operator. circular_buffer< T, Alloc >::value_type
circular_buffer< T, Alloc >::pointer
circular_buffer< T, Alloc >::const_pointer
circular_buffer< T, Alloc >::reference
circular_buffer< T, Alloc >::const_reference
circular_buffer< T, Alloc >::size_type
circular_buffer< T, Alloc >::difference_type
circular_buffer< T, Alloc >::allocator_type
circular_buffer< T, Alloc >::const_iterator
circular_buffer< T, Alloc >::iterator
circular_buffer< T, Alloc >::const_reverse_iterator
circular_buffer< T, Alloc >::reverse_iterator
circular_buffer< T, Alloc >::array_range
circular_buffer< T, Alloc >::const_array_range
circular_buffer< T, Alloc >::param_value_type
circular_buffer< T, Alloc >::rvalue_type
Capacity controller of the space optimized circular buffer.See Also:capacity_control in details.hpp.
class capacity_control
{
size_type m_capacity; // Available capacity.
size_type m_min_capacity; // Minimum capacity.
public:
capacity_control(size_type capacity, size_type min_capacity = 0)
: m_capacity(capacity), m_min_capacity(min_capacity)
{};
size_type capacity() const { return m_capacity; }
size_type min_capacity() const { return m_min_capacity; }
operator size_type() const { return m_capacity; }
};
Always capacity >= min_capacity. The capacity() represents the capacity of the circular_buffer_space_optimized and the min_capacity() determines the minimal allocated size of its internal buffer. The converting constructor of the capacity_control allows implicit conversion from size_type-like types which ensures compatibility of creating an instance of the circular_buffer_space_optimized with other STL containers.On the other hand the operator size_type() provides implicit conversion to the size_type which allows to treat the capacity of the circular_buffer_space_optimized the same way as in the circular_buffer. cb_details::capacity_control< size_type >
boolIs the circular_buffer_space_optimized full?
Exception SafetyNo-throw.
Iterator InvalidationDoes not invalidate any iterators.
ComplexityConstant (in the size of the circular_buffer_space_optimized).
See Also:empty()
true if the number of elements stored in the circular_buffer_space_optimized equals the capacity of the circular_buffer_space_optimized; false otherwise. Nothing.
size_typeGet the maximum number of elements which can be inserted into the circular_buffer_space_optimized without overwriting any of already stored elements.
Exception SafetyNo-throw.
Iterator InvalidationDoes not invalidate any iterators.
ComplexityConstant (in the size of the circular_buffer_space_optimized).
See Also:capacity(), size(), max_size()
capacity().capacity() - size() Nothing.
const capacity_type &Get the capacity of the circular_buffer_space_optimized.
Exception SafetyNo-throw.
Iterator InvalidationDoes not invalidate any iterators.
ComplexityConstant (in the size of the circular_buffer_space_optimized).
See Also:reserve(), size(), max_size(), set_capacity(const capacity_type&)
The capacity controller representing the maximum number of elements which can be stored in the circular_buffer_space_optimized and the minimal allocated size of the internal buffer. Nothing.
voidconst capacity_type &The new capacity controller. Change the capacity (and the minimal guaranteed amount of allocated memory) of the circular_buffer_space_optimized.
Exception SafetyStrong.
Iterator InvalidationInvalidates all iterators pointing to the circular_buffer_space_optimized (except iterators equal to end()).
ComplexityLinear (in min[size(), capacity_ctrl.capacity()]).
To explicitly clear the extra allocated memory use the shrink-to-fit technique:
boost::circular_buffer_space_optimized<int> cb(1000);
...
boost::circular_buffer_space_optimized<int>(cb).swap(cb);
For more information about the shrink-to-fit technique in STL see http://www.gotw.ca/gotw/054.htm.
See Also:rset_capacity(const capacity_type&), resize(size_type, const_reference)
capacity() == capacity_ctrl && size() <= capacity_ctrl.capacity()
If the current number of elements stored in the circular_buffer_space_optimized is greater than the desired new capacity then number of [size() - capacity_ctrl.capacity()] last elements will be removed and the new size will be equal to capacity_ctrl.capacity().
If the current number of elements stored in the circular_buffer_space_optimized is lower than the new capacity then the amount of allocated memory in the internal buffer may be accommodated as necessary but it will never drop below capacity_ctrl.min_capacity(). An allocation error if memory is exhausted, (std::bad_alloc if the standard allocator is used). Whatever T::T(const T&) throws or nothing if T::T(T&&) is noexcept.
voidsize_typeThe new size. param_value_typevalue_type()The element the circular_buffer_space_optimized will be filled with in order to gain the requested size. (See the Effect.) Change the size of the circular_buffer_space_optimized.
Exception SafetyBasic.
Iterator InvalidationInvalidates all iterators pointing to the circular_buffer_space_optimized (except iterators equal to end()).
ComplexityLinear (in the new size of the circular_buffer_space_optimized).
See Also:rresize(size_type, const_reference), set_capacity(const capacity_type&)
size() == new_size && capacity().capacity() >= new_size
If the new size is greater than the current size, copies of item will be inserted at the back of the of the circular_buffer_space_optimized in order to achieve the desired size. In the case the resulting size exceeds the current capacity the capacity will be set to new_size.
If the current number of elements stored in the circular_buffer_space_optimized is greater than the desired new size then number of [size() - new_size] last elements will be removed. (The capacity will remain unchanged.)
The amount of allocated memory in the internal buffer may be accommodated as necessary. An allocation error if memory is exhausted (std::bad_alloc if the standard allocator is used). Whatever T::T(const T&) throws.
voidconst capacity_type &The new capacity controller. Change the capacity (and the minimal guaranteed amount of allocated memory) of the circular_buffer_space_optimized.
Exception SafetyStrong.
Iterator InvalidationInvalidates all iterators pointing to the circular_buffer_space_optimized (except iterators equal to end()).
ComplexityLinear (in min[size(), capacity_ctrl.capacity()]).
See Also:set_capacity(const capacity_type&), rresize(size_type, const_reference)
capacity() == capacity_ctrl && size() <= capacity_ctrl
If the current number of elements stored in the circular_buffer_space_optimized is greater than the desired new capacity then number of [size() - capacity_ctrl.capacity()] first elements will be removed and the new size will be equal to capacity_ctrl.capacity().
If the current number of elements stored in the circular_buffer_space_optimized is lower than the new capacity then the amount of allocated memory in the internal buffer may be accommodated as necessary but it will never drop below capacity_ctrl.min_capacity(). An allocation error if memory is exhausted (std::bad_alloc if the standard allocator is used). Whatever T::T(const T&) throws or nothing if T::T(T&&) is noexcept.
voidsize_typeThe new size. param_value_typevalue_type()The element the circular_buffer_space_optimized will be filled with in order to gain the requested size. (See the Effect.) Change the size of the circular_buffer_space_optimized.
Exception SafetyBasic.
Iterator InvalidationInvalidates all iterators pointing to the circular_buffer_space_optimized (except iterators equal to end()).
ComplexityLinear (in the new size of the circular_buffer_space_optimized).
See Also:resize(size_type, const_reference), rset_capacity(const capacity_type&)
size() == new_size && capacity().capacity() >= new_size
If the new size is greater than the current size, copies of item will be inserted at the front of the of the circular_buffer_space_optimized in order to achieve the desired size. In the case the resulting size exceeds the current capacity the capacity will be set to new_size.
If the current number of elements stored in the circular_buffer_space_optimized is greater than the desired new size then number of [size() - new_size] first elements will be removed. (The capacity will remain unchanged.)
The amount of allocated memory in the internal buffer may be accommodated as necessary. An allocation error if memory is exhausted (std::bad_alloc if the standard allocator is used). Whatever T::T(const T&) throws.
voidsize_typeThe number of elements the circular_buffer_space_optimized will be filled with. param_value_typeThe element the circular_buffer_space_optimized will be filled with. Assign n items into the space optimized circular buffer. The content of the circular_buffer_space_optimized will be removed and replaced with n copies of the item.
Exception SafetyBasic.
Iterator InvalidationInvalidates all iterators pointing to the circular_buffer_space_optimized (except iterators equal to end()).
ComplexityLinear (in the n).
See Also:operator=, assign(capacity_type, size_type, const_reference), assign(InputIterator, InputIterator), assign(capacity_type, InputIterator, InputIterator)
capacity().capacity() == n && capacity().min_capacity() == 0 && size() == n && (*this)[0] == item && (*this)[1] == item && ... && (*this) [n - 1] == item
The amount of allocated memory in the internal buffer is n. An allocation error if memory is exhausted (std::bad_alloc if the standard allocator is used). Whatever T::T(const T&) throws.
voidcapacity_typeThe new capacity controller. size_typeThe number of elements the circular_buffer_space_optimized will be filled with. param_value_typeThe element the circular_buffer_space_optimized will be filled with. Assign n items into the space optimized circular buffer specifying the capacity. The capacity of the circular_buffer_space_optimized will be set to the specified value and the content of the circular_buffer_space_optimized will be removed and replaced with n copies of the item.
Exception SafetyBasic.
Iterator InvalidationInvalidates all iterators pointing to the circular_buffer_space_optimized (except iterators equal to end()).
ComplexityLinear (in the n).
See Also:operator=, assign(size_type, const_reference), assign(InputIterator, InputIterator), assign(capacity_type, InputIterator, InputIterator)
capacity_ctrl.capacity() >= n capacity() == capacity_ctrl && size() == n && (*this)[0] == item && (*this)[1] == item && ... && (*this) [n - 1] == item
The amount of allocated memory will be max[n, capacity_ctrl.min_capacity()]. An allocation error if memory is exhausted (std::bad_alloc if the standard allocator is used). Whatever T::T(const T&) throws.
void
InputIteratorThe beginning of the range to be copied. InputIteratorThe end of the range to be copied. Assign a copy of the range into the space optimized circular buffer. The content of the circular_buffer_space_optimized will be removed and replaced with copies of elements from the specified range.
Exception SafetyBasic.
Iterator InvalidationInvalidates all iterators pointing to the circular_buffer_space_optimized (except iterators equal to end()).
ComplexityLinear (in the std::distance(first, last)).
See Also:operator=, assign(size_type, const_reference), assign(capacity_type, size_type, const_reference), assign(capacity_type, InputIterator, InputIterator)
Valid range [first, last).
first and last have to meet the requirements of InputIterator. capacity().capacity() == std::distance(first, last) && capacity().min_capacity() == 0 && size() == std::distance(first, last) && (*this)[0]== *first && (*this)[1] == *(first + 1) && ... && (*this)[std::distance(first, last) - 1] == *(last - 1)
The amount of allocated memory in the internal buffer is std::distance(first, last). An allocation error if memory is exhausted (std::bad_alloc if the standard allocator is used). Whatever T::T(const T&) throws or nothing if T::T(T&&) is noexcept and InputIterator is a move iterator.
void
capacity_typeThe new capacity controller. InputIteratorThe beginning of the range to be copied. InputIteratorThe end of the range to be copied. Assign a copy of the range into the space optimized circular buffer specifying the capacity. The capacity of the circular_buffer_space_optimized will be set to the specified value and the content of the circular_buffer_space_optimized will be removed and replaced with copies of elements from the specified range.
Exception SafetyBasic.
Iterator InvalidationInvalidates all iterators pointing to the circular_buffer_space_optimized (except iterators equal to end()).
ComplexityLinear (in std::distance(first, last); in min[capacity_ctrl.capacity(), std::distance(first, last)] if the InputIterator is a RandomAccessIterator).
See Also:operator=, assign(size_type, const_reference), assign(capacity_type, size_type, const_reference), assign(InputIterator, InputIterator)
Valid range [first, last).
first and last have to meet the requirements of InputIterator. capacity() == capacity_ctrl && size() <= std::distance(first, last) && (*this)[0]== *(last - capacity) && (*this)[1] == *(last - capacity + 1) && ... && (*this)[capacity - 1] == *(last - 1)
If the number of items to be copied from the range [first, last) is greater than the specified capacity then only elements from the range [last - capacity, last) will be copied.
The amount of allocated memory in the internal buffer is max[std::distance(first, last), capacity_ctrl.min_capacity()]. An allocation error if memory is exhausted (std::bad_alloc if the standard allocator is used). Whatever T::T(const T&) throws or nothing if T::T(T&&) is noexcept and InputIterator is a move iterator.
voidcircular_buffer_space_optimized< T, Alloc > &The circular_buffer_space_optimized whose content will be swapped. Swap the contents of two space-optimized circular-buffers.
Exception SafetyNo-throw.
Iterator InvalidationInvalidates all iterators of both circular_buffer_space_optimized containers. (On the other hand the iterators still point to the same elements but within another container. If you want to rely on this feature you have to turn the __debug_support off, otherwise an assertion will report an error if such invalidated iterator is used.)
ComplexityConstant (in the size of the circular_buffer_space_optimized).
See Also:swap(circular_buffer<T, Alloc>&, circular_buffer<T, Alloc>&), swap(circular_buffer_space_optimized<T, Alloc>&, circular_buffer_space_optimized<T, Alloc>&)
this contains elements of cb and vice versa; the capacity and the amount of allocated memory in the internal buffer of this equal to the capacity and the amount of allocated memory of cb and vice versa. Nothing.
voidparam_value_typeThe element to be inserted. Insert a new element at the end of the space optimized circular buffer.
Exception SafetyBasic.
Iterator InvalidationInvalidates all iterators pointing to the circular_buffer_space_optimized (except iterators equal to end()).
ComplexityLinear (in the size of the circular_buffer_space_optimized).
See Also:push_front(const_reference), pop_back(), pop_front()
if capacity().capacity() > 0 then back() == item
If the circular_buffer_space_optimized is full, the first element will be removed. If the capacity is 0, nothing will be inserted.
The amount of allocated memory in the internal buffer may be predictively increased. An allocation error if memory is exhausted (std::bad_alloc if the standard allocator is used). Whatever T::T(const T&) throws.
voidrvalue_typeThe element to be inserted. Insert a new element at the end of the space optimized circular buffer.
Exception SafetyBasic.
Iterator InvalidationInvalidates all iterators pointing to the circular_buffer_space_optimized (except iterators equal to end()).
ComplexityLinear (in the size of the circular_buffer_space_optimized).
See Also:push_front(const_reference), pop_back(), pop_front()
if capacity().capacity() > 0 then back() == item
If the circular_buffer_space_optimized is full, the first element will be removed. If the capacity is 0, nothing will be inserted.
The amount of allocated memory in the internal buffer may be predictively increased. An allocation error if memory is exhausted (std::bad_alloc if the standard allocator is used).
voidInsert a new element at the end of the space optimized circular buffer.
Exception SafetyBasic.
Iterator InvalidationInvalidates all iterators pointing to the circular_buffer_space_optimized (except iterators equal to end()).
ComplexityLinear (in the size of the circular_buffer_space_optimized).
See Also:push_front(const_reference), pop_back(), pop_front()
if capacity().capacity() > 0 then back() == item
If the circular_buffer_space_optimized is full, the first element will be removed. If the capacity is 0, nothing will be inserted.
The amount of allocated memory in the internal buffer may be predictively increased. An allocation error if memory is exhausted (std::bad_alloc if the standard allocator is used). Whatever T::T() throws. Whatever T::T(const T&) throws or nothing if T::T(T&&) is noexcept.
voidparam_value_typeThe element to be inserted. Insert a new element at the beginning of the space optimized circular buffer.
Exception SafetyBasic.
Iterator InvalidationInvalidates all iterators pointing to the circular_buffer_space_optimized (except iterators equal to end()).
ComplexityLinear (in the size of the circular_buffer_space_optimized).
See Also:push_back(const_reference), pop_back(), pop_front()
if capacity().capacity() > 0 then front() == item
If the circular_buffer_space_optimized is full, the last element will be removed. If the capacity is 0, nothing will be inserted.
The amount of allocated memory in the internal buffer may be predictively increased. An allocation error if memory is exhausted (std::bad_alloc if the standard allocator is used). Whatever T::T(const T&) throws.
voidrvalue_typeThe element to be inserted. Insert a new element at the beginning of the space optimized circular buffer.
Exception SafetyBasic.
Iterator InvalidationInvalidates all iterators pointing to the circular_buffer_space_optimized (except iterators equal to end()).
ComplexityLinear (in the size of the circular_buffer_space_optimized).
See Also:push_back(const_reference), pop_back(), pop_front()
if capacity().capacity() > 0 then front() == item
If the circular_buffer_space_optimized is full, the last element will be removed. If the capacity is 0, nothing will be inserted.
The amount of allocated memory in the internal buffer may be predictively increased. An allocation error if memory is exhausted (std::bad_alloc if the standard allocator is used). Whatever T::T(const T&) throws or nothing if T::T(T&&) is noexcept.
voidInsert a new element at the beginning of the space optimized circular buffer.
Exception SafetyBasic.
Iterator InvalidationInvalidates all iterators pointing to the circular_buffer_space_optimized (except iterators equal to end()).
ComplexityLinear (in the size of the circular_buffer_space_optimized).
See Also:push_back(const_reference), pop_back(), pop_front()
if capacity().capacity() > 0 then front() == item
If the circular_buffer_space_optimized is full, the last element will be removed. If the capacity is 0, nothing will be inserted.
The amount of allocated memory in the internal buffer may be predictively increased. An allocation error if memory is exhausted (std::bad_alloc if the standard allocator is used). Whatever T::T() throws. Whatever T::T(const T&) throws or nothing if T::T(T&&) is noexcept.
voidRemove the last element from the space optimized circular buffer.
Exception SafetyBasic.
Iterator InvalidationInvalidates all iterators pointing to the circular_buffer_space_optimized (except iterators equal to end()).
ComplexityLinear (in the size of the circular_buffer_space_optimized).
See Also:pop_front(), push_back(const_reference), push_front(const_reference)
!empty() The last element is removed from the circular_buffer_space_optimized.
The amount of allocated memory in the internal buffer may be predictively decreased. An allocation error if memory is exhausted (std::bad_alloc if the standard allocator is used).
voidRemove the first element from the space optimized circular buffer.
Exception SafetyBasic.
Iterator InvalidationInvalidates all iterators pointing to the circular_buffer_space_optimized (except iterators equal to end()).
ComplexityLinear (in the size of the circular_buffer_space_optimized).
See Also:pop_back(), push_back(const_reference), push_front(const_reference)
!empty() The first element is removed from the circular_buffer_space_optimized.
The amount of allocated memory in the internal buffer may be predictively decreased. An allocation error if memory is exhausted (std::bad_alloc if the standard allocator is used).
iteratoriteratorAn iterator specifying the position where the item will be inserted. param_value_typeThe element to be inserted. Insert an element at the specified position.
Exception SafetyBasic.
Iterator InvalidationInvalidates all iterators pointing to the circular_buffer_space_optimized (except iterators equal to end()).
ComplexityLinear (in the size of the circular_buffer_space_optimized).
See Also:insert(iterator, size_type, value_type), insert(iterator, InputIterator, InputIterator), rinsert(iterator, value_type), rinsert(iterator, size_type, value_type), rinsert(iterator, InputIterator, InputIterator)
pos is a valid iterator pointing to the circular_buffer_space_optimized or its end. The item will be inserted at the position pos.
If the circular_buffer_space_optimized is full, the first element will be overwritten. If the circular_buffer_space_optimized is full and the pos points to begin(), then the item will not be inserted. If the capacity is 0, nothing will be inserted.
The amount of allocated memory in the internal buffer may be predictively increased. Iterator to the inserted element or begin() if the item is not inserted. (See the Effect.) An allocation error if memory is exhausted (std::bad_alloc if the standard allocator is used). Whatever T::T(const T&) throws. Whatever T::operator = (const T&) throws.
iteratoriteratorAn iterator specifying the position where the item will be inserted. rvalue_typeThe element to be inserted. Insert an element at the specified position.
Exception SafetyBasic.
Iterator InvalidationInvalidates all iterators pointing to the circular_buffer_space_optimized (except iterators equal to end()).
ComplexityLinear (in the size of the circular_buffer_space_optimized).
See Also:insert(iterator, size_type, value_type), insert(iterator, InputIterator, InputIterator), rinsert(iterator, value_type), rinsert(iterator, size_type, value_type), rinsert(iterator, InputIterator, InputIterator)
pos is a valid iterator pointing to the circular_buffer_space_optimized or its end. The item will be inserted at the position pos.
If the circular_buffer_space_optimized is full, the first element will be overwritten. If the circular_buffer_space_optimized is full and the pos points to begin(), then the item will not be inserted. If the capacity is 0, nothing will be inserted.
The amount of allocated memory in the internal buffer may be predictively increased. Iterator to the inserted element or begin() if the item is not inserted. (See the Effect.) An allocation error if memory is exhausted (std::bad_alloc if the standard allocator is used). Whatever T::T(const T&) throws or nothing if T::T(T&&) is noexcept.
iteratoriteratorAn iterator specifying the position where the item will be inserted. Insert an element at the specified position.
Exception SafetyBasic.
Iterator InvalidationInvalidates all iterators pointing to the circular_buffer_space_optimized (except iterators equal to end()).
ComplexityLinear (in the size of the circular_buffer_space_optimized).
See Also:insert(iterator, size_type, value_type), insert(iterator, InputIterator, InputIterator), rinsert(iterator, value_type), rinsert(iterator, size_type, value_type), rinsert(iterator, InputIterator, InputIterator)
pos is a valid iterator pointing to the circular_buffer_space_optimized or its end. The item will be inserted at the position pos.
If the circular_buffer_space_optimized is full, the first element will be overwritten. If the circular_buffer_space_optimized is full and the pos points to begin(), then the item will not be inserted. If the capacity is 0, nothing will be inserted.
The amount of allocated memory in the internal buffer may be predictively increased. Iterator to the inserted element or begin() if the item is not inserted. (See the Effect.) An allocation error if memory is exhausted (std::bad_alloc if the standard allocator is used). Whatever T::T() throws. Whatever T::T(const T&) throws or nothing if T::T(T&&) is noexcept.
voiditeratorAn iterator specifying the position where the items will be inserted. size_typeThe number of items the to be inserted. param_value_typeThe element whose copies will be inserted. Insert n copies of the item at the specified position.
Exception SafetyBasic.
Iterator InvalidationInvalidates all iterators pointing to the circular_buffer_space_optimized (except iterators equal to end()).
ComplexityLinear (in min[capacity().capacity(), size() + n]).
ExampleConsider a circular_buffer_space_optimized with the capacity of 6 and the size of 4. Its internal buffer may look like the one below.
|1|2|3|4| | |
p ___^
After inserting 5 elements at the position p:
insert(p, (size_t)5, 0);
actually only 4 elements get inserted and elements 1 and 2 are overwritten. This is due to the fact the insert operation preserves the capacity. After insertion the internal buffer looks like this:
|0|0|0|0|3|4|
For comparison if the capacity would not be preserved the internal buffer would then result in |1|2|0|0|0|0|0|3|4|.
See Also:insert(iterator, value_type), insert(iterator, InputIterator, InputIterator), rinsert(iterator, value_type), rinsert(iterator, size_type, value_type), rinsert(iterator, InputIterator, InputIterator)
pos is a valid iterator pointing to the circular_buffer_space_optimized or its end. The number of min[n, (pos - begin()) + reserve()] elements will be inserted at the position pos.
The number of min[pos - begin(), max[0, n - reserve()]] elements will be overwritten at the beginning of the circular_buffer_space_optimized.
(See Example for the explanation.)
The amount of allocated memory in the internal buffer may be predictively increased. An allocation error if memory is exhausted (std::bad_alloc if the standard allocator is used). Whatever T::T(const T&) throws. Whatever T::operator = (const T&) throws.
void
iteratorAn iterator specifying the position where the range will be inserted. InputIteratorThe beginning of the range to be inserted. InputIteratorThe end of the range to be inserted. Insert the range [first, last) at the specified position.
Exception SafetyBasic.
Iterator InvalidationInvalidates all iterators pointing to the circular_buffer_space_optimized (except iterators equal to end()).
ComplexityLinear (in [size() + std::distance(first, last)]; in min[capacity().capacity(), size() + std::distance(first, last)] if the InputIterator is a RandomAccessIterator).
ExampleConsider a circular_buffer_space_optimized with the capacity of 6 and the size of 4. Its internal buffer may look like the one below.
|1|2|3|4| | |
p ___^
After inserting a range of elements at the position p:
int array[] = { 5, 6, 7, 8, 9 };
insert(p, array, array + 5);
actually only elements 6, 7, 8 and 9 from the specified range get inserted and elements 1 and 2 are overwritten. This is due to the fact the insert operation preserves the capacity. After insertion the internal buffer looks like this:
|6|7|8|9|3|4|
For comparison if the capacity would not be preserved the internal buffer would then result in |1|2|5|6|7|8|9|3|4|.
See Also:insert(iterator, value_type), insert(iterator, size_type, value_type), rinsert(iterator, value_type), rinsert(iterator, size_type, value_type), rinsert(iterator, InputIterator, InputIterator)
pos is a valid iterator pointing to the circular_buffer_space_optimized or its end.
Valid range [first, last) where first and last meet the requirements of an InputIterator. Elements from the range [first + max[0, distance(first, last) - (pos - begin()) - reserve()], last) will be inserted at the position pos.
The number of min[pos - begin(), max[0, distance(first, last) - reserve()]] elements will be overwritten at the beginning of the circular_buffer_space_optimized.
(See Example for the explanation.)
The amount of allocated memory in the internal buffer may be predictively increased. An allocation error if memory is exhausted (std::bad_alloc if the standard allocator is used). Whatever T::T(const T&) throws or nothing if T::T(T&&) is noexcept.
iteratoriteratorAn iterator specifying the position before which the item will be inserted. param_value_typeThe element to be inserted. Insert an element before the specified position.
Exception SafetyBasic.
Iterator InvalidationInvalidates all iterators pointing to the circular_buffer_space_optimized (except iterators equal to end()).
ComplexityLinear (in the size of the circular_buffer_space_optimized).
See Also:rinsert(iterator, size_type, value_type), rinsert(iterator, InputIterator, InputIterator), insert(iterator, value_type), insert(iterator, size_type, value_type), insert(iterator, InputIterator, InputIterator)
pos is a valid iterator pointing to the circular_buffer_space_optimized or its end. The item will be inserted before the position pos.
If the circular_buffer_space_optimized is full, the last element will be overwritten. If the circular_buffer_space_optimized is full and the pos points to end(), then the item will not be inserted. If the capacity is 0, nothing will be inserted.
The amount of allocated memory in the internal buffer may be predictively increased. Iterator to the inserted element or end() if the item is not inserted. (See the Effect.) An allocation error if memory is exhausted (std::bad_alloc if the standard allocator is used). Whatever T::T(const T&) throws. Whatever T::operator = (const T&) throws.
iteratoriteratorAn iterator specifying the position before which the item will be inserted. rvalue_typeThe element to be inserted. Insert an element before the specified position.
Exception SafetyBasic.
Iterator InvalidationInvalidates all iterators pointing to the circular_buffer_space_optimized (except iterators equal to end()).
ComplexityLinear (in the size of the circular_buffer_space_optimized).
See Also:rinsert(iterator, size_type, value_type), rinsert(iterator, InputIterator, InputIterator), insert(iterator, value_type), insert(iterator, size_type, value_type), insert(iterator, InputIterator, InputIterator)
pos is a valid iterator pointing to the circular_buffer_space_optimized or its end. The item will be inserted before the position pos.
If the circular_buffer_space_optimized is full, the last element will be overwritten. If the circular_buffer_space_optimized is full and the pos points to end(), then the item will not be inserted. If the capacity is 0, nothing will be inserted.
The amount of allocated memory in the internal buffer may be predictively increased. Iterator to the inserted element or end() if the item is not inserted. (See the Effect.) An allocation error if memory is exhausted (std::bad_alloc if the standard allocator is used). Whatever T::T(const T&) throws or nothing if T::T(T&&) is noexcept.
iteratoriteratorAn iterator specifying the position before which the item will be inserted. Insert an element before the specified position.
Exception SafetyBasic.
Iterator InvalidationInvalidates all iterators pointing to the circular_buffer_space_optimized (except iterators equal to end()).
ComplexityLinear (in the size of the circular_buffer_space_optimized).
See Also:rinsert(iterator, size_type, value_type), rinsert(iterator, InputIterator, InputIterator), insert(iterator, value_type), insert(iterator, size_type, value_type), insert(iterator, InputIterator, InputIterator)
pos is a valid iterator pointing to the circular_buffer_space_optimized or its end. The item will be inserted before the position pos.
If the circular_buffer_space_optimized is full, the last element will be overwritten. If the circular_buffer_space_optimized is full and the pos points to end(), then the item will not be inserted. If the capacity is 0, nothing will be inserted.
The amount of allocated memory in the internal buffer may be predictively increased. Iterator to the inserted element or end() if the item is not inserted. (See the Effect.) An allocation error if memory is exhausted (std::bad_alloc if the standard allocator is used). Whatever T::T() throws. Whatever T::T(const T&) throws or nothing if T::T(T&&) is noexcept.
voiditeratorAn iterator specifying the position where the items will be inserted. size_typeThe number of items the to be inserted. param_value_typeThe element whose copies will be inserted. Insert n copies of the item before the specified position.
Exception SafetyBasic.
Iterator InvalidationInvalidates all iterators pointing to the circular_buffer_space_optimized (except iterators equal to end()).
ComplexityLinear (in min[capacity().capacity(), size() + n]).
ExampleConsider a circular_buffer_space_optimized with the capacity of 6 and the size of 4. Its internal buffer may look like the one below.
|1|2|3|4| | |
p ___^
After inserting 5 elements before the position p:
rinsert(p, (size_t)5, 0);
actually only 4 elements get inserted and elements 3 and 4 are overwritten. This is due to the fact the rinsert operation preserves the capacity. After insertion the internal buffer looks like this:
|1|2|0|0|0|0|
For comparison if the capacity would not be preserved the internal buffer would then result in |1|2|0|0|0|0|0|3|4|.
See Also:rinsert(iterator, value_type), rinsert(iterator, InputIterator, InputIterator), insert(iterator, value_type), insert(iterator, size_type, value_type), insert(iterator, InputIterator, InputIterator)
pos is a valid iterator pointing to the circular_buffer_space_optimized or its end. The number of min[n, (end() - pos) + reserve()] elements will be inserted before the position pos.
The number of min[end() - pos, max[0, n - reserve()]] elements will be overwritten at the end of the circular_buffer_space_optimized.
(See Example for the explanation.)
The amount of allocated memory in the internal buffer may be predictively increased. An allocation error if memory is exhausted (std::bad_alloc if the standard allocator is used). Whatever T::T(const T&) throws. Whatever T::operator = (const T&) throws.
void
iteratorAn iterator specifying the position where the range will be inserted. InputIteratorThe beginning of the range to be inserted. InputIteratorThe end of the range to be inserted. Insert the range [first, last) before the specified position.
Exception SafetyBasic.
Iterator InvalidationInvalidates all iterators pointing to the circular_buffer_space_optimized (except iterators equal to end()).
ComplexityLinear (in [size() + std::distance(first, last)]; in min[capacity().capacity(), size() + std::distance(first, last)] if the InputIterator is a RandomAccessIterator).
ExampleConsider a circular_buffer_space_optimized with the capacity of 6 and the size of 4. Its internal buffer may look like the one below.
|1|2|3|4| | |
p ___^
After inserting a range of elements before the position p:
int array[] = { 5, 6, 7, 8, 9 };
insert(p, array, array + 5);
actually only elements 5, 6, 7 and 8 from the specified range get inserted and elements 3 and 4 are overwritten. This is due to the fact the rinsert operation preserves the capacity. After insertion the internal buffer looks like this:
|1|2|5|6|7|8|
For comparison if the capacity would not be preserved the internal buffer would then result in |1|2|5|6|7|8|9|3|4|.
See Also:rinsert(iterator, value_type), rinsert(iterator, size_type, value_type), insert(iterator, value_type), insert(iterator, size_type, value_type), insert(iterator, InputIterator, InputIterator)
pos is a valid iterator pointing to the circular_buffer_space_optimized or its end.
Valid range [first, last) where first and last meet the requirements of an InputIterator. Elements from the range [first, last - max[0, distance(first, last) - (end() - pos) - reserve()]) will be inserted before the position pos.
The number of min[end() - pos, max[0, distance(first, last) - reserve()]] elements will be overwritten at the end of the circular_buffer.
(See Example for the explanation.)
The amount of allocated memory in the internal buffer may be predictively increased. An allocation error if memory is exhausted (std::bad_alloc if the standard allocator is used). Whatever T::T(const T&) throws. Whatever T::operator = (const T&) throws.
iteratoriteratorAn iterator pointing at the element to be removed. Remove an element at the specified position.
Exception SafetyBasic.
Iterator InvalidationInvalidates all iterators pointing to the circular_buffer_space_optimized (except iterators equal to end()).
ComplexityLinear (in the size of the circular_buffer_space_optimized).
See Also:erase(iterator, iterator), rerase(iterator), rerase(iterator, iterator), clear()
pos is a valid iterator pointing to the circular_buffer_space_optimized (but not an end()). The element at the position pos is removed.
The amount of allocated memory in the internal buffer may be predictively decreased. Iterator to the first element remaining beyond the removed element or end() if no such element exists. An allocation error if memory is exhausted (std::bad_alloc if the standard allocator is used). Whatever T::operator = (const T&) throws or nothing if T::operator = (T&&) is noexcept.
iteratoriteratorThe beginning of the range to be removed. iteratorThe end of the range to be removed. Erase the range [first, last).
Exception SafetyBasic.
Iterator InvalidationInvalidates all iterators pointing to the circular_buffer_space_optimized (except iterators equal to end()).
ComplexityLinear (in the size of the circular_buffer_space_optimized).
See Also:erase(iterator), rerase(iterator), rerase(iterator, iterator), clear()
Valid range [first, last). The elements from the range [first, last) are removed. (If first == last nothing is removed.)
The amount of allocated memory in the internal buffer may be predictively decreased. Iterator to the first element remaining beyond the removed elements or end() if no such element exists. An allocation error if memory is exhausted (std::bad_alloc if the standard allocator is used). Whatever T::operator = (const T&) throws or nothing if T::operator = (T&&) is noexcept.
iteratoriteratorAn iterator pointing at the element to be removed. Remove an element at the specified position.
Exception SafetyBasic.
Iterator InvalidationInvalidates all iterators pointing to the circular_buffer_space_optimized (except iterators equal to end()).
ComplexityLinear (in the size of the circular_buffer_space_optimized).
Basically there is no difference between erase(iterator) and this method. It is implemented only for consistency with the base circular_buffer.
See Also:erase(iterator), erase(iterator, iterator), rerase(iterator, iterator), clear()
pos is a valid iterator pointing to the circular_buffer_space_optimized (but not an end()).
The amount of allocated memory in the internal buffer may be predictively decreased. The element at the position pos is removed. Iterator to the first element remaining in front of the removed element or begin() if no such element exists. An allocation error if memory is exhausted (std::bad_alloc if the standard allocator is used). Whatever T::operator = (const T&) throws or nothing if T::operator = (T&&) is noexcept.
iteratoriteratorThe beginning of the range to be removed. iteratorThe end of the range to be removed. Erase the range [first, last).
Exception SafetyBasic.
Iterator InvalidationInvalidates all iterators pointing to the circular_buffer_space_optimized (except iterators equal to end()).
ComplexityLinear (in the size of the circular_buffer_space_optimized).
Basically there is no difference between erase(iterator, iterator) and this method. It is implemented only for consistency with the base <circular_buffer.
See Also:erase(iterator), erase(iterator, iterator), rerase(iterator), clear()
Valid range [first, last). The elements from the range [first, last) are removed. (If first == last nothing is removed.)
The amount of allocated memory in the internal buffer may be predictively decreased. Iterator to the first element remaining in front of the removed elements or begin() if no such element exists. An allocation error if memory is exhausted (std::bad_alloc if the standard allocator is used). Whatever T::operator = (const T&) throws or nothing if T::operator = (T&&) is noexcept.
voidRemove all stored elements from the space optimized circular buffer.
Exception SafetyBasic.
Iterator InvalidationInvalidates all iterators pointing to the circular_buffer_space_optimized (except iterators equal to end()).
ComplexityLinear (in the size of the circular_buffer_space_optimized).
See Also:~circular_buffer_space_optimized(), erase(iterator), erase(iterator, iterator), rerase(iterator), rerase(iterator, iterator)
size() == 0
The amount of allocated memory in the internal buffer may be predictively decreased. An allocation error if memory is exhausted (std::bad_alloc if the standard allocator is used).
const allocator_type &allocator_type()The allocator. Create an empty space optimized circular buffer with zero capacity.
ComplexityConstant.
Since Boost version 1.36 the behaviour of this constructor has changed. Now it creates a space optimized circular buffer with zero capacity.
capacity().capacity() == 0 && capacity().min_capacity() == 0 && size() == 0 Nothing.
capacity_typeThe capacity controller representing the maximum number of elements which can be stored in the circular_buffer_space_optimized and the minimal allocated size of the internal buffer. const allocator_type &allocator_type()The allocator. Create an empty space optimized circular buffer with the specified capacity.
ComplexityConstant.
capacity() == capacity_ctrl && size() == 0
The amount of allocated memory in the internal buffer is capacity_ctrl.min_capacity(). An allocation error if memory is exhausted (std::bad_alloc if the standard allocator is used).
capacity_typeThe capacity controller representing the maximum number of elements which can be stored in the circular_buffer_space_optimized and the minimal allocated size of the internal buffer. param_value_typeThe element the created circular_buffer_space_optimized will be filled with. const allocator_type &allocator_type()The allocator. Create a full space optimized circular buffer with the specified capacity filled with capacity_ctrl.capacity() copies of item.
ComplexityLinear (in the capacity_ctrl.capacity()).
capacity() == capacity_ctrl && full() && (*this)[0] == item && (*this)[1] == item && ... && (*this) [capacity_ctrl.capacity() - 1] == item
The amount of allocated memory in the internal buffer is capacity_ctrl.capacity(). An allocation error if memory is exhausted (std::bad_alloc if the standard allocator is used). T::T(const T&) throws.
capacity_typeThe capacity controller representing the maximum number of elements which can be stored in the circular_buffer_space_optimized and the minimal allocated size of the internal buffer. size_typeThe number of elements the created circular_buffer_space_optimized will be filled with. param_value_typeThe element the created circular_buffer_space_optimized will be filled with. const allocator_type &allocator_type()The allocator. Create a space optimized circular buffer with the specified capacity filled with n copies of item.
ComplexityLinear (in the n).
capacity_ctrl.capacity() >= n capacity() == capacity_ctrl && size() == n && (*this)[0] == item && (*this)[1] == item && ... && (*this)[n - 1] == item
The amount of allocated memory in the internal buffer is max[n, capacity_ctrl.min_capacity()]. An allocation error if memory is exhausted (std::bad_alloc if the standard allocator is used). Whatever T::T(const T&) throws.
const circular_buffer_space_optimized< T, Alloc > &The circular_buffer_space_optimized to be copied. The copy constructor. Creates a copy of the specified circular_buffer_space_optimized.
ComplexityLinear (in the size of cb).
*this == cb
The amount of allocated memory in the internal buffer is cb.size(). An allocation error if memory is exhausted (std::bad_alloc if the standard allocator is used). Whatever T::T(const T&) throws.
circular_buffer_space_optimized< T, Alloc > &&circular_buffer to 'steal' value from. The move constructor. Move constructs a circular_buffer_space_optimized from cb, leaving cb empty.
Constant.
C++ compiler with rvalue references support. cb.empty() Nothing.
InputIteratorThe beginning of the range to be copied. InputIteratorThe end of the range to be copied. const allocator_type &allocator_type()The allocator. Create a full space optimized circular buffer filled with a copy of the range.
ComplexityLinear (in the std::distance(first, last)).
Valid range [first, last).
first and last have to meet the requirements of InputIterator. capacity().capacity() == std::distance(first, last) && capacity().min_capacity() == 0 && full() && (*this)[0]== *first && (*this)[1] == *(first + 1) && ... && (*this)[std::distance(first, last) - 1] == *(last - 1)
The amount of allocated memory in the internal buffer is std::distance(first, last). An allocation error if memory is exhausted (std::bad_alloc if the standard allocator is used). Whatever T::T(const T&) throws or nothing if T::T(T&&) is noexcept and InputIterator is a move iterator.
capacity_typeThe capacity controller representing the maximum number of elements which can be stored in the circular_buffer_space_optimized and the minimal allocated size of the internal buffer. InputIteratorThe beginning of the range to be copied. InputIteratorThe end of the range to be copied. const allocator_type &allocator_type()The allocator. Create a space optimized circular buffer with the specified capacity (and the minimal guaranteed amount of allocated memory) filled with a copy of the range.
ComplexityLinear (in std::distance(first, last); in min[capacity_ctrl.capacity(), std::distance(first, last)] if the InputIterator is a RandomAccessIterator).
Valid range [first, last).
first and last have to meet the requirements of InputIterator. capacity() == capacity_ctrl && size() <= std::distance(first, last) && (*this)[0]== (last - capacity_ctrl.capacity()) && (*this)[1] == *(last - capacity_ctrl.capacity() + 1) && ... && (*this)[capacity_ctrl.capacity() - 1] == *(last - 1)
If the number of items to be copied from the range [first, last) is greater than the specified capacity_ctrl.capacity() then only elements from the range [last - capacity_ctrl.capacity(), last) will be copied.
The amount of allocated memory in the internal buffer is max[capacity_ctrl.min_capacity(), min[capacity_ctrl.capacity(), std::distance(first, last)]]. An allocation error if memory is exhausted (std::bad_alloc if the standard allocator is used). Whatever T::T(const T&) throws.
circular_buffer_space_optimized< T, Alloc > &const circular_buffer_space_optimized< T, Alloc > &The circular_buffer_space_optimized to be copied. The assign operator. Makes this circular_buffer_space_optimized to become a copy of the specified circular_buffer_space_optimized.
Exception SafetyStrong.
Iterator InvalidationInvalidates all iterators pointing to this circular_buffer_space_optimized (except iterators equal to end()).
ComplexityLinear (in the size of cb).
See Also:assign(size_type, const_reference), assign(capacity_type, size_type, const_reference), assign(InputIterator, InputIterator), assign(capacity_type, InputIterator, InputIterator)
*this == cb
The amount of allocated memory in the internal buffer is cb.size(). An allocation error if memory is exhausted (std::bad_alloc if the standard allocator is used). T::T(const T&) throws.
circular_buffer_space_optimized< T, Alloc > &circular_buffer_space_optimized< T, Alloc > &&circular_buffer to 'steal' value from. Move assigns content of cb to *this, leaving cb empty.
ComplexityConstant.
C++ compiler with rvalue references support. cb.empty() Nothing.
voidAdjust the amount of allocated memory.
size_typesize_typesize_typeEnsure the reserve for possible growth up.
voidsize_type1Check for low capacity.
voidCheck for high capacity.
voidconst true_type &Specialized method for reducing the capacity.
voidconst false_type &Specialized method for reducing the capacity.
void
const iterator &IntegralTypeIntegralTypeconst true_type &Specialized insert method.
void
const iterator &IteratorIteratorconst false_type &Specialized insert method.
void
const iterator &IntegralTypeIntegralTypeconst true_type &Specialized rinsert method.
void
const iterator &IteratorIteratorconst false_type &Specialized rinsert method.
size_typeconst capacity_type &size_typeDetermine the initial capacity.
size_type
const capacity_type &IntegralTypeIntegralTypeconst true_type &Specialized method for determining the initial capacity.
size_type
const capacity_type &IteratorIteratorconst false_type &Specialized method for determining the initial capacity.
size_type
const capacity_type &InputIteratorInputIteratorconst std::input_iterator_tag &Specialized method for determining the initial capacity.
size_type
const capacity_type &ForwardIteratorForwardIteratorconst std::forward_iterator_tag &Specialized method for determining the initial capacity.
bool
const circular_buffer_space_optimized< T, Alloc > &const circular_buffer_space_optimized< T, Alloc > &Test two space optimized circular buffers for equality.
bool
const circular_buffer_space_optimized< T, Alloc > &const circular_buffer_space_optimized< T, Alloc > &Lexicographical comparison.
bool
const circular_buffer_space_optimized< T, Alloc > &const circular_buffer_space_optimized< T, Alloc > &Test two space optimized circular buffers for non-equality.
bool
const circular_buffer_space_optimized< T, Alloc > &const circular_buffer_space_optimized< T, Alloc > &Lexicographical comparison.
bool
const circular_buffer_space_optimized< T, Alloc > &const circular_buffer_space_optimized< T, Alloc > &Lexicographical comparison.
bool
const circular_buffer_space_optimized< T, Alloc > &const circular_buffer_space_optimized< T, Alloc > &Lexicographical comparison.
void
circular_buffer_space_optimized< T, Alloc > &circular_buffer_space_optimized< T, Alloc > &Swap the contents of two space optimized circular buffers.