|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r85510 - in branches/release: boost boost/circular_buffer libs/circular_buffer libs/circular_buffer/doc libs/circular_buffer/example libs/circular_buffer/test
From: antoshkka_at_[hidden]
Date: 2013-08-29 04:39:09
Author: apolukhin
Date: 2013-08-29 04:39:09 EDT (Thu, 29 Aug 2013)
New Revision: 85510
URL: http://svn.boost.org/trac/boost/changeset/85510
Log:
Big merge of Boost.CircularBuffer :
* Full merge of QuickBoock documentation from Paul A. Bristow
* Merged rvalue references support with tests and documentation (fixed #7888)
Added:
branches/release/libs/circular_buffer/doc/circular_buffer.idx
- copied unchanged from r85122, trunk/libs/circular_buffer/doc/circular_buffer.idx
branches/release/libs/circular_buffer/doc/circular_buffer.qbk
- copied, changed from r85122, trunk/libs/circular_buffer/doc/circular_buffer.qbk
branches/release/libs/circular_buffer/doc/jamfile.v2
- copied, changed from r85122, trunk/libs/circular_buffer/doc/jamfile.v2
branches/release/libs/circular_buffer/example/
- copied from r84771, trunk/libs/circular_buffer/example/
Replaced:
branches/release/libs/circular_buffer/example/bounded_buffer_comparison.cpp
- copied unchanged from r84771, trunk/libs/circular_buffer/example/bounded_buffer_comparison.cpp
branches/release/libs/circular_buffer/example/circular_buffer_bound_example.cpp
- copied unchanged from r84771, trunk/libs/circular_buffer/example/circular_buffer_bound_example.cpp
branches/release/libs/circular_buffer/example/circular_buffer_example.cpp
- copied unchanged from r84771, trunk/libs/circular_buffer/example/circular_buffer_example.cpp
branches/release/libs/circular_buffer/example/circular_buffer_examples.bat
- copied unchanged from r84771, trunk/libs/circular_buffer/example/circular_buffer_examples.bat
branches/release/libs/circular_buffer/example/circular_buffer_iter_example.cpp
- copied unchanged from r84771, trunk/libs/circular_buffer/example/circular_buffer_iter_example.cpp
branches/release/libs/circular_buffer/example/circular_buffer_sum_example.cpp
- copied unchanged from r84771, trunk/libs/circular_buffer/example/circular_buffer_sum_example.cpp
branches/release/libs/circular_buffer/example/jamfile.v2
- copied unchanged from r84771, trunk/libs/circular_buffer/example/jamfile.v2
Deleted:
branches/release/libs/circular_buffer/doc/Doxyfile
branches/release/libs/circular_buffer/doc/HOWTO-srcdoc
branches/release/libs/circular_buffer/doc/Tidy.conf
branches/release/libs/circular_buffer/doc/circular_buffer.html
branches/release/libs/circular_buffer/doc/circular_buffer.png
branches/release/libs/circular_buffer/doc/circular_buffer.xslt
branches/release/libs/circular_buffer/doc/copy.xslt
branches/release/libs/circular_buffer/doc/doxygen2html.xslt
branches/release/libs/circular_buffer/doc/html2xhtml.xslt
branches/release/libs/circular_buffer/doc/space_optimized.html
branches/release/libs/circular_buffer/doc/space_optimized.png
branches/release/libs/circular_buffer/doc/space_optimized.xslt
branches/release/libs/circular_buffer/doc/update_srcdoc.sh
branches/release/libs/circular_buffer/doc/update_srcdoc.xslt
Properties modified:
branches/release/boost/circular_buffer/ (props changed)
branches/release/boost/circular_buffer.hpp (props changed)
branches/release/boost/circular_buffer/base.hpp (contents, props changed)
branches/release/boost/circular_buffer/space_optimized.hpp (contents, props changed)
branches/release/libs/circular_buffer/ (props changed)
Text files modified:
branches/release/boost/circular_buffer/base.hpp | 724 ++-
branches/release/boost/circular_buffer/details.hpp | 98
branches/release/boost/circular_buffer/space_optimized.hpp | 481 ++
/dev/null | 227 -
/dev/null | 52
/dev/null | 18
/dev/null | 7436 ----------------------------------------
branches/release/libs/circular_buffer/doc/circular_buffer.idx | 22
branches/release/libs/circular_buffer/doc/circular_buffer.qbk | 44
/dev/null | 68
/dev/null | 20
/dev/null | 363 -
/dev/null | 18
branches/release/libs/circular_buffer/doc/jamfile.v2 | 201
/dev/null | 4232 ----------------------
/dev/null | 106
/dev/null | 54
/dev/null | 25
branches/release/libs/circular_buffer/example/bounded_buffer_comparison.cpp | 318 +
branches/release/libs/circular_buffer/example/circular_buffer_bound_example.cpp | 191 +
branches/release/libs/circular_buffer/example/circular_buffer_example.cpp | 63
branches/release/libs/circular_buffer/example/circular_buffer_examples.bat | 14
branches/release/libs/circular_buffer/example/circular_buffer_iter_example.cpp | 38
branches/release/libs/circular_buffer/example/circular_buffer_sum_example.cpp | 64
branches/release/libs/circular_buffer/example/jamfile.v2 | 42
branches/release/libs/circular_buffer/index.html | 9
branches/release/libs/circular_buffer/test/base_test.cpp | 105
branches/release/libs/circular_buffer/test/bounded_buffer_comparison.cpp | 59
branches/release/libs/circular_buffer/test/common.ipp | 360 +
branches/release/libs/circular_buffer/test/test.hpp | 2
30 files changed, 2425 insertions(+), 13029 deletions(-)
Modified: branches/release/boost/circular_buffer/base.hpp
==============================================================================
--- branches/release/boost/circular_buffer/base.hpp Thu Aug 29 02:10:38 2013 (r85509)
+++ branches/release/boost/circular_buffer/base.hpp 2013-08-29 04:39:09 EDT (Thu, 29 Aug 2013) (r85510)
@@ -1,6 +1,9 @@
// Implementation of the base circular buffer.
// Copyright (c) 2003-2008 Jan Gaspar
+// Copyright (c) 2013 Paul A. Bristow // Doxygen comments changed.
+// Copyright (c) 2013 Antony Polukhin // Move semantics implementation.
+
// Use, modification, and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -13,6 +16,7 @@
#pragma once
#endif
+#include <boost/config.hpp>
#include <boost/call_traits.hpp>
#include <boost/concept_check.hpp>
#include <boost/limits.hpp>
@@ -21,12 +25,15 @@
#include <boost/type_traits/is_stateless.hpp>
#include <boost/type_traits/is_integral.hpp>
#include <boost/type_traits/is_scalar.hpp>
+#include <boost/type_traits/is_nothrow_move_constructible.hpp>
+#include <boost/type_traits/is_nothrow_move_assignable.hpp>
+#include <boost/type_traits/is_copy_constructible.hpp>
+#include <boost/type_traits/conditional.hpp>
+#include <boost/move/move.hpp>
#include <algorithm>
#include <utility>
#include <deque>
-#if !defined(BOOST_NO_EXCEPTIONS)
- #include <stdexcept>
-#endif
+#include <stdexcept>
#if BOOST_CB_ENABLE_DEBUG
#include <cstring>
#endif
@@ -40,24 +47,26 @@
}
#endif
+
+
namespace boost {
/*!
\class circular_buffer
\brief Circular buffer - a STL compliant container.
- \param T The type of the elements stored in the <code>circular_buffer</code>.
+ \tparam T The type of the elements stored in the <code>circular_buffer</code>.
\par Type Requirements T
The <code>T</code> has to be <a href="http://www.sgi.com/tech/stl/Assignable.html">
- SGIAssignable</a> (SGI STL defined combination of <a href="../../utility/Assignable.html">
- Assignable</a> and CopyConstructible).
+ SGIAssignable</a> (SGI STL defined combination of <a href="../../../utility/Assignable.html">
+ Assignable</a> and CopyConstructible).
Moreover <code>T</code> has to be <a href="http://www.sgi.com/tech/stl/DefaultConstructible.html">
DefaultConstructible</a> if supplied as a default parameter when invoking some of the
<code>circular_buffer</code>'s methods e.g.
<code>insert(iterator pos, const value_type& item = %value_type())</code>. And
<a href="http://www.sgi.com/tech/stl/EqualityComparable.html">EqualityComparable</a> and/or
- LessThanComparable if the <code>circular_buffer</code>
+ LessThanComparable if the <code>circular_buffer</code>
will be compared with another container.
- \param Alloc The allocator type used for all internal memory management.
+ \tparam Alloc The allocator type used for all internal memory management.
\par Type Requirements Alloc
The <code>Alloc</code> has to meet the allocator requirements imposed by STL.
\par Default Alloc
@@ -75,11 +84,23 @@
/*! \endcond */
{
-// Requirements
- BOOST_CLASS_REQUIRE(T, boost, SGIAssignableConcept);
+ // Requirements
+ //BOOST_CLASS_REQUIRE(T, boost, SGIAssignableConcept);
+
+
+ //BOOST_CONCEPT_ASSERT((Assignable<T>));
+ //BOOST_CONCEPT_ASSERT((CopyConstructible<T>));
+ //BOOST_CONCEPT_ASSERT((DefaultConstructible<T>));
+
+ // Required if the circular_buffer will be compared with anther container.
+ //BOOST_CONCEPT_ASSERT((EqualityComparable<T>));
+ //BOOST_CONCEPT_ASSERT((LessThanComparable<T>));
public:
// Basic types
+
+ //! The type of this <code>circular_buffer</code>.
+ typedef circular_buffer<T, Alloc> this_type;
//! The type of elements stored in the <code>circular_buffer</code>.
typedef typename Alloc::value_type value_type;
@@ -145,20 +166,40 @@
//! The capacity type.
/*!
- (Same as <code>size_type</code> - defined for consistency with the
- circular_buffer_space_optimized
.)
+ (Same as <code>size_type</code> - defined for consistency with the __cbso class.
+
*/
+ // circular_buffer_space_optimized
.)
+
typedef size_type capacity_type;
// Helper types
- // A type representing the "best" way to pass the value_type to a method.
- typedef typename call_traits<value_type>::param_type param_value_type;
+ //! A type representing the "best" way to pass the value_type to a method.
+ typedef const value_type& param_value_type;
- // A type representing the "best" way to return the value_type from a const method.
- typedef typename call_traits<value_type>::param_type return_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.
+ typedef BOOST_RV_REF(value_type) rvalue_type;
private:
+
+ // TODO: move to Boost.Move
+ /*! \cond */
+ template <class ValT>
+ static inline typename boost::conditional<
+ ((boost::is_nothrow_move_constructible<ValT>::value && boost::is_nothrow_move_assignable<ValT>::value) || !boost::is_copy_constructible<ValT>::value)
+#if defined(BOOST_NO_CXX11_DELETED_FUNCTIONS) && defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
+ && has_move_emulation_enabled<ValT>::value
+#endif
+ ,
+ rvalue_type,
+ param_value_type
+ >::type move_if_noexcept(ValT& value) BOOST_NOEXCEPT {
+ return boost::move(value);
+ }
+ /*! \endcond */
+
// Member variables
//! The internal buffer used for storing elements in the circular buffer.
@@ -202,7 +243,7 @@
Constant (in the size of the <code>circular_buffer</code>).
\sa <code>get_allocator()</code> for obtaining an allocator %reference.
*/
- allocator_type get_allocator() const { return m_alloc; }
+ allocator_type get_allocator() const BOOST_NOEXCEPT { return m_alloc; }
//! Get the allocator reference.
/*!
@@ -218,7 +259,7 @@
although use of stateful allocators in STL is discouraged.
\sa <code>get_allocator() const</code>
*/
- allocator_type& get_allocator() { return m_alloc; }
+ allocator_type& get_allocator() BOOST_NOEXCEPT { return m_alloc; }
// Element access
@@ -236,7 +277,7 @@
Constant (in the size of the <code>circular_buffer</code>).
\sa <code>end()</code>, <code>rbegin()</code>, <code>rend()</code>
*/
- iterator begin() { return iterator(this, empty() ? 0 : m_first); }
+ iterator begin() BOOST_NOEXCEPT { return iterator(this, empty() ? 0 : m_first); }
//! Get the iterator pointing to the end of the <code>circular_buffer</code>.
/*!
@@ -252,7 +293,7 @@
Constant (in the size of the <code>circular_buffer</code>).
\sa <code>begin()</code>, <code>rbegin()</code>, <code>rend()</code>
*/
- iterator end() { return iterator(this, 0); }
+ iterator end() BOOST_NOEXCEPT { return iterator(this, 0); }
//! Get the const iterator pointing to the beginning of the <code>circular_buffer</code>.
/*!
@@ -268,7 +309,7 @@
Constant (in the size of the <code>circular_buffer</code>).
\sa <code>end() const</code>, <code>rbegin() const</code>, <code>rend() const</code>
*/
- const_iterator begin() const { return const_iterator(this, empty() ? 0 : m_first); }
+ const_iterator begin() const BOOST_NOEXCEPT { return const_iterator(this, empty() ? 0 : m_first); }
//! Get the const iterator pointing to the end of the <code>circular_buffer</code>.
/*!
@@ -284,7 +325,7 @@
Constant (in the size of the <code>circular_buffer</code>).
\sa <code>begin() const</code>, <code>rbegin() const</code>, <code>rend() const</code>
*/
- const_iterator end() const { return const_iterator(this, 0); }
+ const_iterator end() const BOOST_NOEXCEPT { return const_iterator(this, 0); }
//! Get the iterator pointing to the beginning of the "reversed" <code>circular_buffer</code>.
/*!
@@ -300,7 +341,7 @@
Constant (in the size of the <code>circular_buffer</code>).
\sa <code>rend()</code>, <code>begin()</code>, <code>end()</code>
*/
- reverse_iterator rbegin() { return reverse_iterator(end()); }
+ reverse_iterator rbegin() BOOST_NOEXCEPT { return reverse_iterator(end()); }
//! Get the iterator pointing to the end of the "reversed" <code>circular_buffer</code>.
/*!
@@ -316,7 +357,7 @@
Constant (in the size of the <code>circular_buffer</code>).
\sa <code>rbegin()</code>, <code>begin()</code>, <code>end()</code>
*/
- reverse_iterator rend() { return reverse_iterator(begin()); }
+ reverse_iterator rend() BOOST_NOEXCEPT { return reverse_iterator(begin()); }
//! Get the const iterator pointing to the beginning of the "reversed" <code>circular_buffer</code>.
/*!
@@ -332,7 +373,7 @@
Constant (in the size of the <code>circular_buffer</code>).
\sa <code>rend() const</code>, <code>begin() const</code>, <code>end() const</code>
*/
- const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
+ const_reverse_iterator rbegin() const BOOST_NOEXCEPT { return const_reverse_iterator(end()); }
//! Get the const iterator pointing to the end of the "reversed" <code>circular_buffer</code>.
/*!
@@ -348,7 +389,7 @@
Constant (in the size of the <code>circular_buffer</code>).
\sa <code>rbegin() const</code>, <code>begin() const</code>, <code>end() const</code>
*/
- const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
+ const_reverse_iterator rend() const BOOST_NOEXCEPT { return const_reverse_iterator(begin()); }
//! Get the element at the <code>index</code> position.
/*!
@@ -383,7 +424,7 @@
Constant (in the size of the <code>circular_buffer</code>).
\sa <code>\link at(size_type)const at() const \endlink</code>
*/
- return_value_type operator [] (size_type index) const {
+ const_reference operator [] (size_type index) const {
BOOST_CB_ASSERT(index < size()); // check for invalid index
return *add(m_first, index);
}
@@ -421,7 +462,7 @@
Constant (in the size of the <code>circular_buffer</code>).
\sa <code>\link operator[](size_type)const operator[] const \endlink</code>
*/
- return_value_type at(size_type index) const {
+ const_reference at(size_type index) const {
check_position(index);
return (*this)[index];
}
@@ -475,7 +516,7 @@
Constant (in the size of the <code>circular_buffer</code>).
\sa <code>back() const</code>
*/
- return_value_type front() const {
+ const_reference front() const {
BOOST_CB_ASSERT(!empty()); // check for empty buffer (front element not available)
return *m_first;
}
@@ -493,7 +534,7 @@
Constant (in the size of the <code>circular_buffer</code>).
\sa <code>front() const</code>
*/
- return_value_type back() const {
+ const_reference back() const {
BOOST_CB_ASSERT(!empty()); // check for empty buffer (back element not available)
return *((m_last == m_buff ? m_end : m_last) - 1);
}
@@ -508,8 +549,9 @@
The internal representation is often not linear and the state of the internal buffer may look like this:<br>
<br><code>
|e|f|g| | | |a|b|c|d|<br>
- end ---^<br>
- begin -------^</code><br><br>
+ end ___^<br>
+ begin _______^</code><br><br>
+
where <code>|a|b|c|d|</code> represents the "array one", <code>|e|f|g|</code> represents the "array two" and
<code>| | | |</code> is a free space.<br>
Now consider a typical C style function for writing data into a file:<br><br>
@@ -612,8 +654,7 @@
This method can be useful when passing the stored data into a legacy C API as an array.
\post <code>\&(*this)[0] \< \&(*this)[1] \< ... \< \&(*this)[size() - 1]</code>
\return A pointer to the beginning of the array or <code>0</code> if empty.
- \throws Whatever <code>T::T(const T&)</code> throws.
- \throws Whatever <code>T::operator = (const T&)</code> throws.
+ \throws Exceptions of move_if_noexcept(T&).
\par Exception Safety
Basic; no-throw if the operations in the <i>Throws</i> section do not throw anything.
\par Iterator Invalidation
@@ -649,12 +690,12 @@
break;
}
if (is_uninitialized(dest)) {
- m_alloc.construct(dest, *src);
+ ::new (dest) value_type(this_type::move_if_noexcept(*src));
++constructed;
} else {
- value_type tmp = *src;
- replace(src, *dest);
- replace(dest, tmp);
+ value_type tmp = this_type::move_if_noexcept(*src);
+ replace(src, this_type::move_if_noexcept(*dest));
+ replace(dest, boost::move(tmp));
}
}
}
@@ -689,7 +730,7 @@
Constant (in the size of the <code>circular_buffer</code>).
\sa <code>linearize()</code>, <code>array_one()</code>, <code>array_two()</code>
*/
- bool is_linearized() const { return m_first < m_last || m_last == m_buff; }
+ bool is_linearized() const BOOST_NOEXCEPT { return m_first < m_last || m_last == m_buff; }
//! Rotate elements in the <code>circular_buffer</code>.
/*!
@@ -705,8 +746,7 @@
<code>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]</code>
\param new_begin The new beginning.
- \throws Whatever <code>T::T(const T&)</code> throws.
- \throws Whatever <code>T::operator = (const T&)</code> throws.
+ \throws See Exceptions of move_if_noexcept(T&).
\par Exception Safety
Basic; no-throw if the <code>circular_buffer</code> is full or <code>new_begin</code> points to
<code>begin()</code> or if the operations in the <i>Throws</i> section do not throw anything.
@@ -729,12 +769,12 @@
difference_type n = new_begin - begin();
if (m < n) {
for (; m > 0; --m) {
- push_front(back());
+ push_front(this_type::move_if_noexcept(back()));
pop_back();
}
} else {
for (; n > 0; --n) {
- push_back(front());
+ push_back(this_type::move_if_noexcept(front()));
pop_front();
}
}
@@ -756,7 +796,7 @@
\sa <code>capacity()</code>, <code>max_size()</code>, <code>reserve()</code>,
<code>\link resize() resize(size_type, const_reference)\endlink</code>
*/
- size_type size() const { return m_size; }
+ size_type size() const BOOST_NOEXCEPT { return m_size; }
/*! \brief Get the largest possible size or capacity of the <code>circular_buffer</code>. (It depends on
allocator's %max_size()).
@@ -770,7 +810,7 @@
Constant (in the size of the <code>circular_buffer</code>).
\sa <code>size()</code>, <code>capacity()</code>, <code>reserve()</code>
*/
- size_type max_size() const {
+ size_type max_size() const BOOST_NOEXCEPT {
return (std::min<size_type>)(m_alloc.max_size(), (std::numeric_limits<difference_type>::max)());
}
@@ -787,7 +827,7 @@
Constant (in the size of the <code>circular_buffer</code>).
\sa <code>full()</code>
*/
- bool empty() const { return size() == 0; }
+ bool empty() const BOOST_NOEXCEPT { return size() == 0; }
//! Is the <code>circular_buffer</code> full?
/*!
@@ -802,7 +842,7 @@
Constant (in the size of the <code>circular_buffer</code>).
\sa <code>empty()</code>
*/
- bool full() const { return capacity() == size(); }
+ bool full() const BOOST_NOEXCEPT { return capacity() == size(); }
/*! \brief Get the maximum number of elements which can be inserted into the <code>circular_buffer</code> without
overwriting any of already stored elements.
@@ -816,7 +856,7 @@
Constant (in the size of the <code>circular_buffer</code>).
\sa <code>capacity()</code>, <code>size()</code>, <code>max_size()</code>
*/
- size_type reserve() const { return capacity() - size(); }
+ size_type reserve() const BOOST_NOEXCEPT { return capacity() - size(); }
//! Get the capacity of the <code>circular_buffer</code>.
/*!
@@ -831,18 +871,20 @@
\sa <code>reserve()</code>, <code>size()</code>, <code>max_size()</code>,
<code>set_capacity(capacity_type)</code>
*/
- capacity_type capacity() const { return m_end - m_buff; }
+ capacity_type capacity() const BOOST_NOEXCEPT { return m_end - m_buff; }
//! Change the capacity of the <code>circular_buffer</code>.
- /*!
+ /*!
+ \pre If <code>T</code> is a move only type, then compiler shall support <code>noexcept</code> modifiers
+ and move constructor of <code>T</code> must be marked with it (must not throw exceptions).
\post <code>capacity() == new_capacity \&\& size() \<= new_capacity</code><br><br>
If the current number of elements stored in the <code>circular_buffer</code> is greater than the desired
new capacity then number of <code>[size() - new_capacity]</code> <b>last</b> elements will be removed and
the new size will be equal to <code>new_capacity</code>.
\param new_capacity The new capacity.
- \throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
+ \throws "An allocation error" if memory is exhausted, (<code>std::bad_alloc</code> if the standard allocator is
used).
- \throws Whatever <code>T::T(const T&)</code> throws.
+ Whatever <code>T::T(const T&)</code> throws or nothing if <code>T::T(T&&)</code> is noexcept.
\par Exception Safety
Strong.
\par Iterator Invalidation
@@ -860,7 +902,7 @@
iterator b = begin();
BOOST_TRY {
reset(buff,
- cb_details::uninitialized_copy_with_alloc(b, b + (std::min)(new_capacity, size()), buff, m_alloc),
+ cb_details::uninitialized_move_if_noexcept<value_type>(b, b + (std::min)(new_capacity, size()), buff),
new_capacity);
} BOOST_CATCH(...) {
deallocate(buff, new_capacity);
@@ -883,7 +925,7 @@
size. (See the <i>Effect</i>.)
\throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
used).
- \throws Whatever <code>T::T(const T&)</code> throws.
+ Whatever <code>T::T(const T&)</code> throws or nothing if <code>T::T(T&&)</code> is noexcept.
\par Exception Safety
Basic.
\par Iterator Invalidation
@@ -908,7 +950,9 @@
}
//! Change the capacity of the <code>circular_buffer</code>.
- /*!
+ /*!
+ \pre If <code>T</code> is a move only type, then compiler shall support <code>noexcept</code> modifiers
+ and move constructor of <code>T</code> must be marked with it (must not throw exceptions).
\post <code>capacity() == new_capacity \&\& size() \<= new_capacity</code><br><br>
If the current number of elements stored in the <code>circular_buffer</code> is greater than the desired
new capacity then number of <code>[size() - new_capacity]</code> <b>first</b> elements will be removed
@@ -916,7 +960,7 @@
\param new_capacity The new capacity.
\throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
used).
- \throws Whatever <code>T::T(const T&)</code> throws.
+ Whatever <code>T::T(const T&)</code> throws or nothing if <code>T::T(T&&)</code> is noexcept.
\par Exception Safety
Strong.
\par Iterator Invalidation
@@ -933,8 +977,8 @@
pointer buff = allocate(new_capacity);
iterator e = end();
BOOST_TRY {
- reset(buff, cb_details::uninitialized_copy_with_alloc(e - (std::min)(new_capacity, size()),
- e, buff, m_alloc), new_capacity);
+ reset(buff, cb_details::uninitialized_move_if_noexcept<value_type>(e - (std::min)(new_capacity, size()),
+ e, buff), new_capacity);
} BOOST_CATCH(...) {
deallocate(buff, new_capacity);
BOOST_RETHROW
@@ -956,7 +1000,7 @@
size. (See the <i>Effect</i>.)
\throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
used).
- \throws Whatever <code>T::T(const T&)</code> throws.
+ Whatever <code>T::T(const T&)</code> throws or nothing if <code>T::T(T&&)</code> is noexcept.
\par Exception Safety
Basic.
\par Iterator Invalidation
@@ -985,8 +1029,7 @@
/*!
\post <code>capacity() == 0 \&\& size() == 0</code>
\param alloc The allocator.
- \throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
- used).
+ \throws Nothing.
\par Complexity
Constant.
\warning Since Boost version 1.36 the behaviour of this constructor has changed. Now the constructor does not
@@ -1000,7 +1043,7 @@
\sa <code>circular_buffer(capacity_type, const allocator_type& alloc)</code>,
<code>set_capacity(capacity_type)</code>
*/
- explicit circular_buffer(const allocator_type& alloc = allocator_type())
+ explicit circular_buffer(const allocator_type& alloc = allocator_type()) BOOST_NOEXCEPT
: m_buff(0), m_end(0), m_first(0), m_last(0), m_size(0), m_alloc(alloc) {}
//! Create an empty <code>circular_buffer</code> with the specified capacity.
@@ -1028,7 +1071,7 @@
\param alloc The allocator.
\throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
used).
- \throws Whatever <code>T::T(const T&)</code> throws.
+ Whatever <code>T::T(const T&)</code> throws.
\par Complexity
Linear (in the <code>n</code>).
*/
@@ -1049,7 +1092,7 @@
\param alloc The allocator.
\throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
used).
- \throws Whatever <code>T::T(const T&)</code> throws.
+ Whatever <code>T::T(const T&)</code> throws.
\par Complexity
Linear (in the <code>n</code>).
*/
@@ -1069,7 +1112,7 @@
\param cb The <code>circular_buffer</code> to be copied.
\throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
used).
- \throws Whatever <code>T::T(const T&)</code> throws.
+ Whatever <code>T::T(const T&)</code> throws.
\par Complexity
Linear (in the size of <code>cb</code>).
*/
@@ -1082,7 +1125,7 @@
initialize_buffer(cb.capacity());
m_first = m_buff;
BOOST_TRY {
- m_last = cb_details::uninitialized_copy_with_alloc(cb.begin(), cb.end(), m_buff, m_alloc);
+ m_last = cb_details::uninitialized_copy<value_type>(cb.begin(), cb.end(), m_buff);
} BOOST_CATCH(...) {
deallocate(m_buff, cb.capacity());
BOOST_RETHROW
@@ -1091,6 +1134,22 @@
if (m_last == m_end)
m_last = m_buff;
}
+
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+ //! The move constructor.
+ /*! \brief Move constructs a <code>circular_buffer</code> from <code>cb</code>, leaving <code>cb</code> empty.
+ \pre C++ compiler with rvalue references support.
+ \post <code>cb.empty()</code>
+ \param cb <code>circular_buffer</code> to 'steal' value from.
+ \throws Nothing.
+ \par Constant.
+ */
+ circular_buffer(circular_buffer<T, Alloc>&& cb) BOOST_NOEXCEPT
+ : m_buff(0), m_end(0), m_first(0), m_last(0), m_size(0), m_alloc(cb.get_allocator()) {
+ cb.swap(*this);
+ }
+#endif // BOOST_NO_CXX11_RVALUE_REFERENCES
+
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
@@ -1122,7 +1181,7 @@
\param alloc The allocator.
\throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
used).
- \throws Whatever <code>T::T(const T&)</code> throws.
+ Whatever <code>T::T(const T&)</code> throws.
\par Complexity
Linear (in the <code>std::distance(first, last)</code>).
*/
@@ -1149,7 +1208,7 @@
\param alloc The allocator.
\throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
used).
- \throws Whatever <code>T::T(const T&)</code> throws.
+ Whatever <code>T::T(const T&)</code> throws.
\par Complexity
Linear (in <code>std::distance(first, last)</code>; in
<code>min[capacity, std::distance(first, last)]</code> if the <code>InputIterator</code> is a
@@ -1175,7 +1234,7 @@
Constant (in the size of the <code>circular_buffer</code>) for scalar types; linear for other types.
\sa <code>clear()</code>
*/
- ~circular_buffer() {
+ ~circular_buffer() BOOST_NOEXCEPT {
destroy();
#if BOOST_CB_ENABLE_DEBUG
invalidate_all_iterators();
@@ -1192,7 +1251,7 @@
\param cb The <code>circular_buffer</code> to be copied.
\throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
used).
- \throws Whatever <code>T::T(const T&)</code> throws.
+ Whatever <code>T::T(const T&)</code> throws.
\par Exception Safety
Strong.
\par Iterator Invalidation
@@ -1211,7 +1270,7 @@
return *this;
pointer buff = allocate(cb.capacity());
BOOST_TRY {
- reset(buff, cb_details::uninitialized_copy_with_alloc(cb.begin(), cb.end(), buff, m_alloc), cb.capacity());
+ reset(buff, cb_details::uninitialized_copy<value_type>(cb.begin(), cb.end(), buff), cb.capacity());
} BOOST_CATCH(...) {
deallocate(buff, cb.capacity());
BOOST_RETHROW
@@ -1220,6 +1279,23 @@
return *this;
}
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+ /*! \brief Move assigns content of <code>cb</code> to <code>*this</code>, leaving <code>cb</code> empty.
+ \pre C++ compiler with rvalue references support.
+ \post <code>cb.empty()</code>
+ \param cb <code>circular_buffer</code> to 'steal' value from.
+ \throws Nothing.
+ \par Complexity
+ Constant.
+ */
+ circular_buffer<T, Alloc>& operator = (circular_buffer<T, Alloc>&& cb) BOOST_NOEXCEPT {
+ cb.swap(*this); // now `this` holds `cb`
+ circular_buffer<T, Alloc>(get_allocator()) // temprary that holds initial `cb` allocator
+ .swap(cb); // makes `cb` empty
+ return *this;
+ }
+#endif // BOOST_NO_CXX11_RVALUE_REFERENCES
+
//! Assign <code>n</code> items into the <code>circular_buffer</code>.
/*!
The content of the <code>circular_buffer</code> will be removed and replaced with <code>n</code> copies of the
@@ -1230,7 +1306,7 @@
\param item The element the <code>circular_buffer</code> will be filled with.
\throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
used).
- \throws Whatever <code>T::T(const T&)</code> throws.
+ Whatever <code>T::T(const T&)</code> throws.
\par Exception Safety
Basic.
\par Iterator Invalidation
@@ -1260,7 +1336,7 @@
\param item The element the <code>circular_buffer</code> will be filled with.
\throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
used).
- \throws Whatever <code>T::T(const T&)</code> throws.
+ Whatever <code>T::T(const T&)</code> throws.
\par Exception Safety
Basic.
\par Iterator Invalidation
@@ -1292,7 +1368,7 @@
\param last The end of the range to be copied.
\throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
used).
- \throws Whatever <code>T::T(const T&)</code> throws.
+ Whatever <code>T::T(const T&)</code> throws.
\par Exception Safety
Basic.
\par Iterator Invalidation
@@ -1329,7 +1405,7 @@
\param last The end of the range to be copied.
\throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
used).
- \throws Whatever <code>T::T(const T&)</code> throws.
+ Whatever <code>T::T(const T&)</code> throws.
\par Exception Safety
Basic.
\par Iterator Invalidation
@@ -1367,7 +1443,7 @@
Constant (in the size of the <code>circular_buffer</code>).
\sa <code>swap(circular_buffer<T, Alloc>&, circular_buffer<T, Alloc>&)</code>
*/
- void swap(circular_buffer<T, Alloc>& cb) {
+ void swap(circular_buffer<T, Alloc>& cb) BOOST_NOEXCEPT {
swap_allocator(cb, is_stateless<allocator_type>());
std::swap(m_buff, cb.m_buff);
std::swap(m_end, cb.m_end);
@@ -1381,7 +1457,44 @@
}
// push and pop
+private:
+ template <class ValT>
+ void push_back_impl(ValT item) {
+ if (full()) {
+ if (empty())
+ return;
+ replace(m_last, static_cast<ValT>(item));
+ increment(m_last);
+ m_first = m_last;
+ } else {
+ ::new (m_last) value_type(static_cast<ValT>(item));
+ increment(m_last);
+ ++m_size;
+ }
+ }
+
+ template <class ValT>
+ void push_front_impl(ValT item) {
+ BOOST_TRY {
+ if (full()) {
+ if (empty())
+ return;
+ decrement(m_first);
+ replace(m_first, static_cast<ValT>(item));
+ m_last = m_first;
+ } else {
+ decrement(m_first);
+ ::new (m_first) value_type(static_cast<ValT>(item));
+ ++m_size;
+ }
+ } BOOST_CATCH(...) {
+ increment(m_first);
+ BOOST_RETHROW
+ }
+ BOOST_CATCH_END
+ }
+public:
//! Insert a new element at the end of the <code>circular_buffer</code>.
/*!
\post if <code>capacity() > 0</code> then <code>back() == item</code><br>
@@ -1389,7 +1502,7 @@
<code>0</code>, nothing will be inserted.
\param item The element to be inserted.
\throws Whatever <code>T::T(const T&)</code> throws.
- \throws Whatever <code>T::operator = (const T&)</code> throws.
+ Whatever <code>T::operator = (const T&)</code> throws.
\par Exception Safety
Basic; no-throw if the operation in the <i>Throws</i> section does not throw anything.
\par Iterator Invalidation
@@ -1399,18 +1512,51 @@
\sa <code>\link push_front() push_front(const_reference)\endlink</code>,
<code>pop_back()</code>, <code>pop_front()</code>
*/
- void push_back(param_value_type item = value_type()) {
- if (full()) {
- if (empty())
- return;
- replace(m_last, item);
- increment(m_last);
- m_first = m_last;
- } else {
- m_alloc.construct(m_last, item);
- increment(m_last);
- ++m_size;
- }
+ void push_back(param_value_type item) {
+ push_back_impl<param_value_type>(item);
+ }
+
+ //! Insert a new element at the end of the <code>circular_buffer</code> using rvalue references or rvalues references emulation.
+ /*!
+ \post if <code>capacity() > 0</code> then <code>back() == item</code><br>
+ If the <code>circular_buffer</code> is full, the first element will be removed. If the capacity is
+ <code>0</code>, nothing will be inserted.
+ \param item The element to be inserted.
+ \throws Whatever <code>T::T(T&&)</code> throws.
+ Whatever <code>T::operator = (T&&)</code> throws.
+ \par Exception Safety
+ Basic; no-throw if the operation in the <i>Throws</i> section does not throw anything.
+ \par Iterator Invalidation
+ Does not invalidate any iterators with the exception of iterators pointing to the overwritten element.
+ \par Complexity
+ Constant (in the size of the <code>circular_buffer</code>).
+ \sa <code>\link push_front() push_front(const_reference)\endlink</code>,
+ <code>pop_back()</code>, <code>pop_front()</code>
+ */
+ void push_back(rvalue_type item) {
+ push_back_impl<rvalue_type>(boost::move(item));
+ }
+
+ //! Insert a new default-constructed element at the end of the <code>circular_buffer</code>.
+ /*!
+ \post if <code>capacity() > 0</code> then <code>back() == item</code><br>
+ If the <code>circular_buffer</code> is full, the first element will be removed. If the capacity is
+ <code>0</code>, nothing will be inserted.
+ \throws Whatever <code>T::T()</code> throws.
+ Whatever <code>T::T(T&&)</code> throws.
+ Whatever <code>T::operator = (T&&)</code> throws.
+ \par Exception Safety
+ Basic; no-throw if the operation in the <i>Throws</i> section does not throw anything.
+ \par Iterator Invalidation
+ Does not invalidate any iterators with the exception of iterators pointing to the overwritten element.
+ \par Complexity
+ Constant (in the size of the <code>circular_buffer</code>).
+ \sa <code>\link push_front() push_front(const_reference)\endlink</code>,
+ <code>pop_back()</code>, <code>pop_front()</code>
+ */
+ void push_back() {
+ value_type temp;
+ push_back(boost::move(temp));
}
//! Insert a new element at the beginning of the <code>circular_buffer</code>.
@@ -1420,7 +1566,7 @@
<code>0</code>, nothing will be inserted.
\param item The element to be inserted.
\throws Whatever <code>T::T(const T&)</code> throws.
- \throws Whatever <code>T::operator = (const T&)</code> throws.
+ Whatever <code>T::operator = (const T&)</code> throws.
\par Exception Safety
Basic; no-throw if the operation in the <i>Throws</i> section does not throw anything.
\par Iterator Invalidation
@@ -1430,24 +1576,51 @@
\sa <code>\link push_back() push_back(const_reference)\endlink</code>,
<code>pop_back()</code>, <code>pop_front()</code>
*/
- void push_front(param_value_type item = value_type()) {
- BOOST_TRY {
- if (full()) {
- if (empty())
- return;
- decrement(m_first);
- replace(m_first, item);
- m_last = m_first;
- } else {
- decrement(m_first);
- m_alloc.construct(m_first, item);
- ++m_size;
- }
- } BOOST_CATCH(...) {
- increment(m_first);
- BOOST_RETHROW
- }
- BOOST_CATCH_END
+ void push_front(param_value_type item) {
+ push_front_impl<param_value_type>(item);
+ }
+
+ //! Insert a new element at the beginning of the <code>circular_buffer</code> using rvalue references or rvalues references emulation.
+ /*!
+ \post if <code>capacity() > 0</code> then <code>front() == item</code><br>
+ If the <code>circular_buffer</code> is full, the last element will be removed. If the capacity is
+ <code>0</code>, nothing will be inserted.
+ \param item The element to be inserted.
+ \throws Whatever <code>T::T(T&&)</code> throws.
+ Whatever <code>T::operator = (T&&)</code> throws.
+ \par Exception Safety
+ Basic; no-throw if the operation in the <i>Throws</i> section does not throw anything.
+ \par Iterator Invalidation
+ Does not invalidate any iterators with the exception of iterators pointing to the overwritten element.
+ \par Complexity
+ Constant (in the size of the <code>circular_buffer</code>).
+ \sa <code>\link push_back() push_back(const_reference)\endlink</code>,
+ <code>pop_back()</code>, <code>pop_front()</code>
+ */
+ void push_front(rvalue_type item) {
+ push_front_impl<rvalue_type>(boost::move(item));
+ }
+
+ //! Insert a new default-constructed element at the beginning of the <code>circular_buffer</code>.
+ /*!
+ \post if <code>capacity() > 0</code> then <code>front() == item</code><br>
+ If the <code>circular_buffer</code> is full, the last element will be removed. If the capacity is
+ <code>0</code>, nothing will be inserted.
+ \throws Whatever <code>T::T()</code> throws.
+ Whatever <code>T::T(T&&)</code> throws.
+ Whatever <code>T::operator = (T&&)</code> throws.
+ \par Exception Safety
+ Basic; no-throw if the operation in the <i>Throws</i> section does not throw anything.
+ \par Iterator Invalidation
+ Does not invalidate any iterators with the exception of iterators pointing to the overwritten element.
+ \par Complexity
+ Constant (in the size of the <code>circular_buffer</code>).
+ \sa <code>\link push_back() push_back(const_reference)\endlink</code>,
+ <code>pop_back()</code>, <code>pop_front()</code>
+ */
+ void push_front() {
+ value_type temp;
+ push_front(boost::move(temp));
}
//! Remove the last element from the <code>circular_buffer</code>.
@@ -1491,6 +1664,15 @@
increment(m_first);
--m_size;
}
+private:
+ template <class ValT>
+ iterator insert_impl(iterator pos, ValT item) {
+ BOOST_CB_ASSERT(pos.is_valid(this)); // check for uninitialized or invalidated iterator
+ iterator b = begin();
+ if (full() && pos == b)
+ return b;
+ return insert_item<ValT>(pos, static_cast<ValT>(item));
+ }
public:
// Insert
@@ -1507,7 +1689,9 @@
\return Iterator to the inserted element or <code>begin()</code> if the <code>item</code> is not inserted. (See
the <i>Effect</i>.)
\throws Whatever <code>T::T(const T&)</code> throws.
- \throws Whatever <code>T::operator = (const T&)</code> throws.
+ Whatever <code>T::operator = (const T&)</code> throws.
+ Exceptions of move_if_noexcept(T&).
+
\par Exception Safety
Basic; no-throw if the operation in the <i>Throws</i> section does not throw anything.
\par Iterator Invalidation
@@ -1524,12 +1708,77 @@
rinsert(iterator, size_type, value_type)\endlink</code>,
<code>rinsert(iterator, InputIterator, InputIterator)</code>
*/
- iterator insert(iterator pos, param_value_type item = value_type()) {
- BOOST_CB_ASSERT(pos.is_valid(this)); // check for uninitialized or invalidated iterator
- iterator b = begin();
- if (full() && pos == b)
- return b;
- return insert_item(pos, item);
+ iterator insert(iterator pos, param_value_type item) {
+ return insert_impl<param_value_type>(pos, item);
+ }
+
+ //! Insert an element at the specified position.
+ /*!
+ \pre <code>pos</code> is a valid iterator pointing to the <code>circular_buffer</code> or its end.
+ \post The <code>item</code> will be inserted at the position <code>pos</code>.<br>
+ If the <code>circular_buffer</code> is full, the first element will be overwritten. If the
+ <code>circular_buffer</code> is full and the <code>pos</code> points to <code>begin()</code>, then the
+ <code>item</code> will not be inserted. If the capacity is <code>0</code>, nothing will be inserted.
+ \param pos An iterator specifying the position where the <code>item</code> will be inserted.
+ \param item The element to be inserted.
+ \return Iterator to the inserted element or <code>begin()</code> if the <code>item</code> is not inserted. (See
+ the <i>Effect</i>.)
+ \throws Whatever <code>T::T(T&&)</code> throws.
+ Whatever <code>T::operator = (T&&)</code> throws.
+ Exceptions of move_if_noexcept(T&).
+ \par Exception Safety
+ Basic; no-throw if the operation in the <i>Throws</i> section does not throw anything.
+ \par Iterator Invalidation
+ Invalidates iterators pointing to the elements at the insertion point (including <code>pos</code>) and
+ iterators behind the insertion point (towards the end; except iterators equal to <code>end()</code>). It
+ also invalidates iterators pointing to the overwritten element.
+ \par Complexity
+ Linear (in <code>std::distance(pos, end())</code>).
+ \sa <code>\link insert(iterator, size_type, param_value_type)
+ insert(iterator, size_type, value_type)\endlink</code>,
+ <code>insert(iterator, InputIterator, InputIterator)</code>,
+ <code>\link rinsert(iterator, param_value_type) rinsert(iterator, value_type)\endlink</code>,
+ <code>\link rinsert(iterator, size_type, param_value_type)
+ rinsert(iterator, size_type, value_type)\endlink</code>,
+ <code>rinsert(iterator, InputIterator, InputIterator)</code>
+ */
+ iterator insert(iterator pos, rvalue_type item) {
+ return insert_impl<rvalue_type>(pos, boost::move(item));
+ }
+
+ //! Insert a default-constructed element at the specified position.
+ /*!
+ \pre <code>pos</code> is a valid iterator pointing to the <code>circular_buffer</code> or its end.
+ \post The <code>item</code> will be inserted at the position <code>pos</code>.<br>
+ If the <code>circular_buffer</code> is full, the first element will be overwritten. If the
+ <code>circular_buffer</code> is full and the <code>pos</code> points to <code>begin()</code>, then the
+ <code>item</code> will not be inserted. If the capacity is <code>0</code>, nothing will be inserted.
+ \param pos An iterator specifying the position where the <code>item</code> will be inserted.
+ \return Iterator to the inserted element or <code>begin()</code> if the <code>item</code> is not inserted. (See
+ the <i>Effect</i>.)
+ \throws Whatever <code>T::T()</code> throws.
+ Whatever <code>T::T(T&&)</code> throws.
+ Whatever <code>T::operator = (T&&)</code> throws.
+ Exceptions of move_if_noexcept(T&).
+ \par Exception Safety
+ Basic; no-throw if the operation in the <i>Throws</i> section does not throw anything.
+ \par Iterator Invalidation
+ Invalidates iterators pointing to the elements at the insertion point (including <code>pos</code>) and
+ iterators behind the insertion point (towards the end; except iterators equal to <code>end()</code>). It
+ also invalidates iterators pointing to the overwritten element.
+ \par Complexity
+ Linear (in <code>std::distance(pos, end())</code>).
+ \sa <code>\link insert(iterator, size_type, param_value_type)
+ insert(iterator, size_type, value_type)\endlink</code>,
+ <code>insert(iterator, InputIterator, InputIterator)</code>,
+ <code>\link rinsert(iterator, param_value_type) rinsert(iterator, value_type)\endlink</code>,
+ <code>\link rinsert(iterator, size_type, param_value_type)
+ rinsert(iterator, size_type, value_type)\endlink</code>,
+ <code>rinsert(iterator, InputIterator, InputIterator)</code>
+ */
+ iterator insert(iterator pos) {
+ value_type temp;
+ return insert(pos, boost::move(temp));
}
//! Insert <code>n</code> copies of the <code>item</code> at the specified position.
@@ -1543,7 +1792,8 @@
\param n The number of <code>item</code>s the to be inserted.
\param item The element whose copies will be inserted.
\throws Whatever <code>T::T(const T&)</code> throws.
- \throws Whatever <code>T::operator = (const T&)</code> throws.
+ Whatever <code>T::operator = (const T&)</code> throws.
+ Exceptions of move_if_noexcept(T&).
\par Exception Safety
Basic; no-throw if the operations in the <i>Throws</i> section do not throw anything.
\par Iterator Invalidation
@@ -1556,7 +1806,7 @@
Consider a <code>circular_buffer</code> with the capacity of 6 and the size of 4. Its internal buffer may
look like the one below.<br><br>
<code>|1|2|3|4| | |</code><br>
- <code>p ---^</code><br><br>After inserting 5 elements at the position <code>p</code>:<br><br>
+ <code>p ___^</code><br><br>After inserting 5 elements at the position <code>p</code>:<br><br>
<code>insert(p, (size_t)5, 0);</code><br><br>actually only 4 elements get inserted and elements
<code>1</code> and <code>2</code> are overwritten. This is due to the fact the insert operation preserves
the capacity. After insertion the internal buffer looks like this:<br><br><code>|0|0|0|0|3|4|</code><br>
@@ -1594,8 +1844,10 @@
\param pos An iterator specifying the position where the range will be inserted.
\param first The beginning of the range to be inserted.
\param last The end of the range to be inserted.
- \throws Whatever <code>T::T(const T&)</code> throws.
- \throws Whatever <code>T::operator = (const T&)</code> throws.
+ \throws Whatever <code>T::T(const T&)</code> throws if the <code>InputIterator</code> is not a move iterator.
+ Whatever <code>T::operator = (const T&)</code> throws if the <code>InputIterator</code> is not a move iterator.
+ Whatever <code>T::T(T&&)</code> throws if the <code>InputIterator</code> is a move iterator.
+ Whatever <code>T::operator = (T&&)</code> throws if the <code>InputIterator</code> is a move iterator.
\par Exception Safety
Basic; no-throw if the operations in the <i>Throws</i> section do not throw anything.
\par Iterator Invalidation
@@ -1611,7 +1863,7 @@
Consider a <code>circular_buffer</code> with the capacity of 6 and the size of 4. Its internal buffer may
look like the one below.<br><br>
<code>|1|2|3|4| | |</code><br>
- <code>p ---^</code><br><br>After inserting a range of elements at the position <code>p</code>:<br><br>
+ <code>p ___^</code><br><br>After inserting a range of elements at the position <code>p</code>:<br><br>
<code>int array[] = { 5, 6, 7, 8, 9 };</code><br><code>insert(p, array, array + 5);</code><br><br>
actually only elements <code>6</code>, <code>7</code>, <code>8</code> and <code>9</code> from the
specified range get inserted and elements <code>1</code> and <code>2</code> are overwritten. This is due
@@ -1631,42 +1883,16 @@
insert(pos, first, last, is_integral<InputIterator>());
}
- //! Insert an element before the specified position.
- /*!
- \pre <code>pos</code> is a valid iterator pointing to the <code>circular_buffer</code> or its end.
- \post The <code>item</code> will be inserted before the position <code>pos</code>.<br>
- If the <code>circular_buffer</code> is full, the last element will be overwritten. If the
- <code>circular_buffer</code> is full and the <code>pos</code> points to <code>end()</code>, then the
- <code>item</code> will not be inserted. If the capacity is <code>0</code>, nothing will be inserted.
- \param pos An iterator specifying the position before which the <code>item</code> will be inserted.
- \param item The element to be inserted.
- \return Iterator to the inserted element or <code>end()</code> if the <code>item</code> is not inserted. (See
- the <i>Effect</i>.)
- \throws Whatever <code>T::T(const T&)</code> throws.
- \throws Whatever <code>T::operator = (const T&)</code> throws.
- \par Exception Safety
- Basic; no-throw if the operations in the <i>Throws</i> section do not throw anything.
- \par Iterator Invalidation
- Invalidates iterators pointing to the elements before the insertion point (towards the beginning and
- excluding <code>pos</code>). It also invalidates iterators pointing to the overwritten element.
- \par Complexity
- Linear (in <code>std::distance(begin(), pos)</code>).
- \sa <code>\link rinsert(iterator, size_type, param_value_type)
- rinsert(iterator, size_type, value_type)\endlink</code>,
- <code>rinsert(iterator, InputIterator, InputIterator)</code>,
- <code>\link insert(iterator, param_value_type) insert(iterator, value_type)\endlink</code>,
- <code>\link insert(iterator, size_type, param_value_type)
- insert(iterator, size_type, value_type)\endlink</code>,
- <code>insert(iterator, InputIterator, InputIterator)</code>
- */
- iterator rinsert(iterator pos, param_value_type item = value_type()) {
+private:
+ template <class ValT>
+ iterator rinsert_impl(iterator pos, ValT item) {
BOOST_CB_ASSERT(pos.is_valid(this)); // check for uninitialized or invalidated iterator
if (full() && pos.m_it == 0)
return end();
if (pos == begin()) {
BOOST_TRY {
decrement(m_first);
- construct_or_replace(!full(), m_first, item);
+ construct_or_replace(!full(), m_first, static_cast<ValT>(item));
} BOOST_CATCH(...) {
increment(m_first);
BOOST_RETHROW
@@ -1681,13 +1907,13 @@
bool construct = !full();
BOOST_TRY {
while (src != pos.m_it) {
- construct_or_replace(construct, dest, *src);
+ construct_or_replace(construct, dest, this_type::move_if_noexcept(*src));
increment(src);
increment(dest);
construct = false;
}
decrement(pos.m_it);
- replace(pos.m_it, item);
+ replace(pos.m_it, static_cast<ValT>(item));
} BOOST_CATCH(...) {
if (!construct && !full()) {
decrement(m_first);
@@ -1705,6 +1931,108 @@
return iterator(this, pos.m_it);
}
+public:
+
+ //! Insert an element before the specified position.
+ /*!
+ \pre <code>pos</code> is a valid iterator pointing to the <code>circular_buffer</code> or its end.
+ \post The <code>item</code> will be inserted before the position <code>pos</code>.<br>
+ If the <code>circular_buffer</code> is full, the last element will be overwritten. If the
+ <code>circular_buffer</code> is full and the <code>pos</code> points to <code>end()</code>, then the
+ <code>item</code> will not be inserted. If the capacity is <code>0</code>, nothing will be inserted.
+ \param pos An iterator specifying the position before which the <code>item</code> will be inserted.
+ \param item The element to be inserted.
+ \return Iterator to the inserted element or <code>end()</code> if the <code>item</code> is not inserted. (See
+ the <i>Effect</i>.)
+ \throws Whatever <code>T::T(const T&)</code> throws.
+ Whatever <code>T::operator = (const T&)</code> throws.
+ Exceptions of move_if_noexcept(T&).
+ \par Exception Safety
+ Basic; no-throw if the operations in the <i>Throws</i> section do not throw anything.
+ \par Iterator Invalidation
+ Invalidates iterators pointing to the elements before the insertion point (towards the beginning and
+ excluding <code>pos</code>). It also invalidates iterators pointing to the overwritten element.
+ \par Complexity
+ Linear (in <code>std::distance(begin(), pos)</code>).
+ \sa <code>\link rinsert(iterator, size_type, param_value_type)
+ rinsert(iterator, size_type, value_type)\endlink</code>,
+ <code>rinsert(iterator, InputIterator, InputIterator)</code>,
+ <code>\link insert(iterator, param_value_type) insert(iterator, value_type)\endlink</code>,
+ <code>\link insert(iterator, size_type, param_value_type)
+ insert(iterator, size_type, value_type)\endlink</code>,
+ <code>insert(iterator, InputIterator, InputIterator)</code>
+ */
+ iterator rinsert(iterator pos, param_value_type item) {
+ return rinsert_impl<param_value_type>(pos, item);
+ }
+
+ //! Insert an element before the specified position.
+ /*!
+ \pre <code>pos</code> is a valid iterator pointing to the <code>circular_buffer</code> or its end.
+ \post The <code>item</code> will be inserted before the position <code>pos</code>.<br>
+ If the <code>circular_buffer</code> is full, the last element will be overwritten. If the
+ <code>circular_buffer</code> is full and the <code>pos</code> points to <code>end()</code>, then the
+ <code>item</code> will not be inserted. If the capacity is <code>0</code>, nothing will be inserted.
+ \param pos An iterator specifying the position before which the <code>item</code> will be inserted.
+ \param item The element to be inserted.
+ \return Iterator to the inserted element or <code>end()</code> if the <code>item</code> is not inserted. (See
+ the <i>Effect</i>.)
+ \throws Whatever <code>T::T(T&&)</code> throws.
+ Whatever <code>T::operator = (T&&)</code> throws.
+ Exceptions of move_if_noexcept(T&).
+ \par Exception Safety
+ Basic; no-throw if the operations in the <i>Throws</i> section do not throw anything.
+ \par Iterator Invalidation
+ Invalidates iterators pointing to the elements before the insertion point (towards the beginning and
+ excluding <code>pos</code>). It also invalidates iterators pointing to the overwritten element.
+ \par Complexity
+ Linear (in <code>std::distance(begin(), pos)</code>).
+ \sa <code>\link rinsert(iterator, size_type, param_value_type)
+ rinsert(iterator, size_type, value_type)\endlink</code>,
+ <code>rinsert(iterator, InputIterator, InputIterator)</code>,
+ <code>\link insert(iterator, param_value_type) insert(iterator, value_type)\endlink</code>,
+ <code>\link insert(iterator, size_type, param_value_type)
+ insert(iterator, size_type, value_type)\endlink</code>,
+ <code>insert(iterator, InputIterator, InputIterator)</code>
+ */
+ iterator rinsert(iterator pos, rvalue_type item) {
+ return rinsert_impl<rvalue_type>(pos, boost::move(item));
+ }
+
+ //! Insert an element before the specified position.
+ /*!
+ \pre <code>pos</code> is a valid iterator pointing to the <code>circular_buffer</code> or its end.
+ \post The <code>item</code> will be inserted before the position <code>pos</code>.<br>
+ If the <code>circular_buffer</code> is full, the last element will be overwritten. If the
+ <code>circular_buffer</code> is full and the <code>pos</code> points to <code>end()</code>, then the
+ <code>item</code> will not be inserted. If the capacity is <code>0</code>, nothing will be inserted.
+ \param pos An iterator specifying the position before which the <code>item</code> will be inserted.
+ \return Iterator to the inserted element or <code>end()</code> if the <code>item</code> is not inserted. (See
+ the <i>Effect</i>.)
+ \throws Whatever <code>T::T()</code> throws.
+ Whatever <code>T::T(T&&)</code> throws.
+ Whatever <code>T::operator = (T&&)</code> throws.
+ Exceptions of move_if_noexcept(T&).
+ \par Exception Safety
+ Basic; no-throw if the operations in the <i>Throws</i> section do not throw anything.
+ \par Iterator Invalidation
+ Invalidates iterators pointing to the elements before the insertion point (towards the beginning and
+ excluding <code>pos</code>). It also invalidates iterators pointing to the overwritten element.
+ \par Complexity
+ Linear (in <code>std::distance(begin(), pos)</code>).
+ \sa <code>\link rinsert(iterator, size_type, param_value_type)
+ rinsert(iterator, size_type, value_type)\endlink</code>,
+ <code>rinsert(iterator, InputIterator, InputIterator)</code>,
+ <code>\link insert(iterator, param_value_type) insert(iterator, value_type)\endlink</code>,
+ <code>\link insert(iterator, size_type, param_value_type)
+ insert(iterator, size_type, value_type)\endlink</code>,
+ <code>insert(iterator, InputIterator, InputIterator)</code>
+ */
+ iterator rinsert(iterator pos) {
+ value_type temp;
+ return rinsert(pos, boost::move(temp));
+ }
+
//! Insert <code>n</code> copies of the <code>item</code> before the specified position.
/*!
\pre <code>pos</code> is a valid iterator pointing to the <code>circular_buffer</code> or its end.
@@ -1716,7 +2044,8 @@
\param n The number of <code>item</code>s the to be inserted.
\param item The element whose copies will be inserted.
\throws Whatever <code>T::T(const T&)</code> throws.
- \throws Whatever <code>T::operator = (const T&)</code> throws.
+ Whatever <code>T::operator = (const T&)</code> throws.
+ Exceptions of move_if_noexcept(T&).
\par Exception Safety
Basic; no-throw if the operations in the <i>Throws</i> section do not throw anything.
\par Iterator Invalidation
@@ -1728,7 +2057,7 @@
Consider a <code>circular_buffer</code> with the capacity of 6 and the size of 4. Its internal buffer may
look like the one below.<br><br>
<code>|1|2|3|4| | |</code><br>
- <code>p ---^</code><br><br>After inserting 5 elements before the position <code>p</code>:<br><br>
+ <code>p ___^</code><br><br>After inserting 5 elements before the position <code>p</code>:<br><br>
<code>rinsert(p, (size_t)5, 0);</code><br><br>actually only 4 elements get inserted and elements
<code>3</code> and <code>4</code> are overwritten. This is due to the fact the rinsert operation preserves
the capacity. After insertion the internal buffer looks like this:<br><br><code>|1|2|0|0|0|0|</code><br>
@@ -1759,8 +2088,10 @@
\param pos An iterator specifying the position where the range will be inserted.
\param first The beginning of the range to be inserted.
\param last The end of the range to be inserted.
- \throws Whatever <code>T::T(const T&)</code> throws.
- \throws Whatever <code>T::operator = (const T&)</code> throws.
+ \throws Whatever <code>T::T(const T&)</code> throws if the <code>InputIterator</code> is not a move iterator.
+ Whatever <code>T::operator = (const T&)</code> throws if the <code>InputIterator</code> is not a move iterator.
+ Whatever <code>T::T(T&&)</code> throws if the <code>InputIterator</code> is a move iterator.
+ Whatever <code>T::operator = (T&&)</code> throws if the <code>InputIterator</code> is a move iterator.
\par Exception Safety
Basic; no-throw if the operations in the <i>Throws</i> section do not throw anything.
\par Iterator Invalidation
@@ -1775,7 +2106,7 @@
Consider a <code>circular_buffer</code> with the capacity of 6 and the size of 4. Its internal buffer may
look like the one below.<br><br>
<code>|1|2|3|4| | |</code><br>
- <code>p ---^</code><br><br>After inserting a range of elements before the position <code>p</code>:<br><br>
+ <code>p ___^</code><br><br>After inserting a range of elements before the position <code>p</code>:<br><br>
<code>int array[] = { 5, 6, 7, 8, 9 };</code><br><code>insert(p, array, array + 5);</code><br><br>
actually only elements <code>5</code>, <code>6</code>, <code>7</code> and <code>8</code> from the
specified range get inserted and elements <code>3</code> and <code>4</code> are overwritten. This is due
@@ -1805,7 +2136,7 @@
\param pos An iterator pointing at the element to be removed.
\return Iterator to the first element remaining beyond the removed element or <code>end()</code> if no such
element exists.
- \throws Whatever <code>T::operator = (const T&)</code> throws.
+ \throws Exceptions of move_if_noexcept(T&).
\par Exception Safety
Basic; no-throw if the operation in the <i>Throws</i> section does not throw anything.
\par Iterator Invalidation
@@ -1823,7 +2154,7 @@
pointer next = pos.m_it;
increment(next);
for (pointer p = pos.m_it; next != m_last; p = next, increment(next))
- replace(p, *next);
+ replace(p, this_type::move_if_noexcept(*next));
decrement(m_last);
destroy_item(m_last);
--m_size;
@@ -1843,7 +2174,7 @@
\param last The end of the range to be removed.
\return Iterator to the first element remaining beyond the removed elements or <code>end()</code> if no such
element exists.
- \throws Whatever <code>T::operator = (const T&)</code> throws.
+ \throws Exceptions of move_if_noexcept(T&).
\par Exception Safety
Basic; no-throw if the operation in the <i>Throws</i> section does not throw anything.
\par Iterator Invalidation
@@ -1862,7 +2193,7 @@
return first;
pointer p = first.m_it;
while (last.m_it != 0)
- replace((first++).m_it, *last++);
+ replace((first++).m_it, this_type::move_if_noexcept(*last++));
do {
decrement(m_last);
destroy_item(m_last);
@@ -1879,7 +2210,7 @@
\param pos An iterator pointing at the element to be removed.
\return Iterator to the first element remaining in front of the removed element or <code>begin()</code> if no
such element exists.
- \throws Whatever <code>T::operator = (const T&)</code> throws.
+ \throws Exceptions of move_if_noexcept(T&).
\par Exception Safety
Basic; no-throw if the operation in the <i>Throws</i> section does not throw anything.
\par Iterator Invalidation
@@ -1900,7 +2231,7 @@
pointer prev = pos.m_it;
pointer p = prev;
for (decrement(prev); p != m_first; p = prev, decrement(prev))
- replace(p, *prev);
+ replace(p, this_type::move_if_noexcept(*prev));
destroy_item(m_first);
increment(m_first);
--m_size;
@@ -1920,7 +2251,7 @@
\param last The end of the range to be removed.
\return Iterator to the first element remaining in front of the removed elements or <code>begin()</code> if no
such element exists.
- \throws Whatever <code>T::operator = (const T&)</code> throws.
+ \throws Exceptions of move_if_noexcept(T&).
\par Exception Safety
Basic; no-throw if the operation in the <i>Throws</i> section does not throw anything.
\par Iterator Invalidation
@@ -1945,7 +2276,7 @@
while (first.m_it != m_first) {
decrement(first.m_it);
decrement(p);
- replace(p, *first.m_it);
+ replace(p, this_type::move_if_noexcept(*first.m_it));
}
do {
destroy_item(m_first);
@@ -1963,7 +2294,7 @@
\pre <code>n \<= size()</code>
\post The <code>n</code> elements at the beginning of the <code>circular_buffer</code> will be removed.
\param n The number of elements to be removed.
- \throws Whatever <code>T::operator = (const T&)</code> throws. (Does not throw anything in case of scalars.)
+ \throws Exceptions of move_if_noexcept(T&).
\par Exception Safety
Basic; no-throw if the operation in the <i>Throws</i> section does not throw anything. (I.e. no throw in
case of scalars.)
@@ -1995,7 +2326,7 @@
\pre <code>n \<= size()</code>
\post The <code>n</code> elements at the end of the <code>circular_buffer</code> will be removed.
\param n The number of elements to be removed.
- \throws Whatever <code>T::operator = (const T&)</code> throws. (Does not throw anything in case of scalars.)
+ \throws Exceptions of move_if_noexcept(T&).
\par Exception Safety
Basic; no-throw if the operation in the <i>Throws</i> section does not throw anything. (I.e. no throw in
case of scalars.)
@@ -2037,7 +2368,7 @@
<code>rerase(iterator)</code>, <code>rerase(iterator, iterator)</code>,
<code>erase_begin(size_type)</code>, <code>erase_end(size_type)</code>
*/
- void clear() {
+ void clear() BOOST_NOEXCEPT {
destroy_content();
m_size = 0;
}
@@ -2101,7 +2432,7 @@
}
//! Does the pointer point to the uninitialized memory?
- bool is_uninitialized(const_pointer p) const {
+ bool is_uninitialized(const_pointer p) const BOOST_NOEXCEPT {
return p >= m_last && (m_first < m_last || p < m_first);
}
@@ -2113,6 +2444,14 @@
#endif
}
+ //! Replace an element.
+ void replace(pointer pos, rvalue_type item) {
+ *pos = boost::move(item);
+#if BOOST_CB_ENABLE_DEBUG
+ invalidate_iterators(iterator(this, pos));
+#endif
+ }
+
//! Construct or replace an element.
/*!
<code>construct</code> has to be set to <code>true</code> if and only if
@@ -2120,11 +2459,23 @@
*/
void construct_or_replace(bool construct, pointer pos, param_value_type item) {
if (construct)
- m_alloc.construct(pos, item);
+ ::new (pos) value_type(item);
else
replace(pos, item);
}
+ //! Construct or replace an element.
+ /*!
+ <code>construct</code> has to be set to <code>true</code> if and only if
+ <code>pos</code> points to an uninitialized memory.
+ */
+ void construct_or_replace(bool construct, pointer pos, rvalue_type item) {
+ if (construct)
+ ::new (pos) value_type(boost::move(item));
+ else
+ replace(pos, boost::move(item));
+ }
+
//! Destroy an item.
void destroy_item(pointer p) {
m_alloc.destroy(p);
@@ -2161,7 +2512,7 @@
}
//! Destroy content and free allocated memory.
- void destroy() {
+ void destroy() BOOST_NOEXCEPT {
destroy_content();
deallocate(m_buff, capacity());
#if BOOST_CB_ENABLE_DEBUG
@@ -2216,7 +2567,7 @@
// for containers
std::deque<value_type, allocator_type> tmp(first, last, m_alloc);
size_type distance = tmp.size();
- initialize(distance, tmp.begin(), tmp.end(), distance);
+ initialize(distance, boost::make_move_iterator(tmp.begin()), boost::make_move_iterator(tmp.end()), distance);
}
//! Specialized initialize method.
@@ -2260,7 +2611,7 @@
if (buffer_capacity == 0)
return;
while (first != last && !full()) {
- m_alloc.construct(m_last, *first++);
+ ::new (m_last) value_type(*first++);
increment(m_last);
++m_size;
}
@@ -2296,7 +2647,7 @@
m_size = distance;
}
BOOST_TRY {
- m_last = cb_details::uninitialized_copy_with_alloc(first, last, m_buff, m_alloc);
+ m_last = cb_details::uninitialized_copy<value_type>(first, last, m_buff);
} BOOST_CATCH(...) {
deallocate(m_buff, buffer_capacity);
BOOST_RETHROW
@@ -2350,8 +2701,8 @@
std::deque<value_type, allocator_type> tmp(first, last, m_alloc);
size_type distance = tmp.size();
assign_n(distance, distance,
- cb_details::assign_range<BOOST_DEDUCED_TYPENAME std::deque<value_type, allocator_type>::iterator,
- allocator_type>(tmp.begin(), tmp.end(), m_alloc));
+ cb_details::make_assign_range<value_type>
+ (boost::make_move_iterator(tmp.begin()), boost::make_move_iterator(tmp.end())));
}
//! Specialized assign method.
@@ -2359,7 +2710,7 @@
void assign(ForwardIterator first, ForwardIterator last, const std::forward_iterator_tag&) {
BOOST_CB_ASSERT(std::distance(first, last) >= 0); // check for wrong range
size_type distance = std::distance(first, last);
- assign_n(distance, distance, cb_details::assign_range<ForwardIterator, allocator_type>(first, last, m_alloc));
+ assign_n(distance, distance, cb_details::make_assign_range<value_type>(first, last));
}
//! Specialized assign method.
@@ -2407,7 +2758,7 @@
distance = new_capacity;
}
assign_n(new_capacity, distance,
- cb_details::assign_range<ForwardIterator, allocator_type>(first, last, m_alloc));
+ cb_details::make_assign_range<value_type>(first, last));
}
//! Helper assign method.
@@ -2441,10 +2792,11 @@
}
//! Helper insert method.
- iterator insert_item(const iterator& pos, param_value_type item) {
+ template <class ValT>
+ iterator insert_item(const iterator& pos, ValT item) {
pointer p = pos.m_it;
if (p == 0) {
- construct_or_replace(!full(), m_last, item);
+ construct_or_replace(!full(), m_last, static_cast<ValT>(item));
p = m_last;
} else {
pointer src = m_last;
@@ -2453,11 +2805,11 @@
BOOST_TRY {
while (src != p) {
decrement(src);
- construct_or_replace(construct, dest, *src);
+ construct_or_replace(construct, dest, this_type::move_if_noexcept(*src));
decrement(dest);
construct = false;
}
- replace(p, item);
+ replace(p, static_cast<ValT>(item));
} BOOST_CATCH(...) {
if (!construct && !full()) {
increment(m_last);
@@ -2497,7 +2849,7 @@
void insert(iterator pos, InputIterator first, InputIterator last, const std::input_iterator_tag&) {
if (!full() || pos != begin()) {
for (;first != last; ++pos)
- pos = insert_item(pos, *first++);
+ pos = insert(pos, *first++);
}
}
@@ -2529,7 +2881,7 @@
pointer p = m_last;
BOOST_TRY {
for (; ii < construct; ++ii, increment(p))
- m_alloc.construct(p, *wrapper());
+ ::new (p) value_type(*wrapper());
for (;ii < n; ++ii, increment(p))
replace(p, *wrapper());
} BOOST_CATCH(...) {
@@ -2623,7 +2975,7 @@
for (;ii > construct; --ii, increment(p))
replace(p, *wrapper());
for (; ii > 0; --ii, increment(p))
- m_alloc.construct(p, *wrapper());
+ ::new (p) value_type(*wrapper());
} BOOST_CATCH(...) {
size_type constructed = ii < construct ? construct - ii : 0;
m_last = add(m_last, constructed);
@@ -2810,7 +3162,7 @@
\sa <code>\link circular_buffer::swap(circular_buffer<T, Alloc>&) swap(circular_buffer<T, Alloc>&)\endlink</code>
*/
template <class T, class Alloc>
-inline void swap(circular_buffer<T, Alloc>& lhs, circular_buffer<T, Alloc>& rhs) {
+inline void swap(circular_buffer<T, Alloc>& lhs, circular_buffer<T, Alloc>& rhs) BOOST_NOEXCEPT {
lhs.swap(rhs);
}
Modified: branches/release/boost/circular_buffer/details.hpp
==============================================================================
--- branches/release/boost/circular_buffer/details.hpp Thu Aug 29 02:10:38 2013 (r85509)
+++ branches/release/boost/circular_buffer/details.hpp 2013-08-29 04:39:09 EDT (Thu, 29 Aug 2013) (r85510)
@@ -15,9 +15,19 @@
#include <boost/iterator.hpp>
#include <boost/throw_exception.hpp>
+#include <boost/move/move.hpp>
+#include <boost/type_traits/is_nothrow_move_constructible.hpp>
#include <boost/detail/no_exceptions_support.hpp>
#include <iterator>
+// Silence MS /W4 warnings like C4913:
+// "user defined binary operator ',' exists but no overload could convert all operands, default built-in binary operator ',' used"
+// This might happen when previously including some boost headers that overload the coma operator.
+#if defined(_MSC_VER)
+# pragma warning(push)
+# pragma warning(disable:4913)
+#endif
+
namespace boost {
namespace cb_details {
@@ -28,9 +38,11 @@
void uninitialized_fill_n_with_alloc(
ForwardIterator first, Diff n, const T& item, Alloc& alloc);
-template<class InputIterator, class ForwardIterator, class Alloc>
-ForwardIterator uninitialized_copy_with_alloc(
- InputIterator first, InputIterator last, ForwardIterator dest, Alloc& alloc);
+template<class ValueType, class InputIterator, class ForwardIterator>
+ForwardIterator uninitialized_copy(InputIterator first, InputIterator last, ForwardIterator dest);
+
+template<class ValueType, class InputIterator, class ForwardIterator>
+ForwardIterator uninitialized_move_if_noexcept(InputIterator first, InputIterator last, ForwardIterator dest);
/*!
\struct const_traits
@@ -115,21 +127,25 @@
\struct assign_range
\brief Helper functor for assigning range of items.
*/
-template <class Iterator, class Alloc>
+template <class ValueType, class Iterator>
struct assign_range {
- const Iterator& m_first;
- const Iterator& m_last;
- Alloc& m_alloc;
- assign_range(const Iterator& first, const Iterator& last, Alloc& alloc)
- : m_first(first), m_last(last), m_alloc(alloc) {}
+ Iterator m_first;
+ Iterator m_last;
+
+ assign_range(const Iterator& first, const Iterator& last) BOOST_NOEXCEPT
+ : m_first(first), m_last(last) {}
+
template <class Pointer>
void operator () (Pointer p) const {
- uninitialized_copy_with_alloc(m_first, m_last, p, m_alloc);
+ boost::cb_details::uninitialized_copy<ValueType>(m_first, m_last, p);
}
-private:
- assign_range<Iterator, Alloc>& operator = (const assign_range<Iterator, Alloc>&); // do not generate
};
+template <class ValueType, class Iterator>
+inline assign_range<ValueType, Iterator> make_assign_range(const Iterator& first, const Iterator& last) {
+ return assign_range<ValueType, Iterator>(first, last);
+}
+
/*!
\class capacity_control
\brief Capacity controller of the space optimized circular buffer.
@@ -137,18 +153,19 @@
template <class Size>
class capacity_control {
- //! The capacity of the space optimized circular buffer.
+ //! The capacity of the space-optimized circular buffer.
Size m_capacity;
- //! The lowest guaranteed capacity of the adapted circular buffer.
+ //! The lowest guaranteed or minimum capacity of the adapted space-optimized circular buffer.
Size m_min_capacity;
public:
//! Constructor.
capacity_control(Size buffer_capacity, Size min_buffer_capacity = 0)
- : m_capacity(buffer_capacity), m_min_capacity(min_buffer_capacity) {
- BOOST_CB_ASSERT(buffer_capacity >= min_buffer_capacity); // check for capacity lower than min_capacity
+ : m_capacity(buffer_capacity), m_min_capacity(min_buffer_capacity)
+ { // Check for capacity lower than min_capacity.
+ BOOST_CB_ASSERT(buffer_capacity >= min_buffer_capacity);
}
// Default copy constructor.
@@ -425,26 +442,53 @@
#endif // #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_MSVC_STD_ITERATOR)
/*!
- \fn ForwardIterator uninitialized_copy_with_alloc(InputIterator first, InputIterator last, ForwardIterator dest,
- Alloc& alloc)
- \brief Equivalent of <code>std::uninitialized_copy</code> with allocator.
-*/
-template<class InputIterator, class ForwardIterator, class Alloc>
-inline ForwardIterator uninitialized_copy_with_alloc(InputIterator first, InputIterator last, ForwardIterator dest,
- Alloc& alloc) {
+ \fn ForwardIterator uninitialized_copy(InputIterator first, InputIterator last, ForwardIterator dest)
+ \brief Equivalent of <code>std::uninitialized_copy</code> but with explicit specification of value type.
+*/
+template<class ValueType, class InputIterator, class ForwardIterator>
+inline ForwardIterator uninitialized_copy(InputIterator first, InputIterator last, ForwardIterator dest) {
+ typedef ValueType value_type;
+
+ // We do not use allocator.construct and allocator.destroy
+ // because C++03 requires to take parameter by const reference but
+ // Boost.move requires nonconst reference
ForwardIterator next = dest;
BOOST_TRY {
for (; first != last; ++first, ++dest)
- alloc.construct(dest, *first);
+ ::new (dest) value_type(*first);
} BOOST_CATCH(...) {
for (; next != dest; ++next)
- alloc.destroy(next);
+ next->~value_type();
BOOST_RETHROW
}
BOOST_CATCH_END
return dest;
}
+template<class ValueType, class InputIterator, class ForwardIterator>
+ForwardIterator uninitialized_move_if_noexcept_impl(InputIterator first, InputIterator last, ForwardIterator dest,
+ true_type) {
+ for (; first != last; ++first, ++dest)
+ ::new (dest) ValueType(boost::move(*first));
+ return dest;
+}
+
+template<class ValueType, class InputIterator, class ForwardIterator>
+ForwardIterator uninitialized_move_if_noexcept_impl(InputIterator first, InputIterator last, ForwardIterator dest,
+ false_type) {
+ return uninitialized_copy<ValueType>(first, last, dest);
+}
+
+/*!
+ \fn ForwardIterator uninitialized_move_if_noexcept(InputIterator first, InputIterator last, ForwardIterator dest)
+ \brief Equivalent of <code>std::uninitialized_copy</code> but with explicit specification of value type and moves elements if they have noexcept move constructors.
+*/
+template<class ValueType, class InputIterator, class ForwardIterator>
+ForwardIterator uninitialized_move_if_noexcept(InputIterator first, InputIterator last, ForwardIterator dest) {
+ typedef typename boost::is_nothrow_move_constructible<ValueType>::type tag_t;
+ return uninitialized_move_if_noexcept_impl<ValueType>(first, last, dest, tag_t());
+}
+
/*!
\fn void uninitialized_fill_n_with_alloc(ForwardIterator first, Diff n, const T& item, Alloc& alloc)
\brief Equivalent of <code>std::uninitialized_fill_n</code> with allocator.
@@ -467,4 +511,8 @@
} // namespace boost
+#if defined(_MSC_VER)
+# pragma warning(pop)
+#endif
+
#endif // #if !defined(BOOST_CIRCULAR_BUFFER_DETAILS_HPP)
Modified: branches/release/boost/circular_buffer/space_optimized.hpp
==============================================================================
--- branches/release/boost/circular_buffer/space_optimized.hpp Thu Aug 29 02:10:38 2013 (r85509)
+++ branches/release/boost/circular_buffer/space_optimized.hpp 2013-08-29 04:39:09 EDT (Thu, 29 Aug 2013) (r85510)
@@ -1,6 +1,8 @@
// Implementation of the circular buffer adaptor.
// Copyright (c) 2003-2008 Jan Gaspar
+// Copyright (c) 2013 Paul A. Bristow // Doxygen comments changed for new version of documentation.
+// Copyright (c) 2013 Antony Polukhin // Move semantics implementation.
// Use, modification, and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -20,10 +22,9 @@
/*!
\class circular_buffer_space_optimized
- \brief Space optimized circular buffer container adaptor.
-
- For detailed documentation of the space_optimized_circular_buffer visit:
- http://www.boost.org/libs/circular_buffer/doc/space_optimized.html
+ \brief Space optimized circular buffer container adaptor.
+ <code>T</code> must be a copyable class or must have an noexcept move constructor
+ and move assignment operator.
*/
template <class T, class Alloc>
class circular_buffer_space_optimized :
@@ -51,29 +52,53 @@
typedef typename circular_buffer<T, Alloc>::array_range array_range;
typedef typename circular_buffer<T, Alloc>::const_array_range const_array_range;
typedef typename circular_buffer<T, Alloc>::param_value_type param_value_type;
- typedef typename circular_buffer<T, Alloc>::return_value_type return_value_type;
+ typedef typename circular_buffer<T, Alloc>::rvalue_type rvalue_type;
+ //typedef typename circular_buffer<T, Alloc>::return_value_type return_value_type;
- //! Capacity controller of the space optimized circular buffer.
- /*!
- <p><pre>
-class capacity_control {
- size_type m_capacity;
- size_type m_min_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; }
-};</pre></p>
- \pre <code>capacity >= min_capacity</code>
- <p>The <code>capacity()</code> represents the capacity of the <code>circular_buffer_space_optimized</code> and
- the <code>min_capacity()</code> determines the minimal allocated size of its internal buffer.</p>
- <p>The converting constructor of the <code>capacity_control</code> allows implicit conversion from
- <code>size_type</code>-like types which ensures compatibility of creating an instance of the
- <code>circular_buffer_space_optimized</code> with other STL containers. On the other hand the operator
- <code>%size_type()</code> provides implicit conversion to the <code>size_type</code> which allows to treat the
- capacity of the <code>circular_buffer_space_optimized</code> the same way as in the
- <code>circular_buffer</code>.</p>
+/* <pre> is not passed through to html or pdf. So <br> is used in code section below. Ugly :-(
+Ideally want a link to capacity_control, but this would require include details
+and this would expose all the functions in details.
+There must be a better way of doing this.
+*/
+
+ /*! Capacity controller of the space optimized circular buffer.
+
+ \see capacity_control in details.hpp.
+<p>
+<code>
+class capacity_control<br>
+{<br>
+ size_type m_capacity; // Available capacity.<br>
+ size_type m_min_capacity; // Minimum capacity.<br>
+public:<br>
+ capacity_control(size_type capacity, size_type min_capacity = 0)<br>
+ : m_capacity(capacity), m_min_capacity(min_capacity)<br>
+ {};<br>
+ size_type %capacity() const { return m_capacity; }<br>
+ size_type min_capacity() const { return m_min_capacity; }<br>
+ operator size_type() const { return m_capacity; }<br>
+};<br>
+</code>
+</p>
+
+
+ <p>Always
+ <code>capacity >= min_capacity</code>.
+ </p>
+ <p>
+ The <code>capacity()</code> represents the capacity
+ of the <code>circular_buffer_space_optimized</code> and
+ the <code>min_capacity()</code> determines the minimal allocated size of its internal buffer.
+ </p>
+ <p>The converting constructor of the <code>capacity_control</code> allows implicit conversion from
+ <code>size_type</code>-like types which ensures compatibility of creating an instance of the
+ <code>circular_buffer_space_optimized</code> with other STL containers.
+
+ On the other hand the operator <code>%size_type()</code>
+ provides implicit conversion to the <code>size_type</code> which allows to treat the
+ capacity of the <code>circular_buffer_space_optimized</code> the same way as in the
+ <code>circular_buffer</a></code>.
+</p>
*/
typedef cb_details::capacity_control<size_type> capacity_type;
@@ -98,7 +123,7 @@
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
reference operator [] (size_type n) { return circular_buffer<T, Alloc>::operator[](n); }
- return_value_type operator [] (size_type n) const { return circular_buffer<T, Alloc>::operator[](n); }
+ const_reference operator [] (size_type n) const { return circular_buffer<T, Alloc>::operator[](n); }
#else
using circular_buffer<T, Alloc>::operator[];
#endif
@@ -125,7 +150,7 @@
Constant (in the size of the <code>circular_buffer_space_optimized</code>).
\sa <code>empty()</code>
*/
- bool full() const { return m_capacity_ctrl == size(); }
+ bool full() const BOOST_NOEXCEPT { return m_capacity_ctrl == size(); }
/*! \brief Get the maximum number of elements which can be inserted into the
<code>circular_buffer_space_optimized</code> without overwriting any of already stored elements.
@@ -139,7 +164,7 @@
Constant (in the size of the <code>circular_buffer_space_optimized</code>).
\sa <code>capacity()</code>, <code>size()</code>, <code>max_size()</code>
*/
- size_type reserve() const { return m_capacity_ctrl - size(); }
+ size_type reserve() const BOOST_NOEXCEPT { return m_capacity_ctrl - size(); }
//! Get the capacity of the <code>circular_buffer_space_optimized</code>.
/*!
@@ -155,7 +180,7 @@
\sa <code>reserve()</code>, <code>size()</code>, <code>max_size()</code>,
<code>set_capacity(const capacity_type&)</code>
*/
- const capacity_type& capacity() const { return m_capacity_ctrl; }
+ const capacity_type& capacity() const BOOST_NOEXCEPT { return m_capacity_ctrl; }
#if defined(BOOST_CB_TEST)
@@ -164,7 +189,7 @@
\note This method is not intended to be used directly by the user.
It is defined only for testing purposes.
*/
- size_type internal_capacity() const { return circular_buffer<T, Alloc>::capacity(); }
+ size_type internal_capacity() const BOOST_NOEXCEPT { return circular_buffer<T, Alloc>::capacity(); }
#endif // #if defined(BOOST_CB_TEST)
@@ -178,9 +203,9 @@
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 <code>capacity_ctrl.min_capacity()</code>.
\param capacity_ctrl The new capacity controller.
- \throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
+ \throws "An allocation error" if memory is exhausted, (<code>std::bad_alloc</code> if the standard allocator is
used).
- \throws Whatever <code>T::T(const T&)</code> throws.
+ Whatever <code>T::T(const T&)</code> throws or nothing if <code>T::T(T&&)</code> is noexcept.
\par Exception Safety
Strong.
\par Iterator Invalidation
@@ -222,7 +247,7 @@
the requested size. (See the <i>Effect</i>.)
\throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
used).
- \throws Whatever <code>T::T(const T&)</code> throws.
+ Whatever <code>T::T(const T&)</code> throws.
\par Exception Safety
Basic.
\par Iterator Invalidation
@@ -257,7 +282,7 @@
\param capacity_ctrl The new capacity controller.
\throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
used).
- \throws Whatever <code>T::T(const T&)</code> throws.
+ Whatever <code>T::T(const T&)</code> throws or nothing if <code>T::T(T&&)</code> is noexcept.
\par Exception Safety
Strong.
\par Iterator Invalidation
@@ -293,7 +318,7 @@
the requested size. (See the <i>Effect</i>.)
\throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
used).
- \throws Whatever <code>T::T(const T&)</code> throws.
+ Whatever <code>T::T(const T&)</code> throws.
\par Exception Safety
Basic.
\par Iterator Invalidation
@@ -324,7 +349,7 @@
\warning Since Boost version 1.36 the behaviour of this constructor has changed. Now it creates a space
optimized circular buffer with zero capacity.
*/
- explicit circular_buffer_space_optimized(const allocator_type& alloc = allocator_type())
+ explicit circular_buffer_space_optimized(const allocator_type& alloc = allocator_type()) BOOST_NOEXCEPT
: circular_buffer<T, Alloc>(0, alloc)
, m_capacity_ctrl(0) {}
@@ -382,7 +407,7 @@
\param alloc The allocator.
\throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
used).
- \throws Whatever <code>T::T(const T&)</code> throws.
+ Whatever <code>T::T(const T&)</code> throws.
\par Complexity
Linear (in the <code>n</code>).
*/
@@ -424,7 +449,7 @@
\param cb The <code>circular_buffer_space_optimized</code> to be copied.
\throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
used).
- \throws Whatever <code>T::T(const T&)</code> throws.
+ Whatever <code>T::T(const T&)</code> throws.
\par Complexity
Linear (in the size of <code>cb</code>).
*/
@@ -432,6 +457,23 @@
: circular_buffer<T, Alloc>(cb.begin(), cb.end(), cb.get_allocator())
, m_capacity_ctrl(cb.m_capacity_ctrl) {}
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+ //! The move constructor.
+ /*! \brief Move constructs a <code>circular_buffer_space_optimized</code> from <code>cb</code>,
+ leaving <code>cb</code> empty.
+ \pre C++ compiler with rvalue references support.
+ \post <code>cb.empty()</code>
+ \param cb <code>circular_buffer</code> to 'steal' value from.
+ \throws Nothing.
+ \par Constant.
+ */
+ circular_buffer_space_optimized(circular_buffer_space_optimized<T, Alloc>&& cb) BOOST_NOEXCEPT
+ : circular_buffer<T, Alloc>()
+ , m_capacity_ctrl(0) {
+ cb.swap(*this);
+ }
+#endif // BOOST_NO_CXX11_RVALUE_REFERENCES
+
//! Create a full space optimized circular buffer filled with a copy of the range.
/*!
\pre Valid range <code>[first, last)</code>.<br>
@@ -446,7 +488,8 @@
\param alloc The allocator.
\throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
used).
- \throws Whatever <code>T::T(const T&)</code> throws.
+ Whatever <code>T::T(const T&)</code> throws or nothing if <code>T::T(T&&)</code> is noexcept
+ and <code>InputIterator</code> is a move iterator.
\par Complexity
Linear (in the <code>std::distance(first, last)</code>).
*/
@@ -477,7 +520,7 @@
\param alloc The allocator.
\throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
used).
- \throws Whatever <code>T::T(const T&)</code> throws.
+ Whatever <code>T::T(const T&)</code> throws.
\par Complexity
Linear (in <code>std::distance(first, last)</code>; in
<code>min[capacity_ctrl.%capacity(), std::distance(first, last)]</code> if the <code>InputIterator</code>
@@ -552,6 +595,24 @@
return *this;
}
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+ /*! \brief Move assigns content of <code>cb</code> to <code>*this</code>, leaving <code>cb</code> empty.
+ \pre C++ compiler with rvalue references support.
+ \post <code>cb.empty()</code>
+ \param cb <code>circular_buffer</code> to 'steal' value from.
+ \throws Nothing.
+ \par Complexity
+ Constant.
+ */
+ circular_buffer_space_optimized<T, Alloc>& operator = (circular_buffer_space_optimized<T, Alloc>&& cb) BOOST_NOEXCEPT {
+ cb.swap(*this); // now `this` holds `cb`
+ circular_buffer<T, Alloc>(get_allocator()) // temprary that holds initial `cb` allocator
+ .swap(cb); // makes `cb` empty
+ return *this;
+ }
+#endif // BOOST_NO_CXX11_RVALUE_REFERENCES
+
+
//! Assign <code>n</code> items into the space optimized circular buffer.
/*!
The content of the <code>circular_buffer_space_optimized</code> will be removed and replaced with
@@ -563,7 +624,7 @@
\param item The element the <code>circular_buffer_space_optimized</code> will be filled with.
\throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
used).
- \throws Whatever <code>T::T(const T&)</code> throws.
+ Whatever <code>T::T(const T&)</code> throws.
\par Exception Safety
Basic.
\par Iterator Invalidation
@@ -596,7 +657,7 @@
\param item The element the <code>circular_buffer_space_optimized</code> will be filled with.
\throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
used).
- \throws Whatever <code>T::T(const T&)</code> throws.
+ Whatever <code>T::T(const T&)</code> throws.
\par Exception Safety
Basic.
\par Iterator Invalidation
@@ -630,7 +691,8 @@
\param last The end of the range to be copied.
\throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
used).
- \throws Whatever <code>T::T(const T&)</code> throws.
+ Whatever <code>T::T(const T&)</code> throws or nothing if <code>T::T(T&&)</code> is noexcept and
+ <code>InputIterator</code> is a move iterator.
\par Exception Safety
Basic.
\par Iterator Invalidation
@@ -670,7 +732,8 @@
\param last The end of the range to be copied.
\throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
used).
- \throws Whatever <code>T::T(const T&)</code> throws.
+ Whatever <code>T::T(const T&)</code> throws or nothing if <code>T::T(T&&)</code> is noexcept and
+ <code>InputIterator</code> is a move iterator.
\par Exception Safety
Basic.
\par Iterator Invalidation
@@ -692,7 +755,7 @@
circular_buffer<T, Alloc>::assign(capacity_ctrl, first, last);
}
- //! Swap the contents of two space optimized circular buffers.
+ //! Swap the contents of two space-optimized circular-buffers.
/*!
\post <code>this</code> contains elements of <code>cb</code> and vice versa; the capacity and the amount of
allocated memory in the internal buffer of <code>this</code> equal to the capacity and the amount of
@@ -704,14 +767,18 @@
\par Iterator Invalidation
Invalidates all iterators of both <code>circular_buffer_space_optimized</code> 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.)
+ this feature you have to turn the __debug_support off by defining macro BOOST_CB_DISABLE_DEBUG,
+ otherwise an assertion will report an error if such invalidated iterator is used.)
\par Complexity
Constant (in the size of the <code>circular_buffer_space_optimized</code>).
- \sa <code>\link swap(circular_buffer<T, Alloc>&, circular_buffer<T, Alloc>&)
- swap(circular_buffer_space_optimized<T, Alloc>&, circular_buffer_space_optimized<T, Alloc>&)\endlink</code>
+ \sa <code>swap(circular_buffer<T, Alloc>&, circular_buffer<T, Alloc>&)</code>,
+ <code>swap(circular_buffer_space_optimized<T, Alloc>&, circular_buffer_space_optimized<T, Alloc>&)</code>
+
+
*/
- void swap(circular_buffer_space_optimized<T, Alloc>& cb) {
+ // Note link does not work right. Asked on Doxygen forum for advice 23 May 2103.
+
+ void swap(circular_buffer_space_optimized<T, Alloc>& cb) BOOST_NOEXCEPT {
std::swap(m_capacity_ctrl, cb.m_capacity_ctrl);
circular_buffer<T, Alloc>::swap(cb);
}
@@ -725,7 +792,7 @@
\param item The element to be inserted.
\throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
used).
- \throws Whatever <code>T::T(const T&)</code> throws.
+ Whatever <code>T::T(const T&)</code> throws.
\par Exception Safety
Basic.
\par Iterator Invalidation
@@ -736,11 +803,60 @@
\sa <code>\link push_front() push_front(const_reference)\endlink</code>, <code>pop_back()</code>,
<code>pop_front()</code>
*/
- void push_back(param_value_type item = value_type()) {
+ void push_back(param_value_type item) {
check_low_capacity();
circular_buffer<T, Alloc>::push_back(item);
}
+ //! Insert a new element at the end of the space optimized circular buffer.
+ /*!
+ \post if <code>capacity().%capacity() > 0</code> then <code>back() == item</code><br>
+ If the <code>circular_buffer_space_optimized</code> is full, the first element will be removed. If the
+ capacity is <code>0</code>, nothing will be inserted.<br><br>
+ The amount of allocated memory in the internal buffer may be predictively increased.
+ \param item The element to be inserted.
+ \throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
+ used).
+ \par Exception Safety
+ Basic.
+ \par Iterator Invalidation
+ Invalidates all iterators pointing to the <code>circular_buffer_space_optimized</code> (except iterators
+ equal to <code>end()</code>).
+ \par Complexity
+ Linear (in the size of the <code>circular_buffer_space_optimized</code>).
+ \sa <code>\link push_front() push_front(const_reference)\endlink</code>, <code>pop_back()</code>,
+ <code>pop_front()</code>
+ */
+ void push_back(rvalue_type item) {
+ check_low_capacity();
+ circular_buffer<T, Alloc>::push_back(boost::move(item));
+ }
+
+ //! Insert a new element at the end of the space optimized circular buffer.
+ /*!
+ \post if <code>capacity().%capacity() > 0</code> then <code>back() == item</code><br>
+ If the <code>circular_buffer_space_optimized</code> is full, the first element will be removed. If the
+ capacity is <code>0</code>, nothing will be inserted.<br><br>
+ The amount of allocated memory in the internal buffer may be predictively increased.
+ \throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
+ used).
+ Whatever <code>T::T()</code> throws.
+ Whatever <code>T::T(const T&)</code> throws or nothing if <code>T::T(T&&)</code> is noexcept.
+ \par Exception Safety
+ Basic.
+ \par Iterator Invalidation
+ Invalidates all iterators pointing to the <code>circular_buffer_space_optimized</code> (except iterators
+ equal to <code>end()</code>).
+ \par Complexity
+ Linear (in the size of the <code>circular_buffer_space_optimized</code>).
+ \sa <code>\link push_front() push_front(const_reference)\endlink</code>, <code>pop_back()</code>,
+ <code>pop_front()</code>
+ */
+ void push_back() {
+ check_low_capacity();
+ circular_buffer<T, Alloc>::push_back();
+ }
+
//! Insert a new element at the beginning of the space optimized circular buffer.
/*!
\post if <code>capacity().%capacity() > 0</code> then <code>front() == item</code><br>
@@ -750,7 +866,7 @@
\param item The element to be inserted.
\throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
used).
- \throws Whatever <code>T::T(const T&)</code> throws.
+ Whatever <code>T::T(const T&)</code> throws.
\par Exception Safety
Basic.
\par Iterator Invalidation
@@ -761,11 +877,61 @@
\sa <code>\link push_back() push_back(const_reference)\endlink</code>, <code>pop_back()</code>,
<code>pop_front()</code>
*/
- void push_front(param_value_type item = value_type()) {
+ void push_front(param_value_type item) {
check_low_capacity();
circular_buffer<T, Alloc>::push_front(item);
}
+ //! Insert a new element at the beginning of the space optimized circular buffer.
+ /*!
+ \post if <code>capacity().%capacity() > 0</code> then <code>front() == item</code><br>
+ If the <code>circular_buffer_space_optimized</code> is full, the last element will be removed. If the
+ capacity is <code>0</code>, nothing will be inserted.<br><br>
+ The amount of allocated memory in the internal buffer may be predictively increased.
+ \param item The element to be inserted.
+ \throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
+ used).
+ Whatever <code>T::T(const T&)</code> throws or nothing if <code>T::T(T&&)</code> is noexcept.
+ \par Exception Safety
+ Basic.
+ \par Iterator Invalidation
+ Invalidates all iterators pointing to the <code>circular_buffer_space_optimized</code> (except iterators
+ equal to <code>end()</code>).
+ \par Complexity
+ Linear (in the size of the <code>circular_buffer_space_optimized</code>).
+ \sa <code>\link push_back() push_back(const_reference)\endlink</code>, <code>pop_back()</code>,
+ <code>pop_front()</code>
+ */
+ void push_front(rvalue_type item) {
+ check_low_capacity();
+ circular_buffer<T, Alloc>::push_front(boost::move(item));
+ }
+
+ //! Insert a new element at the beginning of the space optimized circular buffer.
+ /*!
+ \post if <code>capacity().%capacity() > 0</code> then <code>front() == item</code><br>
+ If the <code>circular_buffer_space_optimized</code> is full, the last element will be removed. If the
+ capacity is <code>0</code>, nothing will be inserted.<br><br>
+ The amount of allocated memory in the internal buffer may be predictively increased.
+ \throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
+ used).
+ Whatever <code>T::T()</code> throws.
+ Whatever <code>T::T(const T&)</code> throws or nothing if <code>T::T(T&&)</code> is noexcept.
+ \par Exception Safety
+ Basic.
+ \par Iterator Invalidation
+ Invalidates all iterators pointing to the <code>circular_buffer_space_optimized</code> (except iterators
+ equal to <code>end()</code>).
+ \par Complexity
+ Linear (in the size of the <code>circular_buffer_space_optimized</code>).
+ \sa <code>\link push_back() push_back(const_reference)\endlink</code>, <code>pop_back()</code>,
+ <code>pop_front()</code>
+ */
+ void push_front() {
+ check_low_capacity();
+ circular_buffer<T, Alloc>::push_front();
+ }
+
//! Remove the last element from the space optimized circular buffer.
/*!
\pre <code>!empty()</code>
@@ -826,8 +992,8 @@
the <i>Effect</i>.)
\throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
used).
- \throws Whatever <code>T::T(const T&)</code> throws.
- \throws Whatever <code>T::operator = (const T&)</code> throws.
+ Whatever <code>T::T(const T&)</code> throws.
+ Whatever <code>T::operator = (const T&)</code> throws.
\par Exception Safety
Basic.
\par Iterator Invalidation
@@ -843,12 +1009,88 @@
rinsert(iterator, size_type, value_type)\endlink</code>,
<code>rinsert(iterator, InputIterator, InputIterator)</code>
*/
- iterator insert(iterator pos, param_value_type item = value_type()) {
+ iterator insert(iterator pos, param_value_type item) {
size_type index = pos - begin();
check_low_capacity();
return circular_buffer<T, Alloc>::insert(begin() + index, item);
}
+ //! Insert an element at the specified position.
+ /*!
+ \pre <code>pos</code> is a valid iterator pointing to the <code>circular_buffer_space_optimized</code> or its
+ end.
+ \post The <code>item</code> will be inserted at the position <code>pos</code>.<br>
+ If the <code>circular_buffer_space_optimized</code> is full, the first element will be overwritten. If
+ the <code>circular_buffer_space_optimized</code> is full and the <code>pos</code> points to
+ <code>begin()</code>, then the <code>item</code> will not be inserted. If the capacity is <code>0</code>,
+ nothing will be inserted.<br><br>
+ The amount of allocated memory in the internal buffer may be predictively increased.
+ \param pos An iterator specifying the position where the <code>item</code> will be inserted.
+ \param item The element to be inserted.
+ \return Iterator to the inserted element or <code>begin()</code> if the <code>item</code> is not inserted. (See
+ the <i>Effect</i>.)
+ \throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
+ used).
+ Whatever <code>T::T(const T&)</code> throws or nothing if <code>T::T(T&&)</code> is noexcept.
+ \par Exception Safety
+ Basic.
+ \par Iterator Invalidation
+ Invalidates all iterators pointing to the <code>circular_buffer_space_optimized</code> (except iterators
+ equal to <code>end()</code>).
+ \par Complexity
+ Linear (in the size of the <code>circular_buffer_space_optimized</code>).
+ \sa <code>\link insert(iterator, size_type, param_value_type)
+ insert(iterator, size_type, value_type)\endlink</code>,
+ <code>insert(iterator, InputIterator, InputIterator)</code>,
+ <code>\link rinsert(iterator, param_value_type) rinsert(iterator, value_type)\endlink</code>,
+ <code>\link rinsert(iterator, size_type, param_value_type)
+ rinsert(iterator, size_type, value_type)\endlink</code>,
+ <code>rinsert(iterator, InputIterator, InputIterator)</code>
+ */
+ iterator insert(iterator pos, rvalue_type item) {
+ size_type index = pos - begin();
+ check_low_capacity();
+ return circular_buffer<T, Alloc>::insert(begin() + index, boost::move(item));
+ }
+
+ //! Insert an element at the specified position.
+ /*!
+ \pre <code>pos</code> is a valid iterator pointing to the <code>circular_buffer_space_optimized</code> or its
+ end.
+ \post The <code>item</code> will be inserted at the position <code>pos</code>.<br>
+ If the <code>circular_buffer_space_optimized</code> is full, the first element will be overwritten. If
+ the <code>circular_buffer_space_optimized</code> is full and the <code>pos</code> points to
+ <code>begin()</code>, then the <code>item</code> will not be inserted. If the capacity is <code>0</code>,
+ nothing will be inserted.<br><br>
+ The amount of allocated memory in the internal buffer may be predictively increased.
+ \param pos An iterator specifying the position where the <code>item</code> will be inserted.
+ \return Iterator to the inserted element or <code>begin()</code> if the <code>item</code> is not inserted. (See
+ the <i>Effect</i>.)
+ \throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
+ used).
+ Whatever <code>T::T()</code> throws.
+ Whatever <code>T::T(const T&)</code> throws or nothing if <code>T::T(T&&)</code> is noexcept.
+ \par Exception Safety
+ Basic.
+ \par Iterator Invalidation
+ Invalidates all iterators pointing to the <code>circular_buffer_space_optimized</code> (except iterators
+ equal to <code>end()</code>).
+ \par Complexity
+ Linear (in the size of the <code>circular_buffer_space_optimized</code>).
+ \sa <code>\link insert(iterator, size_type, param_value_type)
+ insert(iterator, size_type, value_type)\endlink</code>,
+ <code>insert(iterator, InputIterator, InputIterator)</code>,
+ <code>\link rinsert(iterator, param_value_type) rinsert(iterator, value_type)\endlink</code>,
+ <code>\link rinsert(iterator, size_type, param_value_type)
+ rinsert(iterator, size_type, value_type)\endlink</code>,
+ <code>rinsert(iterator, InputIterator, InputIterator)</code>
+ */
+ iterator insert(iterator pos) {
+ size_type index = pos - begin();
+ check_low_capacity();
+ return circular_buffer<T, Alloc>::insert(begin() + index);
+ }
+
//! Insert <code>n</code> copies of the <code>item</code> at the specified position.
/*!
\pre <code>pos</code> is a valid iterator pointing to the <code>circular_buffer_space_optimized</code> or its
@@ -863,8 +1105,8 @@
\param item The element whose copies will be inserted.
\throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
used).
- \throws Whatever <code>T::T(const T&)</code> throws.
- \throws Whatever <code>T::operator = (const T&)</code> throws.
+ Whatever <code>T::T(const T&)</code> throws.
+ Whatever <code>T::operator = (const T&)</code> throws.
\par Exception Safety
Basic.
\par Iterator Invalidation
@@ -876,7 +1118,7 @@
Consider a <code>circular_buffer_space_optimized</code> with the capacity of 6 and the size of 4. Its
internal buffer may look like the one below.<br><br>
<code>|1|2|3|4| | |</code><br>
- <code>p ---^</code><br><br>After inserting 5 elements at the position <code>p</code>:<br><br>
+ <code>p ___^</code><br><br>After inserting 5 elements at the position <code>p</code>:<br><br>
<code>insert(p, (size_t)5, 0);</code><br><br>actually only 4 elements get inserted and elements
<code>1</code> and <code>2</code> are overwritten. This is due to the fact the insert operation preserves
the capacity. After insertion the internal buffer looks like this:<br><br><code>|0|0|0|0|3|4|</code><br>
@@ -911,8 +1153,7 @@
\param last The end of the range to be inserted.
\throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
used).
- \throws Whatever <code>T::T(const T&)</code> throws.
- \throws Whatever <code>T::operator = (const T&)</code> throws.
+ Whatever <code>T::T(const T&)</code> throws or nothing if <code>T::T(T&&)</code> is noexcept.
\par Exception Safety
Basic.
\par Iterator Invalidation
@@ -927,7 +1168,7 @@
Consider a <code>circular_buffer_space_optimized</code> with the capacity of 6 and the size of 4. Its
internal buffer may look like the one below.<br><br>
<code>|1|2|3|4| | |</code><br>
- <code>p ---^</code><br><br>After inserting a range of elements at the position <code>p</code>:<br><br>
+ <code>p ___^</code><br><br>After inserting a range of elements at the position <code>p</code>:<br><br>
<code>int array[] = { 5, 6, 7, 8, 9 };</code><br><code>insert(p, array, array + 5);</code><br><br>
actually only elements <code>6</code>, <code>7</code>, <code>8</code> and <code>9</code> from the
specified range get inserted and elements <code>1</code> and <code>2</code> are overwritten. This is due
@@ -962,8 +1203,8 @@
the <i>Effect</i>.)
\throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
used).
- \throws Whatever <code>T::T(const T&)</code> throws.
- \throws Whatever <code>T::operator = (const T&)</code> throws.
+ Whatever <code>T::T(const T&)</code> throws.
+ Whatever <code>T::operator = (const T&)</code> throws.
\par Exception Safety
Basic.
\par Iterator Invalidation
@@ -979,12 +1220,88 @@
insert(iterator, size_type, value_type)\endlink</code>,
<code>insert(iterator, InputIterator, InputIterator)</code>
*/
- iterator rinsert(iterator pos, param_value_type item = value_type()) {
+ iterator rinsert(iterator pos, param_value_type item) {
size_type index = pos - begin();
check_low_capacity();
return circular_buffer<T, Alloc>::rinsert(begin() + index, item);
}
+ //! Insert an element before the specified position.
+ /*!
+ \pre <code>pos</code> is a valid iterator pointing to the <code>circular_buffer_space_optimized</code> or its
+ end.
+ \post The <code>item</code> will be inserted before the position <code>pos</code>.<br>
+ If the <code>circular_buffer_space_optimized</code> is full, the last element will be overwritten. If the
+ <code>circular_buffer_space_optimized</code> is full and the <code>pos</code> points to
+ <code>end()</code>, then the <code>item</code> will not be inserted. If the capacity is <code>0</code>,
+ nothing will be inserted.<br><br>
+ The amount of allocated memory in the internal buffer may be predictively increased.
+ \param pos An iterator specifying the position before which the <code>item</code> will be inserted.
+ \param item The element to be inserted.
+ \return Iterator to the inserted element or <code>end()</code> if the <code>item</code> is not inserted. (See
+ the <i>Effect</i>.)
+ \throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
+ used).
+ Whatever <code>T::T(const T&)</code> throws or nothing if <code>T::T(T&&)</code> is noexcept.
+ \par Exception Safety
+ Basic.
+ \par Iterator Invalidation
+ Invalidates all iterators pointing to the <code>circular_buffer_space_optimized</code> (except iterators
+ equal to <code>end()</code>).
+ \par Complexity
+ Linear (in the size of the <code>circular_buffer_space_optimized</code>).
+ \sa <code>\link rinsert(iterator, size_type, param_value_type)
+ rinsert(iterator, size_type, value_type)\endlink</code>,
+ <code>rinsert(iterator, InputIterator, InputIterator)</code>,
+ <code>\link insert(iterator, param_value_type) insert(iterator, value_type)\endlink</code>,
+ <code>\link insert(iterator, size_type, param_value_type)
+ insert(iterator, size_type, value_type)\endlink</code>,
+ <code>insert(iterator, InputIterator, InputIterator)</code>
+ */
+ iterator rinsert(iterator pos, rvalue_type item) {
+ size_type index = pos - begin();
+ check_low_capacity();
+ return circular_buffer<T, Alloc>::rinsert(begin() + index, boost::move(item));
+ }
+
+ //! Insert an element before the specified position.
+ /*!
+ \pre <code>pos</code> is a valid iterator pointing to the <code>circular_buffer_space_optimized</code> or its
+ end.
+ \post The <code>item</code> will be inserted before the position <code>pos</code>.<br>
+ If the <code>circular_buffer_space_optimized</code> is full, the last element will be overwritten. If the
+ <code>circular_buffer_space_optimized</code> is full and the <code>pos</code> points to
+ <code>end()</code>, then the <code>item</code> will not be inserted. If the capacity is <code>0</code>,
+ nothing will be inserted.<br><br>
+ The amount of allocated memory in the internal buffer may be predictively increased.
+ \param pos An iterator specifying the position before which the <code>item</code> will be inserted.
+ \return Iterator to the inserted element or <code>end()</code> if the <code>item</code> is not inserted. (See
+ the <i>Effect</i>.)
+ \throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
+ used).
+ Whatever <code>T::T()</code> throws.
+ Whatever <code>T::T(const T&)</code> throws or nothing if <code>T::T(T&&)</code> is noexcept.
+ \par Exception Safety
+ Basic.
+ \par Iterator Invalidation
+ Invalidates all iterators pointing to the <code>circular_buffer_space_optimized</code> (except iterators
+ equal to <code>end()</code>).
+ \par Complexity
+ Linear (in the size of the <code>circular_buffer_space_optimized</code>).
+ \sa <code>\link rinsert(iterator, size_type, param_value_type)
+ rinsert(iterator, size_type, value_type)\endlink</code>,
+ <code>rinsert(iterator, InputIterator, InputIterator)</code>,
+ <code>\link insert(iterator, param_value_type) insert(iterator, value_type)\endlink</code>,
+ <code>\link insert(iterator, size_type, param_value_type)
+ insert(iterator, size_type, value_type)\endlink</code>,
+ <code>insert(iterator, InputIterator, InputIterator)</code>
+ */
+ iterator rinsert(iterator pos) {
+ size_type index = pos - begin();
+ check_low_capacity();
+ return circular_buffer<T, Alloc>::rinsert(begin() + index);
+ }
+
//! Insert <code>n</code> copies of the <code>item</code> before the specified position.
/*!
\pre <code>pos</code> is a valid iterator pointing to the <code>circular_buffer_space_optimized</code> or its
@@ -999,8 +1316,8 @@
\param item The element whose copies will be inserted.
\throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
used).
- \throws Whatever <code>T::T(const T&)</code> throws.
- \throws Whatever <code>T::operator = (const T&)</code> throws.
+ Whatever <code>T::T(const T&)</code> throws.
+ Whatever <code>T::operator = (const T&)</code> throws.
\par Exception Safety
Basic.
\par Iterator Invalidation
@@ -1012,7 +1329,7 @@
Consider a <code>circular_buffer_space_optimized</code> with the capacity of 6 and the size of 4. Its
internal buffer may look like the one below.<br><br>
<code>|1|2|3|4| | |</code><br>
- <code>p ---^</code><br><br>After inserting 5 elements before the position <code>p</code>:<br><br>
+ <code>p ___^</code><br><br>After inserting 5 elements before the position <code>p</code>:<br><br>
<code>rinsert(p, (size_t)5, 0);</code><br><br>actually only 4 elements get inserted and elements
<code>3</code> and <code>4</code> are overwritten. This is due to the fact the rinsert operation preserves
the capacity. After insertion the internal buffer looks like this:<br><br><code>|1|2|0|0|0|0|</code><br>
@@ -1048,8 +1365,8 @@
\param last The end of the range to be inserted.
\throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
used).
- \throws Whatever <code>T::T(const T&)</code> throws.
- \throws Whatever <code>T::operator = (const T&)</code> throws.
+ Whatever <code>T::T(const T&)</code> throws.
+ Whatever <code>T::operator = (const T&)</code> throws.
\par Exception Safety
Basic.
\par Iterator Invalidation
@@ -1064,7 +1381,7 @@
Consider a <code>circular_buffer_space_optimized</code> with the capacity of 6 and the size of 4. Its
internal buffer may look like the one below.<br><br>
<code>|1|2|3|4| | |</code><br>
- <code>p ---^</code><br><br>After inserting a range of elements before the position <code>p</code>:<br><br>
+ <code>p ___^</code><br><br>After inserting a range of elements before the position <code>p</code>:<br><br>
<code>int array[] = { 5, 6, 7, 8, 9 };</code><br><code>insert(p, array, array + 5);</code><br><br>
actually only elements <code>5</code>, <code>6</code>, <code>7</code> and <code>8</code> from the
specified range get inserted and elements <code>3</code> and <code>4</code> are overwritten. This is due
@@ -1094,7 +1411,8 @@
element exists.
\throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
used).
- \throws Whatever <code>T::operator = (const T&)</code> throws.
+ Whatever <code>T::operator = (const T&)</code> throws or
+ nothing if <code>T::operator = (T&&)</code> is noexcept.
\par Exception Safety
Basic.
\par Iterator Invalidation
@@ -1124,7 +1442,8 @@
element exists.
\throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
used).
- \throws Whatever <code>T::operator = (const T&)</code> throws.
+ Whatever <code>T::operator = (const T&)</code> throws or
+ nothing if <code>T::operator = (T&&)</code> is noexcept.
\par Exception Safety
Basic.
\par Iterator Invalidation
@@ -1153,7 +1472,8 @@
such element exists.
\throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
used).
- \throws Whatever <code>T::operator = (const T&)</code> throws.
+ Whatever <code>T::operator = (const T&)</code> throws or
+ nothing if <code>T::operator = (T&&)</code> is noexcept.
\par Exception Safety
Basic.
\par Iterator Invalidation
@@ -1162,7 +1482,7 @@
\par Complexity
Linear (in the size of the <code>circular_buffer_space_optimized</code>).
\note Basically there is no difference between <code>erase(iterator)</code> and this method. It is implemented
- only for consistency with the base <code>circular_buffer</code>.
+ only for consistency with the base <code>circular_buffer</code>.
\sa <code>erase(iterator)</code>, <code>erase(iterator, iterator)</code>,
<code>rerase(iterator, iterator)</code>, <code>clear()</code>
*/
@@ -1185,7 +1505,8 @@
such element exists.
\throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
used).
- \throws Whatever <code>T::operator = (const T&)</code> throws.
+ Whatever <code>T::operator = (const T&)</code> throws or
+ nothing if <code>T::operator = (T&&)</code> is noexcept.
\par Exception Safety
Basic.
\par Iterator Invalidation
@@ -1195,7 +1516,7 @@
Linear (in the size of the <code>circular_buffer_space_optimized</code>).
\note Basically there is no difference between <code>erase(iterator, iterator)</code> and this method. It is
implemented only for consistency with the base
- <code>circular_buffer</code>.
+ <code><circular_buffer</code>.
\sa <code>erase(iterator)</code>, <code>erase(iterator, iterator)</code>, <code>rerase(iterator)</code>,
<code>clear()</code>
*/
@@ -1414,7 +1735,7 @@
//! Swap the contents of two space optimized circular buffers.
template <class T, class Alloc>
inline void swap(circular_buffer_space_optimized<T, Alloc>& lhs,
- circular_buffer_space_optimized<T, Alloc>& rhs) {
+ circular_buffer_space_optimized<T, Alloc>& rhs) BOOST_NOEXCEPT {
lhs.swap(rhs);
}
Deleted: branches/release/libs/circular_buffer/doc/Doxyfile
==============================================================================
--- branches/release/libs/circular_buffer/doc/Doxyfile 2013-08-29 04:39:09 EDT (Thu, 29 Aug 2013) (r85509)
+++ /dev/null 00:00:00 1970 (deleted)
@@ -1,227 +0,0 @@
-# Doxygen configuration file.
-#
-# Copyright (c) 2003-2008 Jan Gaspar
-#
-# Distributed under the Boost Software License, Version 1.0. (See
-# accompanying file LICENSE_1_0.txt or copy at
-# http://www.boost.org/LICENSE_1_0.txt)
-#
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-PROJECT_NAME = "Circular Buffer"
-PROJECT_NUMBER = 3.7
-OUTPUT_DIRECTORY = srcdoc
-CREATE_SUBDIRS = NO
-OUTPUT_LANGUAGE = English
-USE_WINDOWS_ENCODING = NO
-BRIEF_MEMBER_DESC = YES
-REPEAT_BRIEF = YES
-ABBREVIATE_BRIEF =
-ALWAYS_DETAILED_SEC = YES
-INLINE_INHERITED_MEMB = NO
-FULL_PATH_NAMES = NO
-STRIP_FROM_PATH =
-STRIP_FROM_INC_PATH =
-SHORT_NAMES = NO
-JAVADOC_AUTOBRIEF = NO
-MULTILINE_CPP_IS_BRIEF = NO
-DETAILS_AT_TOP = NO
-INHERIT_DOCS = YES
-DISTRIBUTE_GROUP_DOC = NO
-TAB_SIZE = 8
-ALIASES =
-OPTIMIZE_OUTPUT_FOR_C = NO
-OPTIMIZE_OUTPUT_JAVA = NO
-SUBGROUPING = YES
-#---------------------------------------------------------------------------
-# Build related configuration options
-#---------------------------------------------------------------------------
-EXTRACT_ALL = YES
-EXTRACT_PRIVATE = YES
-EXTRACT_STATIC = YES
-EXTRACT_LOCAL_CLASSES = YES
-EXTRACT_LOCAL_METHODS = NO
-HIDE_UNDOC_MEMBERS = NO
-HIDE_UNDOC_CLASSES = NO
-HIDE_FRIEND_COMPOUNDS = NO
-HIDE_IN_BODY_DOCS = YES
-INTERNAL_DOCS = NO
-CASE_SENSE_NAMES = YES
-HIDE_SCOPE_NAMES = NO
-SHOW_INCLUDE_FILES = YES
-INLINE_INFO = YES
-SORT_MEMBER_DOCS = NO
-SORT_BRIEF_DOCS = NO
-SORT_BY_SCOPE_NAME = NO
-GENERATE_TODOLIST = YES
-GENERATE_TESTLIST = YES
-GENERATE_BUGLIST = YES
-GENERATE_DEPRECATEDLIST= YES
-ENABLED_SECTIONS =
-MAX_INITIALIZER_LINES = 30
-SHOW_USED_FILES = NO
-SHOW_DIRECTORIES = YES
-FILE_VERSION_FILTER =
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-QUIET = NO
-WARNINGS = YES
-WARN_IF_UNDOCUMENTED = YES
-WARN_IF_DOC_ERROR = YES
-WARN_NO_PARAMDOC = YES
-WARN_FORMAT = "$file:$line: $text"
-WARN_LOGFILE =
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-INPUT = ../../../boost/circular_buffer
-FILE_PATTERNS = *.hpp
-RECURSIVE = YES
-EXCLUDE = ../../../boost/circular_buffer/debug.hpp \
- ../../../boost/circular_buffer/details.hpp
-EXCLUDE_SYMLINKS = NO
-EXCLUDE_PATTERNS =
-EXAMPLE_PATH =
-EXAMPLE_PATTERNS =
-EXAMPLE_RECURSIVE = NO
-IMAGE_PATH =
-INPUT_FILTER =
-FILTER_PATTERNS =
-FILTER_SOURCE_FILES = NO
-#---------------------------------------------------------------------------
-# configuration options related to source browsing
-#---------------------------------------------------------------------------
-SOURCE_BROWSER = NO
-INLINE_SOURCES = NO
-STRIP_CODE_COMMENTS = NO
-REFERENCED_BY_RELATION = YES
-REFERENCES_RELATION = YES
-VERBATIM_HEADERS = YES
-#---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-ALPHABETICAL_INDEX = NO
-COLS_IN_ALPHA_INDEX = 5
-IGNORE_PREFIX =
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-GENERATE_HTML = NO
-HTML_OUTPUT = html
-HTML_FILE_EXTENSION = .html
-HTML_HEADER =
-HTML_FOOTER =
-HTML_STYLESHEET =
-HTML_ALIGN_MEMBERS = YES
-GENERATE_HTMLHELP = NO
-CHM_FILE =
-HHC_LOCATION =
-GENERATE_CHI = NO
-BINARY_TOC = NO
-TOC_EXPAND = NO
-DISABLE_INDEX = NO
-ENUM_VALUES_PER_LINE = 4
-GENERATE_TREEVIEW = NO
-TREEVIEW_WIDTH = 250
-#---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-GENERATE_LATEX = NO
-LATEX_OUTPUT = latex
-LATEX_CMD_NAME = latex
-MAKEINDEX_CMD_NAME = makeindex
-COMPACT_LATEX = NO
-PAPER_TYPE = a4wide
-EXTRA_PACKAGES =
-LATEX_HEADER =
-PDF_HYPERLINKS = NO
-USE_PDFLATEX = NO
-LATEX_BATCHMODE = NO
-LATEX_HIDE_INDICES = NO
-#---------------------------------------------------------------------------
-# configuration options related to the RTF output
-#---------------------------------------------------------------------------
-GENERATE_RTF = NO
-RTF_OUTPUT = rtf
-COMPACT_RTF = NO
-RTF_HYPERLINKS = NO
-RTF_STYLESHEET_FILE =
-RTF_EXTENSIONS_FILE =
-#---------------------------------------------------------------------------
-# configuration options related to the man page output
-#---------------------------------------------------------------------------
-GENERATE_MAN = NO
-MAN_OUTPUT = man
-MAN_EXTENSION = .3
-MAN_LINKS = NO
-#---------------------------------------------------------------------------
-# configuration options related to the XML output
-#---------------------------------------------------------------------------
-GENERATE_XML = YES
-XML_OUTPUT = .
-XML_SCHEMA =
-XML_DTD =
-XML_PROGRAMLISTING = NO
-#---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-GENERATE_AUTOGEN_DEF = NO
-#---------------------------------------------------------------------------
-# configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-GENERATE_PERLMOD = NO
-PERLMOD_LATEX = NO
-PERLMOD_PRETTY = YES
-PERLMOD_MAKEVAR_PREFIX =
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-ENABLE_PREPROCESSING = NO
-MACRO_EXPANSION = NO
-EXPAND_ONLY_PREDEF = NO
-SEARCH_INCLUDES = YES
-INCLUDE_PATH =
-INCLUDE_FILE_PATTERNS =
-PREDEFINED =
-EXPAND_AS_DEFINED =
-SKIP_FUNCTION_MACROS = YES
-#---------------------------------------------------------------------------
-# Configuration::additions related to external references
-#---------------------------------------------------------------------------
-TAGFILES =
-GENERATE_TAGFILE =
-ALLEXTERNALS = NO
-EXTERNAL_GROUPS = NO
-PERL_PATH =
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-CLASS_DIAGRAMS = NO
-HIDE_UNDOC_RELATIONS = NO
-HAVE_DOT = NO
-CLASS_GRAPH = YES
-COLLABORATION_GRAPH = YES
-GROUP_GRAPHS = YES
-UML_LOOK = NO
-TEMPLATE_RELATIONS = YES
-INCLUDE_GRAPH = YES
-INCLUDED_BY_GRAPH = YES
-CALL_GRAPH = NO
-GRAPHICAL_HIERARCHY = YES
-DIRECTORY_GRAPH = YES
-DOT_IMAGE_FORMAT = png
-DOT_PATH =
-DOTFILE_DIRS =
-MAX_DOT_GRAPH_WIDTH = 1024
-MAX_DOT_GRAPH_HEIGHT = 1024
-MAX_DOT_GRAPH_DEPTH = 0
-DOT_TRANSPARENT = NO
-DOT_MULTI_TARGETS = NO
-GENERATE_LEGEND = YES
-DOT_CLEANUP = YES
-#---------------------------------------------------------------------------
-# Configuration::additions related to the search engine
-#---------------------------------------------------------------------------
-SEARCHENGINE = NO
Deleted: branches/release/libs/circular_buffer/doc/HOWTO-srcdoc
==============================================================================
--- branches/release/libs/circular_buffer/doc/HOWTO-srcdoc 2013-08-29 04:39:09 EDT (Thu, 29 Aug 2013) (r85509)
+++ /dev/null 00:00:00 1970 (deleted)
@@ -1,52 +0,0 @@
-################################################################################
-# HOW-TO documentation about generating/updating source code documentation for #
-# the Circular Buffer library. #
-# #
-# Copyright (c) 2003-2008 Jan Gaspar #
-# #
-# Use, modification, and distribution is subject to the Boost Software #
-# License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at #
-# http://www.boost.org/LICENSE_1_0.txt) #
-################################################################################
-
-The source code documentation (i.e. documentation of functions, classes and
-their methods, etc.) is part of the source code. This makes it convenient for
-a developer when browsing source files or developing new (documented) code.
-The source code documentation is included in the larger, more detailed library
-documentation as well which makes it more convenient for the user of the
-library. In order to make it easier for the developer, the source code
-documentation included in the library documentation is generated from the source
-files. Which means the developer does not have to write the same source
-documentation twice.
-
-Prerequisites:
-
-1) Unix/Linux shell (with sed editor) available.
- (The script can be easily converted into Windows batch file if you do not
- have access to Unix/Linux shell.)
-2) Installed Doxygen http://www.doxygen.org.
- (Source documentation generation was tested with the Doxygen version
- 1.4.6.)
-3) Installed xsltproc http://xmlsoft.org/XSLT/xsltproc2.html.
-4) Installed HTML Tidy http://tidy.sourceforge.net. (Tested with version
- released on 1 September 2005.)
-
-
-Updating source code documentation:
-
-The source code documentation of the Circular Buffer library obeys the Doxygen
-syntax. The library documentation is written in HTML (files circular_buffer.html
-and space_optimized.html). The generation of the source code documentation is
-performed by executing the update_srcdoc.sh script which relies mainly on
-Doxygen and several XSL transformations.
-
-After editing the source code documentation in the source file(s), update the
-library documentation by executing:
-
-$>./update_srcdoc.sh circular_buffer
-
-for the circular_buffer or/and
-
-$>./update_srcdoc.sh circular_buffer_space_optimized
-
-for the circular_buffer_space_optimized.
Deleted: branches/release/libs/circular_buffer/doc/Tidy.conf
==============================================================================
--- branches/release/libs/circular_buffer/doc/Tidy.conf 2013-08-29 04:39:09 EDT (Thu, 29 Aug 2013) (r85509)
+++ /dev/null 00:00:00 1970 (deleted)
@@ -1,18 +0,0 @@
-# HTML Tidy configuration file.
-#
-# Copyright (c) 2003-2008 Jan Gaspar
-#
-# Distributed under the Boost Software License, Version 1.0. (See
-# accompanying file LICENSE_1_0.txt or copy at
-# http://www.boost.org/LICENSE_1_0.txt)
-#
-bare: yes
-char-encoding: latin1
-doctype: transitional
-indent: yes
-indent-attributes: no
-quiet: yes
-show-warnings: no
-tidy-mark: no
-wrap: 120
-write-back: yes
Deleted: branches/release/libs/circular_buffer/doc/circular_buffer.html
==============================================================================
--- branches/release/libs/circular_buffer/doc/circular_buffer.html 2013-08-29 04:39:09 EDT (Thu, 29 Aug 2013) (r85509)
+++ /dev/null 00:00:00 1970 (deleted)
@@ -1,7436 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
-"http://www.w3.org/TR/html4/loose.dtd">
-<html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <title>
- Templated Circular Buffer Container
- </title>
- <link rel="stylesheet" href="../../../boost.css" type="text/css">
- </head>
- <body>
- <table id="title" border="0">
- <tr>
- <td>
- <h1>
- Templated Circular Buffer Container
- </h1>
- <h1>
- circular_buffer<T, Alloc>
- </h1>
- </td>
- <td>
-
- </td>
- </tr>
- </table>
- <h2>
- Contents
- </h2>
- <dl>
- <dt>
- Description
- </dt>
- <dt>
- Introductory Example
- </dt>
- <dt>
- Synopsis
- </dt>
- <dt>
- Rationale
- </dt>
- <dd>
- <ul>
- <li>
- Thread-Safety
- </li>
- <li>
- Overwrite Operation
- </li>
- <li>
- Writing to a Full Buffer
- </li>
- <li>
- Reading/Removing from an Empty Buffer
- </li>
- <li>
- Iterator Invalidation
- </li>
- </ul>
- </dd>
- <dt>
- Caveats
- </dt>
- <dt>
- Debug Support
- </dt>
- <dt>
- Compatibility with Interprocess library
- </dt>
- <dt>
- More Examples
- </dt>
- <dt>
- Header Files
- </dt>
- <dt>
- Modelled Concepts
- </dt>
- <dt>
- Template Parameters
- </dt>
- <dt>
- Public Types
- </dt>
- <dt>
- Constructors and Destructor
- </dt>
- <dt>
- Public Member Functions
- </dt>
- <dt>
- Standalone Functions
- </dt>
- <dt>
- Notes
- </dt>
- <dt>
- See also
- </dt>
- <dt>
- Acknowledgements
- </dt>
- <dt>
- Release Notes
- </dt>
- </dl>
- <table id="table_figure" align="right" border="0">
- <tr>
- <td>
- <img src="circular_buffer.png" width="300" height="332" alt="Circular Buffer">
- </td>
- </tr>
- <tr>
- <td width="300">
- <table id="table_figure_desc" cellpadding="5" align="right" border="0">
- <tr>
- <td valign="top">
- <b>Figure:</b>
- </td>
- <td valign="top">
- The circular buffer (for someone known as <i>ring</i> or <i>cyclic buffer</i>).
- </td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
- <h2>
- <a name="description" id="description">Description</a>
- </h2>
- <p>
- In general the term <i>circular buffer</i> refers to an area in memory which is used to store incoming data. When
- the buffer is filled, new data is written starting at the beginning of the buffer and overwriting the old. (Also
- see the Figure.)
- </p>
- <p>
- The <code>circular_buffer</code> is a STL compliant container. It is a kind of sequence similar to <code><a href=
- "http://www.sgi.com/tech/stl/List.html">std::list</a></code> or <code><a href=
- "http://www.sgi.com/tech/stl/Deque.html">std::deque</a></code>. It supports random access iterators, constant
- time insert and erase operations at the beginning or the end of the buffer and interoperability with
- <code>std</code> algorithms. The <code>circular_buffer</code> is especially designed to provide fixed capacity
- storage. When its capacity is exhausted, newly inserted elements will cause elements either at the beginning or
- end of the buffer (depending on what insert operation is used) to be overwritten.
- </p>
- <p>
- The <code>circular_buffer</code> only allocates memory when created, when the capacity is adjusted explicitly, or
- as necessary to accommodate resizing or assign operations. On the other hand, there is also a <code><a href=
- "space_optimized.html">circular_buffer_space_optimized</a></code> available. It is an adaptor of the
- <code>circular_buffer</code> which does not allocate memory at once when created, rather it allocates memory as
- needed.
- </p>
- <h2>
- <a name="briefexample" id="briefexample">Introductory Example</a>
- </h2>
- <p>
- A brief example using the <code>circular_buffer</code>:
- </p>
- <pre>
- #include <boost/circular_buffer.hpp>
-
- int main(int /*argc*/, char* /*argv*/[]) {
-
- // Create a circular buffer with a capacity for 3 integers.
- boost::circular_buffer<int> cb(3);
-
- // Insert some elements into the buffer.
- cb.push_back(1);
- cb.push_back(2);
- cb.push_back(3);
-
- int a = cb[0]; // a == 1
- int b = cb[1]; // b == 2
- int c = cb[2]; // c == 3
-
- // The buffer is full now, pushing subsequent
- // elements will overwrite the front-most elements.
-
- cb.push_back(4); // Overwrite 1 with 4.
- cb.push_back(5); // Overwrite 2 with 5.
-
- // The buffer now contains 3, 4 and 5.
-
- a = cb[0]; // a == 3
- b = cb[1]; // b == 4
- c = cb[2]; // c == 5
-
- // Elements can be popped from either the front or the back.
-
- cb.pop_back(); // 5 is removed.
- cb.pop_front(); // 3 is removed.
-
- int d = cb[0]; // d == 4
-
- return 0;
- }
-</pre>
- <h2>
- <a name="synopsis" id="synopsis">Synopsis</a>
- </h2>
- <div id="srcdoc_synopsis">
- <table id="table_synopsis" border="0" cellpadding="10">
- <tr>
- <td>
- <pre>
-namespace boost {
-
-template <class T, class Alloc>
-class circular_buffer
-{
-public:
- typedef typename Alloc::value_type <a href=
-"#classboost_1_1circular__buffer_1cbdd7ca87e147c08cd2be267eefd6540">value_type</a>;
- typedef typename Alloc::pointer <a href=
-"#classboost_1_1circular__buffer_14ff917f8a6131ec18e91606727592a9c">pointer</a>;
- typedef typename Alloc::const_pointer <a href=
-"#classboost_1_1circular__buffer_190f7c6bcb624ad507de546366f49028a">const_pointer</a>;
- typedef typename Alloc::reference <a href=
-"#classboost_1_1circular__buffer_1f38a9bc64d84757c661c2542ff9a7f65">reference</a>;
- typedef typename Alloc::const_reference <a href=
-"#classboost_1_1circular__buffer_1a8397191092f5bacee991b623ca4b910">const_reference</a>;
- typedef typename Alloc::difference_type <a href=
-"#classboost_1_1circular__buffer_15313e723fa85d73db5826f8b722aa2a9">difference_type</a>;
- typedef typename Alloc::size_type <a href=
-"#classboost_1_1circular__buffer_19ba12c0142a21a7d960877c22fa3ea00">size_type</a>;
- typedef Alloc allocator_type;
- typedef <i>implementation-defined</i> <a href=
-"#classboost_1_1circular__buffer_15cab6d46f03c40d1e52d41843319ddb9">const_iterator</a>;
- typedef <i>implementation-defined</i> <a href=
-"#classboost_1_1circular__buffer_11b8a33f2dc8519b8a7d344ed4408c532">iterator</a>;
- typedef boost::reverse_iterator<const_iterator> <a href=
-"#classboost_1_1circular__buffer_1c7317701b511bc5f7a663b06b53e2b73">const_reverse_iterator</a>;
- typedef boost::reverse_iterator<iterator> <a href=
-"#classboost_1_1circular__buffer_1002fb890dded89e75dfeb6f021fb58a5">reverse_iterator</a>;
- typedef std::pair<pointer, size_type> <a href=
-"#classboost_1_1circular__buffer_126d279f91fef717e25459a0817ff242f">array_range</a>;
- typedef std::pair<const_pointer, size_type> <a href=
-"#classboost_1_1circular__buffer_11885d7f475b7e7a74c95b2448d243025">const_array_range</a>;
- typedef size_type capacity_type;
-
- explicit <a href=
-"#classboost_1_1circular__buffer_1e53e744d2f94a2bcbfcdb219a9d93300">circular_buffer</a>(const allocator_type& alloc = allocator_type());
- explicit <a href=
-"#classboost_1_1circular__buffer_18f1606a26fead923c2cbe068a74e28b6">circular_buffer</a>(capacity_type buffer_capacity, const allocator_type& alloc = allocator_type());
- <a href=
-"#classboost_1_1circular__buffer_1fdace8f110d5b7a17c02020757f06fe8">circular_buffer</a>(size_type n, const_reference item, const allocator_type& alloc = allocator_type());
- <a href=
-"#classboost_1_1circular__buffer_104dc644486d835b56aa479ec48b52230">circular_buffer</a>(capacity_type buffer_capacity, size_type n, const_reference item, const allocator_type& alloc = allocator_type());
- <a href=
-"#classboost_1_1circular__buffer_1e515d8a951eeb18b8cc930300e7e13bd">circular_buffer</a>(const circular_buffer<T, Alloc>& cb);
- template <class InputIterator>
- <a href=
-"#classboost_1_1circular__buffer_1744ec06b06a5a723386b645a29cb8ed2">circular_buffer</a>(InputIterator first, InputIterator last, const allocator_type& alloc = allocator_type());
- template <class InputIterator>
- <a href=
-"#classboost_1_1circular__buffer_1a851f75f4a85b1a2b1a241904d21503f">circular_buffer</a>(capacity_type buffer_capacity, InputIterator first, InputIterator last, const allocator_type& alloc = allocator_type());
- ~circular_buffer();
-
- allocator_type <a href=
-"#classboost_1_1circular__buffer_1a20b7d0e7a4da0af13286df9f53d660c">get_allocator</a>() const;
- allocator_type& get_allocator();
- iterator begin();
- iterator end();
- const_iterator begin() const;
- const_iterator end() const;
- reverse_iterator rbegin();
- reverse_iterator rend();
- const_reverse_iterator <a href=
-"#classboost_1_1circular__buffer_1765d91bf48341907418433a1e3aab026">rbegin</a>() const;
- const_reverse_iterator rend() const;
- reference <a href=
-"#classboost_1_1circular__buffer_1d219f0d3203fb43b964a8cf63f1865cd">operator[]</a>(size_type index);
- const_reference <a href=
-"#classboost_1_1circular__buffer_1eb0a7fe7f8a56a4dc4c933b93adfcef4">operator[]</a>(size_type index) const;
- reference at(size_type index);
- const_reference <a href=
-"#classboost_1_1circular__buffer_1b233a298f5845a0fcf2ecc56f4170810">at</a>(size_type index) const;
- reference front();
- reference back();
- const_reference front() const;
- const_reference back() const;
- array_range array_one();
- array_range array_two();
- const_array_range array_one() const;
- const_array_range array_two() const;
- pointer linearize();
- bool is_linearized() const;
- void <a href=
-"#classboost_1_1circular__buffer_1c591bb9e271b10b5240afcff3bd2c619">rotate</a>(const_iterator new_begin);
- size_type size() const;
- size_type max_size() const;
- bool empty() const;
- bool full() const;
- size_type reserve() const;
- capacity_type capacity() const;
- void <a href=
-"#classboost_1_1circular__buffer_161714204ef5172d156e2c7eccd04998f">set_capacity</a>(capacity_type new_capacity);
- void <a href=
-"#classboost_1_1circular__buffer_180c2e2e66a8fa9d0b7adc1b54921a8c3">resize</a>(size_type new_size, const_reference item = value_type());
- void <a href=
-"#classboost_1_1circular__buffer_1477715e9d31d2cc5b02ad8ecf3c68c46">rset_capacity</a>(capacity_type new_capacity);
- void <a href=
-"#classboost_1_1circular__buffer_144ecd9ec5f54a2d61c7d132e445d3483">rresize</a>(size_type new_size, const_reference item = value_type());
- circular_buffer<T, Alloc>& <a href=
-"#classboost_1_1circular__buffer_1db1558911b2e251a587aeb3d8b3d797d">operator=</a>(const circular_buffer<T, Alloc>& cb);
- void <a href=
-"#classboost_1_1circular__buffer_19ba4a81df16f386d31b04b49c82d1ada">assign</a>(size_type n, const_reference item);
- void <a href=
-"#classboost_1_1circular__buffer_1dbebb80a5f38e52a37ec9f3ed765600a">assign</a>(capacity_type buffer_capacity, size_type n, const_reference item);
- template <class InputIterator>
- void <a href=
-"#classboost_1_1circular__buffer_1253302d9bda5d7efbc4a6c311de3790c">assign</a>(InputIterator first, InputIterator last);
- template <class InputIterator>
- void <a href=
-"#classboost_1_1circular__buffer_127cab6034beeeb0e11863c8c14d14366">assign</a>(capacity_type buffer_capacity, InputIterator first, InputIterator last);
- void <a href=
-"#classboost_1_1circular__buffer_1270ab7074c365663a6f18808024fd88b">swap</a>(circular_buffer<T, Alloc>& cb);
- void <a href=
-"#classboost_1_1circular__buffer_1aa35dd7ef8eb1d04508494d1835cc82e">push_back</a>(const_reference item = value_type());
- void <a href=
-"#classboost_1_1circular__buffer_10ef57e73c193682a649d8eb4a1096dce">push_front</a>(const_reference item = value_type());
- void pop_back();
- void pop_front();
- iterator <a href=
-"#classboost_1_1circular__buffer_128c92740fee1b9deb8c69816e389de95">insert</a>(iterator pos, const_reference item = value_type());
- void <a href=
-"#classboost_1_1circular__buffer_1b2f197c99d47138db777f0a46783b140">insert</a>(iterator pos, size_type n, const_reference item);
- template <class InputIterator>
- void <a href=
-"#classboost_1_1circular__buffer_1d00091d1d794cab3264b3674e99b33f6">insert</a>(iterator pos, InputIterator first, InputIterator last);
- iterator <a href=
-"#classboost_1_1circular__buffer_12c9332f457bf5bb3128463cf528c058c">rinsert</a>(iterator pos, const_reference item = value_type());
- void <a href=
-"#classboost_1_1circular__buffer_1a47a5358db1b7d7e4925c16db13d2fc5">rinsert</a>(iterator pos, size_type n, const_reference item);
- template <class InputIterator>
- void <a href=
-"#classboost_1_1circular__buffer_1d6479cbc43a304bdbf04262f957fa323">rinsert</a>(iterator pos, InputIterator first, InputIterator last);
- iterator erase(iterator pos);
- iterator <a href=
-"#classboost_1_1circular__buffer_1a96415389509a18bd7d7b5d8e4dda9bd">erase</a>(iterator first, iterator last);
- iterator rerase(iterator pos);
- iterator <a href=
-"#classboost_1_1circular__buffer_1b0f98ae303584ded5397f067bbfc911f">rerase</a>(iterator first, iterator last);
- void erase_begin(size_type n);
- void erase_end(size_type n);
- void clear();
-};
-
-template <class T, class Alloc>
- bool <a href=
-"#namespaceboost_1d35871e838359b5215e1cbb353663207">operator==</a>(const circular_buffer<T, Alloc>& lhs, const circular_buffer<T, Alloc>& rhs);
-template <class T, class Alloc>
- bool <a href=
-"#namespaceboost_195b08213f201c2067d8acb024756329d">operator<</a>(const circular_buffer<T, Alloc>& lhs, const circular_buffer<T, Alloc>& rhs);
-template <class T, class Alloc>
- bool <a href=
-"#namespaceboost_1f5717e2f6532581a6492ff1839b18f6d">operator!=</a>(const circular_buffer<T, Alloc>& lhs, const circular_buffer<T, Alloc>& rhs);
-template <class T, class Alloc>
- bool <a href=
-"#namespaceboost_1f575d7a9741c2044424de50c966c12f3">operator></a>(const circular_buffer<T, Alloc>& lhs, const circular_buffer<T, Alloc>& rhs);
-template <class T, class Alloc>
- bool <a href=
-"#namespaceboost_179abcbacd24b67f08185db54aec8600d">operator<=</a>(const circular_buffer<T, Alloc>& lhs, const circular_buffer<T, Alloc>& rhs);
-template <class T, class Alloc>
- bool <a href=
-"#namespaceboost_11c31150380272af67deebef578c80b05">operator>=</a>(const circular_buffer<T, Alloc>& lhs, const circular_buffer<T, Alloc>& rhs);
-template <class T, class Alloc>
- void <a href=
-"#namespaceboost_14aa8f6a2c9640f3f22e266f0fca85777">swap</a>(circular_buffer<T, Alloc>& lhs, circular_buffer<T, Alloc>& rhs);
-
-} // namespace boost
-</pre>
- </td>
- </tr>
- </table>
- </div>
- <h2>
- <a name="rationale" id="rationale">Rationale</a>
- </h2>
- <p>
- The basic motivation behind the <code>circular_buffer</code> was to create a container which would work
- seamlessly with STL. Additionally, the design of the <code>circular_buffer</code> was guided by the following
- principles:
- </p>
- <ol>
- <li>Maximum <em>efficiency</em> for envisaged applications.
- </li>
- <li>Suitable for <em>general purpose</em> use.
- </li>
- <li>The behaviour of the buffer as <em>intuitive</em> as possible.
- </li>
- <li>Suitable for <em>specialization</em> by means of adaptors. (The <code><a href=
- "space_optimized.html">circular_buffer_space_optimized</a></code> is such an example of the adaptor.)
- </li>
- <li>Easy to <em>debug</em>. (See Debug Support for details.)
- </li>
- </ol>
- <p>
- In order to achieve maximum efficiency, the <code>circular_buffer</code> stores its elements in a <em>contiguous
- region of memory</em>, which then enables:
- </p>
- <ol>
- <li>Use of fixed memory and no implicit or unexpected memory allocation.
- </li>
- <li>Fast constant-time insertion and removal of elements from the front and back.
- </li>
- <li>Fast constant-time random access of elements.
- </li>
- <li>Suitability for real-time and performance critical applications.
- </li>
- </ol>
- <p>
- Possible applications of the <code>circular_buffer</code> include:
- </p>
- <ul>
- <li>Storage of the most recently received samples, overwriting the oldest as new samples arrive.
- </li>
- <li>As an underlying container for a <i>bounded buffer</i> (see the <a href="#boundedbuffer">Bounded Buffer
- Example</a>).
- </li>
- <li>A kind of cache storing a specified number of last inserted elements.
- </li>
- <li>Efficient fixed capacity FIFO (First In, First Out) or LIFO (Last In, First Out) queue which removes the
- oldest (inserted as first) elements when full.
- </li>
- </ul>
- <p>
- The following paragraphs describe issues that had to be considered during the implementation of the
- <code>circular_buffer</code>:
- </p>
- <h4>
- <a name="threadsafety" id="threadsafety">Thread-Safety</a>
- </h4>
- <p>
- The thread-safety of the <code>circular_buffer</code> is the same as the thread-safety of containers in most STL
- implementations. This means the <code>circular_buffer</code> is <b>not</b> thread-safe. The thread-safety is
- guarantied only in the sense that simultaneous accesses to <b>distinct</b> instances of the
- <code>circular_buffer</code> are safe, and simultaneous read accesses to a shared <code>circular_buffer</code>
- are safe.
- </p>
- <p>
- If multiple threads access a single <code>circular_buffer</code>, and at least one of the threads may potentially
- write, then the user is responsible for ensuring mutual exclusion between the threads during the container
- accesses. The mutual exclusion between the threads can be achieved by wrapping operations of the underlying
- <code>circular_buffer</code> with a lock acquisition and release. (See the <a href="#boundedbuffer">Bounded
- Buffer Example</a>.)
- </p>
- <h4>
- <a name="overwrite" id="overwrite">Overwrite Operation</a>
- </h4>
- <p>
- Overwrite operation occurs when an element is inserted into a full <code>circular_buffer</code> - the old element
- is being overwritten by the new one. There was a discussion what exactly "overwriting of an element" means during
- the formal review. It may be either a destruction of the original element and a consequent inplace construction
- of a new element or it may be an assignment of a new element into an old one. The <code>circular_buffer</code>
- implements <b>assignment</b> because it is more effective.
- </p>
- <p>
- From the point of business logic of a stored element, the destruction/construction operation and assignment
- usually mean the same. However, in very rare cases (if in any) they may differ. If there is a requirement for
- elements to be destructed/constructed instead of being assigned, consider implementing a wrapper of the element
- which would implement the assign operator, and store the wrappers instead. It is necessary to note that storing
- such wrappers has a drawback. The destruction/construction will be invoked on every assignment of the wrapper -
- not only when a wrapper is being overwritten (when the buffer is full) but also when the stored wrappers are
- being shifted (e.g. as a result of insertion into the middle of container).
- </p>
- <h4>
- <a name="fullbuffer" id="fullbuffer">Writing to a Full Buffer</a>
- </h4>
- <p>
- There are several options how to cope with the case if a data source produces more data than can fit in the
- fixed-sized buffer:
- </p>
- <ol>
- <li>Inform the data source to wait until there is room in the buffer (e.g. by throwing an overflow exception).
- </li>
- <li>If the oldest data is the most important, ignore new data from the source until there is room in the buffer
- again.
- </li>
- <li>If the latest data is the most important, write over the oldest data.
- </li>
- <li>Let the producer to be responsible for checking the size of the buffer prior writing into it.
- </li>
- </ol>
- <p>
- It is apparent that the <code>circular_buffer</code> implements the third option. But it may be less apparent it
- <b>does not</b> implement any other option - especially the first two. One can get an impression that the
- <code>circular_buffer</code> should implement first three options and offer a mechanism of choosing among them.
- This impression is wrong. The <code>circular_buffer</code> was designed and optimized to be circular (which means
- overwriting the oldest data when full). If such a controlling mechanism had been enabled, it would just
- complicate the matters and the usage of the <code>circular_buffer</code> would be probably less straightforward.
- </p>
- <p>
- Moreover, the first two options (and the fourth option as well) do not require the buffer to be circular at all.
- If there is a need for the first or second option, consider implementing an adaptor of e.g.
- <code>std::vector</code>. In this case the <code>circular_buffer</code> is not suitable for adapting, because, in
- contrary to <code>std::vector</code>, it bears an overhead for its circular behaviour.
- </p>
- <h4>
- <a name="emptybuffer" id="emptybuffer">Reading/Removing from an Empty Buffer</a>
- </h4>
- <p>
- When reading or removing an element from an empty buffer, the buffer should be able to notify the data consumer
- (e.g. by throwing underflow exception) that there are no elements stored in it. The <code>circular_buffer</code>
- does not implement such a behaviour for two reasons:
- </p>
- <ol>
- <li>It would introduce performance overhead.
- </li>
- <li>No other <code>std</code> container implements it this way.
- </li>
- </ol>
- <p>
- It is considered to be a bug to read or remove an element (e.g. by calling <code>front()</code> or
- <code>pop_back()</code>) from an empty <code>std</code> container and from an empty <code>circular_buffer</code>
- as well. The data consumer has to test if the container is not empty before reading/removing from it. However,
- when reading from the <code>circular_buffer</code>, there is an option to rely on the <code>at()</code> method
- which throws an exception when the index is out of range.
- </p>
- <h4>
- <a name="iteratorinvalidation" id="iteratorinvalidation">Iterator Invalidation</a>
- </h4>
- <p>
- An iterator is usually considered to be invalidated if an element, the iterator pointed to, had been removed or
- overwritten by an another element. This definition is enforced by the Debug Support and is
- documented for every method. However, some applications utilizing <code>circular_buffer</code> may require less
- strict definition: an iterator is invalid only if it points to an uninitialized memory. Consider following
- example:
- </p>
- <pre>
- #define BOOST_CB_DISABLE_DEBUG // The Debug Support has to be disabled, otherwise the code produces a runtime error.
-
- #include <boost/circular_buffer.hpp>
- #include <assert.h>
-
- int main(int /*argc*/, char* /*argv*/[]) {
-
- boost::circular_buffer<int> cb(3);
-
- cb.push_back(1);
- cb.push_back(2);
- cb.push_back(3);
-
- boost::circular_buffer<int>::iterator it = cb.begin();
-
- assert(*it == 1);
-
- cb.push_back(4);
-
- assert(*it == 4); // The iterator still points to the initialized memory.
-
- return 0;
- }
-</pre>
- <p>
- The iterator does not point to the original element any more (and is considered to be invalid from the "strict"
- point of view) but it still points to the same <em>valid</em> place in the memory. This "soft" definition of
- iterator invalidation is supported by the <code>circular_buffer</code> but should be considered as an
- implementation detail rather than a full-fledged feature. The rules when the iterator is still valid can be
- inferred from the code in <code><a href=
- "../test/soft_iterator_invalidation.cpp">soft_iterator_invalidation.cpp</a></code>.
- </p>
- <h2>
- <a name="caveats" id="caveats">Caveats</a>
- </h2>
- <p>
- The <code>circular_buffer</code> should not be used for storing pointers to dynamically allocated objects. When a
- <code>circular_buffer</code> becomes full, further insertion will overwrite the stored pointers - resulting in a
- <b>memory leak</b>. One recommend alternative is the use of smart pointers [1]. (Any
- container of <code>std::auto_ptr</code> is considered particularly hazardous. [2] )
- </p>
- <p>
- While internals of a <code>circular_buffer</code> are circular, iterators are <b>not</b>. Iterators of a
- <code>circular_buffer</code> are only valid for the range <code>[begin(), end()]</code>. E.g. iterators
- <code>(begin() - 1)</code> and <code>(end() + 1)</code> are invalid.
- </p>
- <h2>
- <a name="debug" id="debug">Debug Support</a>
- </h2>
- <p>
- In order to help a programmer to avoid and find common bugs, the <code>circular_buffer</code> contains a kind of
- debug support.
- </p>
- <p>
- The <code>circular_buffer</code> maintains a list of valid iterators. As soon as any element gets destroyed all
- iterators pointing to this element are removed from this list and explicitly invalidated (an invalidation flag is
- set). The debug support also consists of many assertions (<a href=
- "../../utility/assert.html"><code>BOOST_ASSERT</code></a> macros) which ensure the <code>circular_buffer</code>
- and its iterators are used in the correct manner at runtime. In case an invalid iterator is used the assertion
- will report an error. The connection of explicit iterator invalidation and assertions makes a very robust debug
- technique which catches most of the errors.
- </p>
- <p>
- Moreover, the uninitialized memory allocated by <code>circular_buffer</code> is filled with the value
- <code>0xcc</code> in the debug mode. This can help the programmer when debugging the code to recognize the
- initialized memory from the uninitialized. For details refer the source code.
- </p>
- <p>
- The debug support is enabled only in the debug mode (when the <code>NDEBUG</code> is not defined). It can also be
- explicitly disabled (only for <code>circular_buffer</code>) by defining <code>BOOST_CB_DISABLE_DEBUG</code>
- macro.
- </p>
- <h2>
- <a name="intreprocess" id="interprocess">Compatibility with Interprocess library</a>
- </h2>
- <p>
- The <code>circular_buffer</code> is compatible with the <a href="../../../doc/html/interprocess.html">Boost
- Interprocess</a> library used for interprocess communication. Considering that the <code>circular_buffer</code>'s
- debug support relies on 'raw' pointers - which is not permited by the Interprocess library - the code has to
- compiled with <code>-DBOOST_CB_DISABLE_DEBUG</code> or <code>-DNDEBUG</code> (which disables the
- Debug Support). Not doing that will cause the compilation to fail.
- </p>
- <h2>
- <a name="examples" id="examples">More Examples</a>
- </h2>
- <p>
- The following example includes various usage of the <code>circular_buffer</code>.
- </p>
- <pre>
- #include <boost/circular_buffer.hpp>
- #include <numeric>
- #include <assert.h>
-
- int main(int /*argc*/, char* /*argv*/[])
- {
- // create a circular buffer of capacity 3
- boost::circular_buffer<int> cb(3);
-
- // insert some elements into the circular buffer
- cb.push_back(1);
- cb.push_back(2);
-
- // assertions
- assert(cb[0] == 1);
- assert(cb[1] == 2);
- assert(!cb.full());
- assert(cb.size() == 2);
- assert(cb.capacity() == 3);
-
- // insert some other elements
- cb.push_back(3);
- cb.push_back(4);
-
- // evaluate the sum
- int sum = std::accumulate(cb.begin(), cb.end(), 0);
-
- // assertions
- assert(cb[0] == 2);
- assert(cb[1] == 3);
- assert(cb[2] == 4);
- assert(*cb.begin() == 2);
- assert(cb.front() == 2);
- assert(cb.back() == 4);
- assert(sum == 9);
- assert(cb.full());
- assert(cb.size() == 3);
- assert(cb.capacity() == 3);
-
- return 0;
- }
-</pre>
- <p>
- The <code>circular_buffer</code> has a capacity of three <code>int</code>. Therefore, the size of the buffer will
- not exceed three. The <code>std::accumulate</code>
- algorithm evaluates the sum of the stored elements. The semantics of the <code>circular_buffer</code> can be
- inferred from the assertions.
- </p>
- <h4>
- <a name="boundedbuffer" id="boundedbuffer">Bounded Buffer Example</a>
- </h4>
- <p>
- The bounded buffer is normally used in a producer-consumer mode when producer threads produce items and store
- them in the container and consumer threads remove these items and process them. The bounded buffer has to
- guarantee that producers do not insert items into the container when the container is full, that consumers do not
- try to remove items when the container is empty, and that each produced item is consumed by exactly one consumer.
- </p>
- <p>
- The example below shows how the <code>circular_buffer</code> can be utilized as an underlying container of the
- bounded buffer.
- </p>
- <pre>
- #include <boost/circular_buffer.hpp>
- #include <boost/thread/mutex.hpp>
- #include <boost/thread/condition.hpp>
- #include <boost/thread/thread.hpp>
- #include <boost/call_traits.hpp>
- #include <boost/progress.hpp>
- #include <boost/bind.hpp>
-
- template <class T>
- class bounded_buffer {
- public:
-
- typedef boost::circular_buffer<T> container_type;
- typedef typename container_type::size_type size_type;
- typedef typename container_type::value_type value_type;
- typedef typename boost::call_traits<value_type>::param_type param_type;
-
- explicit bounded_buffer(size_type capacity) : m_unread(0), m_container(capacity) {}
-
- void push_front(boost::call_traits<value_type>::param_type item) {
- // param_type represents the "best" way to pass a parameter of type value_type to a method
-
- boost::mutex::scoped_lock lock(m_mutex);
- m_not_full.wait(lock, boost::bind(&bounded_buffer<value_type>::is_not_full, this));
- m_container.push_front(item);
- ++m_unread;
- lock.unlock();
- m_not_empty.notify_one();
- }
-
- void pop_back(value_type* pItem) {
- boost::mutex::scoped_lock lock(m_mutex);
- m_not_empty.wait(lock, boost::bind(&bounded_buffer<value_type>::is_not_empty, this));
- *pItem = m_container[--m_unread];
- lock.unlock();
- m_not_full.notify_one();
- }
-
- private:
- bounded_buffer(const bounded_buffer&); // Disabled copy constructor
- bounded_buffer& operator = (const bounded_buffer&); // Disabled assign operator
-
- bool is_not_empty() const { return m_unread > 0; }
- bool is_not_full() const { return m_unread < m_container.capacity(); }
-
- size_type m_unread;
- container_type m_container;
- boost::mutex m_mutex;
- boost::condition m_not_empty;
- boost::condition m_not_full;
- };
-</pre>
- <p>
- The <code>bounded_buffer</code> relies on Boost Threads and <a href=
- "../../bind/bind.html">Boost Bind</a> libraries and Boost call_traits
- utility.
- </p>
- <p>
- The <code>push_front()</code> method is called by the producer thread in order to insert a new item into the
- buffer. The method locks the mutex and waits until there is a space for the new item. (The mutex is unlocked
- during the waiting stage and has to be regained when the condition is met.) If there is a space in the buffer
- available, the execution continues and the method inserts the item at the end of the
- <code>circular_buffer</code>. Then it increments the number of unread items and unlocks the mutex (in case an
- exception is thrown before the mutex is unlocked, the mutex is unlocked automatically by the destructor of the
- <code>scoped_lock</code>). At last the method notifies one of the consumer threads waiting for a new item to be
- inserted into the buffer.
- </p>
- <p>
- The <code>pop_back()</code> method is called by the consumer thread in order to read the next item from the
- buffer. The method locks the mutex and waits until there is an unread item in the buffer. If there is at least
- one unread item, the method decrements the number of unread items and reads the next item from the
- <code>circular_buffer</code>. Then it unlocks the mutex and notifies one of the producer threads waiting for the
- buffer to free a space for the next item.
- </p>
- <p>
- The <code>pop_back()</code> method does not remove the item but the item is left in the
- <code>circular_buffer</code> which then replaces it with a new one (inserted by a producer) when the
- <code>circular_buffer</code> is full. This technique is more effective than removing the item explicitly by
- calling the <code>pop_back()</code> method of the <code>circular_buffer</code>. This claim is based on the
- assumption that an assignment (replacement) of a new item into an old one is more effective than a destruction
- (removal) of an old item and a consequent inplace construction (insertion) of a new item.
- </p>
- <p>
- For comparison of bounded buffers based on different containers compile and run <a href=
- "../test/bounded_buffer_comparison.cpp">bounded_buffer_comparison.cpp</a>. The test should reveal the bounded
- buffer based on the <code>circular_buffer</code> is most effective closely followed by the
- <code>std::deque</code> based bounded buffer. (In reality the result may differ sometimes because the test is
- always affected by external factors such as immediate CPU load.)
- </p>
- <h2>
- <a name="header" id="header">Header Files</a>
- </h2>
- <p>
- The <code>circular_buffer</code> is defined in the file <code><a href=
- "../../../boost/circular_buffer.hpp">boost/circular_buffer.hpp</a></code>. There is also a forward declaration
- for the <code>circular_buffer</code> in the header file <code><a href=
- "../../../boost/circular_buffer_fwd.hpp">boost/circular_buffer_fwd.hpp</a></code>.
- </p>
- <h2>
- <a name="model" id="model">Modelled Concepts</a>
- </h2>
- <p>
- Random Access Container, <a href=
- "http://www.sgi.com/tech/stl/FrontInsertionSequence.html">Front Insertion Sequence</a> and <a href=
- "http://www.sgi.com/tech/stl/BackInsertionSequence.html">Back Insertion Sequence</a>.
- </p>
- <h2>
- <a name="parameters" id="parameters">Template Parameters</a>
- </h2>
- <div id="srcdoc_params">
- <table id="table_template_params" border="1" cellpadding="3">
- <tr>
- <th>
- Parameter
- </th>
- <th>
- Description
- </th>
- <th>
- Default
- </th>
- </tr>
- <tr>
- <td>
- <a id="templateparam_T" name="templateparam_T"><code>T</code></a>
- </td>
- <td>
- The type of the elements stored in the <code>circular_buffer</code>.
- <dl>
- <dt>
- <b>Type Requirements:</b>
- </dt>
- <dd>
- The <code>T</code> has to be SGIAssignable
- (SGI STL defined combination of Assignable and <a href=
- "../../utility/CopyConstructible.html">CopyConstructible</a>). Moreover <code>T</code> has to be
- DefaultConstructible if supplied as
- a default parameter when invoking some of the <code>circular_buffer</code>'s methods e.g.
- <code>insert(iterator pos, const value_type& item = value_type())</code>. And <a href=
- "http://www.sgi.com/tech/stl/EqualityComparable.html">EqualityComparable</a> and/or <a href=
- "../../utility/LessThanComparable.html">LessThanComparable</a> if the <code>circular_buffer</code> will
- be compared with another container.
- </dd>
- </dl>
- </td>
- <td>
- <br>
- </td>
- </tr>
- <tr>
- <td>
- <a id="templateparam_Alloc" name="templateparam_Alloc"><code>Alloc</code></a>
- </td>
- <td>
- The allocator type used for all internal memory management.
- <dl>
- <dt>
- <b>Type Requirements:</b>
- </dt>
- <dd>
- The <code>Alloc</code> has to meet the allocator requirements imposed by STL.
- </dd>
- </dl>
- </td>
- <td>
- <code>std::allocator<T></code>
- </td>
- </tr>
- </table>
- </div>
- <h2>
- <a name="types" id="types">Public Types</a>
- </h2>
- <div id="srcdoc_types">
- <table id="table_public_types" border="1" cellpadding="3">
- <tr>
- <th>
- Type
- </th>
- <th>
- Description
- </th>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_1cbdd7ca87e147c08cd2be267eefd6540" name=
- "classboost_1_1circular__buffer_1cbdd7ca87e147c08cd2be267eefd6540"><code>value_type</code></a>
- </td>
- <td>
- The type of elements stored in the <code>circular_buffer</code>.
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_14ff917f8a6131ec18e91606727592a9c" name=
- "classboost_1_1circular__buffer_14ff917f8a6131ec18e91606727592a9c"><code>pointer</code></a>
- </td>
- <td>
- A pointer to an element.
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_190f7c6bcb624ad507de546366f49028a" name=
- "classboost_1_1circular__buffer_190f7c6bcb624ad507de546366f49028a"><code>const_pointer</code></a>
- </td>
- <td>
- A const pointer to the element.
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_1f38a9bc64d84757c661c2542ff9a7f65" name=
- "classboost_1_1circular__buffer_1f38a9bc64d84757c661c2542ff9a7f65"><code>reference</code></a>
- </td>
- <td>
- A reference to an element.
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_1a8397191092f5bacee991b623ca4b910" name=
- "classboost_1_1circular__buffer_1a8397191092f5bacee991b623ca4b910"><code>const_reference</code></a>
- </td>
- <td>
- A const reference to an element.
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_15313e723fa85d73db5826f8b722aa2a9" name=
- "classboost_1_1circular__buffer_15313e723fa85d73db5826f8b722aa2a9"><code>difference_type</code></a>
- </td>
- <td>
- The distance type. (A signed integral type used to represent the distance between two iterators.)
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_19ba12c0142a21a7d960877c22fa3ea00" name=
- "classboost_1_1circular__buffer_19ba12c0142a21a7d960877c22fa3ea00"><code>size_type</code></a>
- </td>
- <td>
- The size type. (An unsigned integral type that can represent any non-negative value of the container's
- distance type.)
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_14e07c6ddfe89debe384e59bed06e7cb7" name=
- "classboost_1_1circular__buffer_14e07c6ddfe89debe384e59bed06e7cb7"><code>allocator_type</code></a>
- </td>
- <td>
- The type of an allocator used in the <code>circular_buffer</code>.
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_15cab6d46f03c40d1e52d41843319ddb9" name=
- "classboost_1_1circular__buffer_15cab6d46f03c40d1e52d41843319ddb9"><code>const_iterator</code></a>
- </td>
- <td>
- A const (random access) iterator used to iterate through the <code>circular_buffer</code>.
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_11b8a33f2dc8519b8a7d344ed4408c532" name=
- "classboost_1_1circular__buffer_11b8a33f2dc8519b8a7d344ed4408c532"><code>iterator</code></a>
- </td>
- <td>
- A (random access) iterator used to iterate through the <code>circular_buffer</code>.
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_1c7317701b511bc5f7a663b06b53e2b73" name=
- "classboost_1_1circular__buffer_1c7317701b511bc5f7a663b06b53e2b73"><code>const_reverse_iterator</code></a>
- </td>
- <td>
- A const iterator used to iterate backwards through a <code>circular_buffer</code>.
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_1002fb890dded89e75dfeb6f021fb58a5" name=
- "classboost_1_1circular__buffer_1002fb890dded89e75dfeb6f021fb58a5"><code>reverse_iterator</code></a>
- </td>
- <td>
- An iterator used to iterate backwards through a <code>circular_buffer</code>.
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_126d279f91fef717e25459a0817ff242f" name=
- "classboost_1_1circular__buffer_126d279f91fef717e25459a0817ff242f"><code>array_range</code></a>
- </td>
- <td>
- An array range. (A typedef for the <a href=
- "http://www.sgi.com/tech/stl/pair.html"><code>std::pair</code></a> where its first element is a pointer to
- a beginning of an array and its second element represents a size of the array.)
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_11885d7f475b7e7a74c95b2448d243025" name=
- "classboost_1_1circular__buffer_11885d7f475b7e7a74c95b2448d243025"><code>const_array_range</code></a>
- </td>
- <td>
- A range of a const array. (A typedef for the <a href=
- "http://www.sgi.com/tech/stl/pair.html"><code>std::pair</code></a> 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.)
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_1dc642ff2be4db0be1a457810e5d09595" name=
- "classboost_1_1circular__buffer_1dc642ff2be4db0be1a457810e5d09595"><code>capacity_type</code></a>
- </td>
- <td>
- The capacity type. (Same as <code>size_type</code> - defined for consistency with the <a href=
- "space_optimized.html"><code>circular_buffer_space_optimized</code></a>.)
- </td>
- </tr>
- </table>
- </div>
- <h2>
- <a name="constructors" id="constructors">Constructors and Destructor</a>
- </h2>
- <div id="srcdoc_constructors">
- <table id="table_constructors" border="1" cellpadding="3">
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_1e53e744d2f94a2bcbfcdb219a9d93300" name=
- "classboost_1_1circular__buffer_1e53e744d2f94a2bcbfcdb219a9d93300"></a><code><b>explicit
- circular_buffer(const <a href=
- "#classboost_1_1circular__buffer_14e07c6ddfe89debe384e59bed06e7cb7">allocator_type</a>& alloc =
- allocator_type());</b></code><br>
- <br>
- Create an empty <code>circular_buffer</code> with zero capacity.
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- <code>capacity() == 0
- && size() ==
- 0</code>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>alloc</code>
- </dt>
- <dd>
- The allocator.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- An allocation error if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
- used).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Constant.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Warning:</b>
- </dt>
- <dd>
- 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 <code>circular_buffer</code> with zero capacity (e.g. by <code><a href=
- "#classboost_1_1circular__buffer_1aa35dd7ef8eb1d04508494d1835cc82e">push_back(const_reference)</a></code>
- or <code><a href="#classboost_1_1circular__buffer_128c92740fee1b9deb8c69816e389de95">insert(iterator,
- value_type)</a></code>) nothing will be inserted and the size (as well as capacity) remains zero.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Note:</b>
- </dt>
- <dd>
- You can explicitly set the capacity by calling the <code><a href=
- "#classboost_1_1circular__buffer_161714204ef5172d156e2c7eccd04998f">set_capacity(capacity_type)</a></code>
- method or you can use the other constructor with the capacity specified.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href=
- "#classboost_1_1circular__buffer_18f1606a26fead923c2cbe068a74e28b6">circular_buffer(capacity_type,
- const allocator_type& alloc)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer_161714204ef5172d156e2c7eccd04998f">set_capacity(capacity_type)</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_18f1606a26fead923c2cbe068a74e28b6" name=
- "classboost_1_1circular__buffer_18f1606a26fead923c2cbe068a74e28b6"></a><code><b>explicit
- circular_buffer(<a href=
- "#classboost_1_1circular__buffer_1dc642ff2be4db0be1a457810e5d09595">capacity_type</a> buffer_capacity,
- const allocator_type&
- alloc = allocator_type());</b></code><br>
- <br>
- Create an empty <code>circular_buffer</code> with the specified capacity.
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- <code>capacity() ==
- buffer_capacity && <a href=
- "#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> == 0</code>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>buffer_capacity</code>
- </dt>
- <dd>
- The maximum number of elements which can be stored in the <code>circular_buffer</code>.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>alloc</code>
- </dt>
- <dd>
- The allocator.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- An allocation error if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
- used).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Constant.
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_1fdace8f110d5b7a17c02020757f06fe8" name=
- "classboost_1_1circular__buffer_1fdace8f110d5b7a17c02020757f06fe8"></a><code><b>circular_buffer(<a href=
- "#classboost_1_1circular__buffer_19ba12c0142a21a7d960877c22fa3ea00">size_type</a> n, <a href=
- "#classboost_1_1circular__buffer_1a8397191092f5bacee991b623ca4b910">const_reference</a> item, const
- allocator_type& alloc =
- allocator_type());</b></code><br>
- <br>
- Create a full <code>circular_buffer</code> with the specified capacity and filled with <code>n</code>
- copies of <code>item</code>.
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- <code>capacity() == n
- && full()
- && (*this)[0] == item && (*this)[1] == item && ... && (*this)[n - 1] ==
- item</code>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>n</code>
- </dt>
- <dd>
- The number of elements the created <code>circular_buffer</code> will be filled with.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>item</code>
- </dt>
- <dd>
- The element the created <code>circular_buffer</code> will be filled with.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>alloc</code>
- </dt>
- <dd>
- The allocator.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- An allocation error if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
- used).
- </dd>
- <dd>
- Whatever <code>T::T(const T&)</code> throws.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Linear (in the <code>n</code>).
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_104dc644486d835b56aa479ec48b52230" name=
- "classboost_1_1circular__buffer_104dc644486d835b56aa479ec48b52230"></a><code><b>circular_buffer(<a href=
- "#classboost_1_1circular__buffer_1dc642ff2be4db0be1a457810e5d09595">capacity_type</a> buffer_capacity,
- size_type n, <a href=
- "#classboost_1_1circular__buffer_1a8397191092f5bacee991b623ca4b910">const_reference</a> item, const
- allocator_type& alloc =
- allocator_type());</b></code><br>
- <br>
- Create a <code>circular_buffer</code> with the specified capacity and filled with <code>n</code> copies of
- <code>item</code>.
- <dl>
- <dt>
- <b>Precondition:</b>
- </dt>
- <dd>
- <code>buffer_capacity >= n</code>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- <code>capacity() ==
- buffer_capacity && <a href=
- "#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> == n &&
- (*this)[0] == item && (*this)[1] == item && ... && (*this)[n - 1] ==
- item</code>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>buffer_capacity</code>
- </dt>
- <dd>
- The capacity of the created <code>circular_buffer</code>.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>n</code>
- </dt>
- <dd>
- The number of elements the created <code>circular_buffer</code> will be filled with.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>item</code>
- </dt>
- <dd>
- The element the created <code>circular_buffer</code> will be filled with.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>alloc</code>
- </dt>
- <dd>
- The allocator.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- An allocation error if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
- used).
- </dd>
- <dd>
- Whatever <code>T::T(const T&)</code> throws.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Linear (in the <code>n</code>).
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_1e515d8a951eeb18b8cc930300e7e13bd" name=
- "classboost_1_1circular__buffer_1e515d8a951eeb18b8cc930300e7e13bd"></a><code><b>circular_buffer(const
- circular_buffer<T,Alloc>& cb);</b></code><br>
- <br>
- The copy constructor.
- <p>
- Creates a copy of the specified <code>circular_buffer</code>.
- </p>
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- <code>*this == cb</code>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>cb</code>
- </dt>
- <dd>
- The <code>circular_buffer</code> to be copied.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- An allocation error if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
- used).
- </dd>
- <dd>
- Whatever <code>T::T(const T&)</code> throws.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Linear (in the size of <code>cb</code>).
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_1744ec06b06a5a723386b645a29cb8ed2" name=
- "classboost_1_1circular__buffer_1744ec06b06a5a723386b645a29cb8ed2"></a> <code><b>template <class
- InputIterator><br>
- circular_buffer(InputIterator first, InputIterator last, const <a href=
- "#classboost_1_1circular__buffer_14e07c6ddfe89debe384e59bed06e7cb7">allocator_type</a>& alloc =
- allocator_type());</b></code><br>
- <br>
- Create a full <code>circular_buffer</code> filled with a copy of the range.
- <dl>
- <dt>
- <b>Precondition:</b>
- </dt>
- <dd>
- Valid range <code>[first, last)</code>.<br>
- <code>first</code> and <code>last</code> have to meet the requirements of <a href=
- "http://www.sgi.com/tech/stl/InputIterator.html">InputIterator</a>.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- <code>capacity() ==
- std::distance(first, last) && <a href=
- "#classboost_1_1circular__buffer_1fd0eef8ba91210d1575404b7e3e8207a">full()</a> && (*this)[0]==
- *first && (*this)[1] == *(first + 1) && ... && (*this)[std::distance(first,
- last) - 1] == *(last - 1)</code>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>first</code>
- </dt>
- <dd>
- The beginning of the range to be copied.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>last</code>
- </dt>
- <dd>
- The end of the range to be copied.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>alloc</code>
- </dt>
- <dd>
- The allocator.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- An allocation error if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
- used).
- </dd>
- <dd>
- Whatever <code>T::T(const T&)</code> throws.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Linear (in the <code>std::distance(first, last)</code>).
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_1a851f75f4a85b1a2b1a241904d21503f" name=
- "classboost_1_1circular__buffer_1a851f75f4a85b1a2b1a241904d21503f"></a> <code><b>template <class
- InputIterator><br>
- circular_buffer(<a href=
- "#classboost_1_1circular__buffer_1dc642ff2be4db0be1a457810e5d09595">capacity_type</a> buffer_capacity,
- InputIterator first, InputIterator last, const <a href=
- "#classboost_1_1circular__buffer_14e07c6ddfe89debe384e59bed06e7cb7">allocator_type</a>& alloc =
- allocator_type());</b></code><br>
- <br>
- Create a <code>circular_buffer</code> with the specified capacity and filled with a copy of the range.
- <dl>
- <dt>
- <b>Precondition:</b>
- </dt>
- <dd>
- Valid range <code>[first, last)</code>.<br>
- <code>first</code> and <code>last</code> have to meet the requirements of <a href=
- "http://www.sgi.com/tech/stl/InputIterator.html">InputIterator</a>.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- <code>capacity() ==
- buffer_capacity && <a href=
- "#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> <=
- std::distance(first, last) && (*this)[0]== *(last - buffer_capacity) && (*this)[1] ==
- *(last - buffer_capacity + 1) && ... && (*this)[buffer_capacity - 1] == *(last -
- 1)</code><br>
- <br>
- If the number of items to be copied from the range <code>[first, last)</code> is greater than the
- specified <code>buffer_capacity</code> then only elements from the range <code>[last - buffer_capacity,
- last)</code> will be copied.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>buffer_capacity</code>
- </dt>
- <dd>
- The capacity of the created <code>circular_buffer</code>.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>first</code>
- </dt>
- <dd>
- The beginning of the range to be copied.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>last</code>
- </dt>
- <dd>
- The end of the range to be copied.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>alloc</code>
- </dt>
- <dd>
- The allocator.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- An allocation error if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
- used).
- </dd>
- <dd>
- Whatever <code>T::T(const T&)</code> throws.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Linear (in <code>std::distance(first, last)</code>; in <code>min[capacity, std::distance(first,
- last)]</code> if the <code>InputIterator</code> is a <a href=
- "http://www.sgi.com/tech/stl/RandomAccessIterator.html">RandomAccessIterator</a>).
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_164250ffbbbdbc62b99e8301fc195b80c" name=
- "classboost_1_1circular__buffer_164250ffbbbdbc62b99e8301fc195b80c"></a><code><b>~circular_buffer();</b></code><br>
-
- <br>
- The destructor.
- <p>
- Destroys the <code>circular_buffer</code>.
- </p>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- Nothing.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Invalidates all iterators pointing to the <code>circular_buffer</code> (including iterators equal to
- <code>end()</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Constant (in the size of the <code>circular_buffer</code>) for scalar types; linear for other types.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code>clear()</code>
- </dd>
- </dl>
- </td>
- </tr>
- </table>
- </div>
- <h2>
- <a name="methods" id="methods">Public Member Functions</a>
- </h2>
- <div id="srcdoc_methods">
- <table id="table_methods" border="1" cellpadding="3">
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_1a20b7d0e7a4da0af13286df9f53d660c" name=
- "classboost_1_1circular__buffer_1a20b7d0e7a4da0af13286df9f53d660c"></a><code><b><a href=
- "#classboost_1_1circular__buffer_14e07c6ddfe89debe384e59bed06e7cb7">allocator_type</a> get_allocator()
- const;</b></code><br>
- <br>
- Get the allocator.
- <dl>
- <dt>
- <b>Returns:</b>
- </dt>
- <dd>
- The allocator.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- Nothing.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- No-throw.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Does not invalidate any iterators.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Constant (in the size of the <code>circular_buffer</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href=
- "#classboost_1_1circular__buffer_1af7758a36ac2f84a3024b50b4fc7e098">get_allocator()</a></code> for
- obtaining an allocator reference.
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_1af7758a36ac2f84a3024b50b4fc7e098" name=
- "classboost_1_1circular__buffer_1af7758a36ac2f84a3024b50b4fc7e098"></a><code><b><a href=
- "#classboost_1_1circular__buffer_14e07c6ddfe89debe384e59bed06e7cb7">allocator_type</a>&
- get_allocator();</b></code><br>
- <br>
- Get the allocator reference.
- <dl>
- <dt>
- <b>Returns:</b>
- </dt>
- <dd>
- A reference to the allocator.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- Nothing.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- No-throw.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Does not invalidate any iterators.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Constant (in the size of the <code>circular_buffer</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Note:</b>
- </dt>
- <dd>
- This method was added in order to optimize obtaining of the allocator with a state, although use of
- stateful allocators in STL is discouraged.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href="#classboost_1_1circular__buffer_1a20b7d0e7a4da0af13286df9f53d660c">get_allocator()
- const</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_158d1ede2e85f5d46eda8db3f0c4efef0" name=
- "classboost_1_1circular__buffer_158d1ede2e85f5d46eda8db3f0c4efef0"></a><code><b><a href=
- "#classboost_1_1circular__buffer_11b8a33f2dc8519b8a7d344ed4408c532">iterator</a> begin();</b></code><br>
- <br>
- Get the iterator pointing to the beginning of the <code>circular_buffer</code>.
- <dl>
- <dt>
- <b>Returns:</b>
- </dt>
- <dd>
- A random access iterator pointing to the first element of the <code>circular_buffer</code>. If the
- <code>circular_buffer</code> is empty it returns an iterator equal to the one returned by
- <code>end()</code>.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- Nothing.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- No-throw.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Does not invalidate any iterators.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Constant (in the size of the <code>circular_buffer</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code>end()</code>,
- <code>rbegin()</code>,
- <code>rend()</code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1" name=
- "classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1"></a><code><b><a href=
- "#classboost_1_1circular__buffer_11b8a33f2dc8519b8a7d344ed4408c532">iterator</a> end();</b></code><br>
- <br>
- Get the iterator pointing to the end of the <code>circular_buffer</code>.
- <dl>
- <dt>
- <b>Returns:</b>
- </dt>
- <dd>
- A random access iterator pointing to the element "one behind" the last element of the
- <code>circular_buffer</code>. If the <code>circular_buffer</code> is empty it returns an iterator equal
- to the one returned by <code><a href=
- "#classboost_1_1circular__buffer_158d1ede2e85f5d46eda8db3f0c4efef0">begin()</a></code>.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- Nothing.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- No-throw.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Does not invalidate any iterators.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Constant (in the size of the <code>circular_buffer</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code>begin()</code>,
- <code>rbegin()</code>,
- <code>rend()</code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_10640d3d41c13b6089b6f169224cf1038" name=
- "classboost_1_1circular__buffer_10640d3d41c13b6089b6f169224cf1038"></a><code><b><a href=
- "#classboost_1_1circular__buffer_15cab6d46f03c40d1e52d41843319ddb9">const_iterator</a> begin()
- const;</b></code><br>
- <br>
- Get the const iterator pointing to the beginning of the <code>circular_buffer</code>.
- <dl>
- <dt>
- <b>Returns:</b>
- </dt>
- <dd>
- A const random access iterator pointing to the first element of the <code>circular_buffer</code>. If
- the <code>circular_buffer</code> is empty it returns an iterator equal to the one returned by
- <code><a href="#classboost_1_1circular__buffer_17890810d07bc595cfb87f9c47cb075ac">end()
- const</a></code>.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- Nothing.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- No-throw.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Does not invalidate any iterators.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Constant (in the size of the <code>circular_buffer</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href="#classboost_1_1circular__buffer_17890810d07bc595cfb87f9c47cb075ac">end()
- const</a></code>, <code><a href=
- "#classboost_1_1circular__buffer_1765d91bf48341907418433a1e3aab026">rbegin() const</a></code>,
- <code><a href="#classboost_1_1circular__buffer_108dbf538b00a14daf5582ece80746fc3">rend()
- const</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_17890810d07bc595cfb87f9c47cb075ac" name=
- "classboost_1_1circular__buffer_17890810d07bc595cfb87f9c47cb075ac"></a><code><b><a href=
- "#classboost_1_1circular__buffer_15cab6d46f03c40d1e52d41843319ddb9">const_iterator</a> end()
- const;</b></code><br>
- <br>
- Get the const iterator pointing to the end of the <code>circular_buffer</code>.
- <dl>
- <dt>
- <b>Returns:</b>
- </dt>
- <dd>
- A const random access iterator pointing to the element "one behind" the last element of the
- <code>circular_buffer</code>. If the <code>circular_buffer</code> is empty it returns an iterator equal
- to the one returned by <code><a href=
- "#classboost_1_1circular__buffer_10640d3d41c13b6089b6f169224cf1038">begin() const</a></code> const.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- Nothing.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- No-throw.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Does not invalidate any iterators.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Constant (in the size of the <code>circular_buffer</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href="#classboost_1_1circular__buffer_10640d3d41c13b6089b6f169224cf1038">begin()
- const</a></code>, <code><a href=
- "#classboost_1_1circular__buffer_1765d91bf48341907418433a1e3aab026">rbegin() const</a></code>,
- <code><a href="#classboost_1_1circular__buffer_108dbf538b00a14daf5582ece80746fc3">rend()
- const</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_1db3d6b10b6763549f54d2627228fa7aa" name=
- "classboost_1_1circular__buffer_1db3d6b10b6763549f54d2627228fa7aa"></a><code><b><a href=
- "#classboost_1_1circular__buffer_1002fb890dded89e75dfeb6f021fb58a5">reverse_iterator</a>
- rbegin();</b></code><br>
- <br>
- Get the iterator pointing to the beginning of the "reversed" <code>circular_buffer</code>.
- <dl>
- <dt>
- <b>Returns:</b>
- </dt>
- <dd>
- A reverse random access iterator pointing to the last element of the <code>circular_buffer</code>. If
- the <code>circular_buffer</code> is empty it returns an iterator equal to the one returned by
- <code>rend()</code>.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- Nothing.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- No-throw.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Does not invalidate any iterators.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Constant (in the size of the <code>circular_buffer</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code>rend()</code>,
- <code>begin()</code>,
- <code>end()</code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_1cff9236a50107188b8942847a4dc2697" name=
- "classboost_1_1circular__buffer_1cff9236a50107188b8942847a4dc2697"></a><code><b><a href=
- "#classboost_1_1circular__buffer_1002fb890dded89e75dfeb6f021fb58a5">reverse_iterator</a>
- rend();</b></code><br>
- <br>
- Get the iterator pointing to the end of the "reversed" <code>circular_buffer</code>.
- <dl>
- <dt>
- <b>Returns:</b>
- </dt>
- <dd>
- A reverse random access iterator pointing to the element "one before" the first element of the
- <code>circular_buffer</code>. If the <code>circular_buffer</code> is empty it returns an iterator equal
- to the one returned by <code><a href=
- "#classboost_1_1circular__buffer_1db3d6b10b6763549f54d2627228fa7aa">rbegin()</a></code>.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- Nothing.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- No-throw.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Does not invalidate any iterators.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Constant (in the size of the <code>circular_buffer</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code>rbegin()</code>,
- <code>begin()</code>,
- <code>end()</code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_1765d91bf48341907418433a1e3aab026" name=
- "classboost_1_1circular__buffer_1765d91bf48341907418433a1e3aab026"></a><code><b><a href=
- "#classboost_1_1circular__buffer_1c7317701b511bc5f7a663b06b53e2b73">const_reverse_iterator</a> rbegin()
- const;</b></code><br>
- <br>
- Get the const iterator pointing to the beginning of the "reversed" <code>circular_buffer</code>.
- <dl>
- <dt>
- <b>Returns:</b>
- </dt>
- <dd>
- A const reverse random access iterator pointing to the last element of the
- <code>circular_buffer</code>. If the <code>circular_buffer</code> is empty it returns an iterator equal
- to the one returned by <code><a href=
- "#classboost_1_1circular__buffer_108dbf538b00a14daf5582ece80746fc3">rend() const</a></code>.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- Nothing.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- No-throw.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Does not invalidate any iterators.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Constant (in the size of the <code>circular_buffer</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href="#classboost_1_1circular__buffer_108dbf538b00a14daf5582ece80746fc3">rend()
- const</a></code>, <code><a href=
- "#classboost_1_1circular__buffer_10640d3d41c13b6089b6f169224cf1038">begin() const</a></code>,
- <code><a href="#classboost_1_1circular__buffer_17890810d07bc595cfb87f9c47cb075ac">end()
- const</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_108dbf538b00a14daf5582ece80746fc3" name=
- "classboost_1_1circular__buffer_108dbf538b00a14daf5582ece80746fc3"></a><code><b><a href=
- "#classboost_1_1circular__buffer_1c7317701b511bc5f7a663b06b53e2b73">const_reverse_iterator</a> rend()
- const;</b></code><br>
- <br>
- Get the const iterator pointing to the end of the "reversed" <code>circular_buffer</code>.
- <dl>
- <dt>
- <b>Returns:</b>
- </dt>
- <dd>
- A const reverse random access iterator pointing to the element "one before" the first element of the
- <code>circular_buffer</code>. If the <code>circular_buffer</code> is empty it returns an iterator equal
- to the one returned by <code><a href=
- "#classboost_1_1circular__buffer_1765d91bf48341907418433a1e3aab026">rbegin() const</a></code>.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- Nothing.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- No-throw.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Does not invalidate any iterators.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Constant (in the size of the <code>circular_buffer</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href="#classboost_1_1circular__buffer_1765d91bf48341907418433a1e3aab026">rbegin()
- const</a></code>, <code><a href=
- "#classboost_1_1circular__buffer_10640d3d41c13b6089b6f169224cf1038">begin() const</a></code>,
- <code><a href="#classboost_1_1circular__buffer_17890810d07bc595cfb87f9c47cb075ac">end()
- const</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_1d219f0d3203fb43b964a8cf63f1865cd" name=
- "classboost_1_1circular__buffer_1d219f0d3203fb43b964a8cf63f1865cd"></a><code><b><a href=
- "#classboost_1_1circular__buffer_1f38a9bc64d84757c661c2542ff9a7f65">reference</a> operator[](<a href=
- "#classboost_1_1circular__buffer_19ba12c0142a21a7d960877c22fa3ea00">size_type</a> index);</b></code><br>
- <br>
- Get the element at the <code>index</code> position.
- <dl>
- <dt>
- <b>Precondition:</b>
- </dt>
- <dd>
- <code>0 <= index && index < <a href=
- "#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a></code>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>index</code>
- </dt>
- <dd>
- The position of the element.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Returns:</b>
- </dt>
- <dd>
- A reference to the element at the <code>index</code> position.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- Nothing.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- No-throw.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Does not invalidate any iterators.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Constant (in the size of the <code>circular_buffer</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code>at()</code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_1eb0a7fe7f8a56a4dc4c933b93adfcef4" name=
- "classboost_1_1circular__buffer_1eb0a7fe7f8a56a4dc4c933b93adfcef4"></a><code><b><a href=
- "#classboost_1_1circular__buffer_1a8397191092f5bacee991b623ca4b910">const_reference</a> operator[](<a href=
- "#classboost_1_1circular__buffer_19ba12c0142a21a7d960877c22fa3ea00">size_type</a> index)
- const;</b></code><br>
- <br>
- Get the element at the <code>index</code> position.
- <dl>
- <dt>
- <b>Precondition:</b>
- </dt>
- <dd>
- <code>0 <= index && index < <a href=
- "#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a></code>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>index</code>
- </dt>
- <dd>
- The position of the element.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Returns:</b>
- </dt>
- <dd>
- A const reference to the element at the <code>index</code> position.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- Nothing.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- No-throw.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Does not invalidate any iterators.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Constant (in the size of the <code>circular_buffer</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code>at() const</code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_1cd84838cb4fffb6c113fd0297e502edc" name=
- "classboost_1_1circular__buffer_1cd84838cb4fffb6c113fd0297e502edc"></a><code><b><a href=
- "#classboost_1_1circular__buffer_1f38a9bc64d84757c661c2542ff9a7f65">reference</a> at(<a href=
- "#classboost_1_1circular__buffer_19ba12c0142a21a7d960877c22fa3ea00">size_type</a> index);</b></code><br>
- <br>
- Get the element at the <code>index</code> position.
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>index</code>
- </dt>
- <dd>
- The position of the element.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Returns:</b>
- </dt>
- <dd>
- A reference to the element at the <code>index</code> position.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- <code>std::out_of_range</code> when the <code>index</code> is invalid (when <code>index >= <a href=
- "#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a></code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- Strong.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Does not invalidate any iterators.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Constant (in the size of the <code>circular_buffer</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code>operator[]</code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_1b233a298f5845a0fcf2ecc56f4170810" name=
- "classboost_1_1circular__buffer_1b233a298f5845a0fcf2ecc56f4170810"></a><code><b><a href=
- "#classboost_1_1circular__buffer_1a8397191092f5bacee991b623ca4b910">const_reference</a> at(<a href=
- "#classboost_1_1circular__buffer_19ba12c0142a21a7d960877c22fa3ea00">size_type</a> index)
- const;</b></code><br>
- <br>
- Get the element at the <code>index</code> position.
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>index</code>
- </dt>
- <dd>
- The position of the element.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Returns:</b>
- </dt>
- <dd>
- A const reference to the element at the <code>index</code> position.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- <code>std::out_of_range</code> when the <code>index</code> is invalid (when <code>index >= <a href=
- "#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a></code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- Strong.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Does not invalidate any iterators.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Constant (in the size of the <code>circular_buffer</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href="#classboost_1_1circular__buffer_1eb0a7fe7f8a56a4dc4c933b93adfcef4">operator[]
- const</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_10d5fdeabeb352f47d1f7bb1ea8d9819f" name=
- "classboost_1_1circular__buffer_10d5fdeabeb352f47d1f7bb1ea8d9819f"></a><code><b><a href=
- "#classboost_1_1circular__buffer_1f38a9bc64d84757c661c2542ff9a7f65">reference</a> front();</b></code><br>
- <br>
- Get the first element.
- <dl>
- <dt>
- <b>Precondition:</b>
- </dt>
- <dd>
- <code>!empty()</code>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Returns:</b>
- </dt>
- <dd>
- A reference to the first element of the <code>circular_buffer</code>.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- Nothing.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- No-throw.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Does not invalidate any iterators.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Constant (in the size of the <code>circular_buffer</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code>back()</code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_1d985d974020f88bb4255d8edbae0a30a" name=
- "classboost_1_1circular__buffer_1d985d974020f88bb4255d8edbae0a30a"></a><code><b><a href=
- "#classboost_1_1circular__buffer_1f38a9bc64d84757c661c2542ff9a7f65">reference</a> back();</b></code><br>
- <br>
- Get the last element.
- <dl>
- <dt>
- <b>Precondition:</b>
- </dt>
- <dd>
- <code>!empty()</code>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Returns:</b>
- </dt>
- <dd>
- A reference to the last element of the <code>circular_buffer</code>.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- Nothing.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- No-throw.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Does not invalidate any iterators.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Constant (in the size of the <code>circular_buffer</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code>front()</code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_10df8595d83bb9d8a7ce50aabc678f90b" name=
- "classboost_1_1circular__buffer_10df8595d83bb9d8a7ce50aabc678f90b"></a><code><b><a href=
- "#classboost_1_1circular__buffer_1a8397191092f5bacee991b623ca4b910">const_reference</a> front()
- const;</b></code><br>
- <br>
- Get the first element.
- <dl>
- <dt>
- <b>Precondition:</b>
- </dt>
- <dd>
- <code>!empty()</code>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Returns:</b>
- </dt>
- <dd>
- A const reference to the first element of the <code>circular_buffer</code>.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- Nothing.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- No-throw.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Does not invalidate any iterators.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Constant (in the size of the <code>circular_buffer</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href="#classboost_1_1circular__buffer_1027201797868c6274feb6712f670a132">back()
- const</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_1027201797868c6274feb6712f670a132" name=
- "classboost_1_1circular__buffer_1027201797868c6274feb6712f670a132"></a><code><b><a href=
- "#classboost_1_1circular__buffer_1a8397191092f5bacee991b623ca4b910">const_reference</a> back()
- const;</b></code><br>
- <br>
- Get the last element.
- <dl>
- <dt>
- <b>Precondition:</b>
- </dt>
- <dd>
- <code>!empty()</code>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Returns:</b>
- </dt>
- <dd>
- A const reference to the last element of the <code>circular_buffer</code>.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- Nothing.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- No-throw.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Does not invalidate any iterators.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Constant (in the size of the <code>circular_buffer</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href="#classboost_1_1circular__buffer_10df8595d83bb9d8a7ce50aabc678f90b">front()
- const</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_1957cccdcb0c4ef7d80a34a990065818d" name=
- "classboost_1_1circular__buffer_1957cccdcb0c4ef7d80a34a990065818d"></a><code><b><a href=
- "#classboost_1_1circular__buffer_126d279f91fef717e25459a0817ff242f">array_range</a>
- array_one();</b></code><br>
- <br>
- Get the first continuous array of the internal buffer.
- <p>
- This method in combination with <code><a href=
- "#classboost_1_1circular__buffer_1f5081a54afbc2dfc1a7fb20329df7d5b">array_two()</a></code> can be useful
- when passing the stored data into a legacy C API as an array. Suppose there is a
- <code>circular_buffer</code> of capacity 10, containing 7 characters <code>'a', 'b', ..., 'g'</code>
- where <code>buff[0] == 'a'</code>, <code>buff[1] == 'b'</code>, ... and <code>buff[6] == 'g'</code>:<br>
- <br>
- <code>circular_buffer<char> buff(10);</code><br>
- <br>
- The internal representation is often not linear and the state of the internal buffer may look like
- this:<br>
- <br>
- <code>|e|f|g| | | |a|b|c|d|<br>
- end ---^<br>
- begin -------^</code><br>
- <br>
- where <code>|a|b|c|d|</code> represents the "array one", <code>|e|f|g|</code> represents the "array two"
- and <code>| | | |</code> is a free space.<br>
- Now consider a typical C style function for writing data into a file:<br>
- <br>
- <code>int write(int file_desc, char* buff, int num_bytes);</code><br>
- <br>
- There are two ways how to write the content of the <code>circular_buffer</code> into a file. Either
- relying on <code><a href=
- "#classboost_1_1circular__buffer_1957cccdcb0c4ef7d80a34a990065818d">array_one()</a></code> and
- <code>array_two()</code>
- methods and calling the write function twice:<br>
- <br>
- <code>array_range ar = buff.array_one();<br>
- write(file_desc, ar.first, ar.second);<br>
- ar = buff.array_two();<br>
- write(file_desc, ar.first, ar.second);</code><br>
- <br>
- Or relying on the <code><a href=
- "#classboost_1_1circular__buffer_1ea728bf57f91aa8946eddf76ce816a4e">linearize()</a></code> method:<br>
- <br>
- <code>write(file_desc, buff.linearize(), buff.size());</code><br>
- <br>
- Since the complexity of <code><a href=
- "#classboost_1_1circular__buffer_1957cccdcb0c4ef7d80a34a990065818d">array_one()</a></code> and
- <code>array_two()</code>
- 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 <code><a href=
- "#classboost_1_1circular__buffer_1ea728bf57f91aa8946eddf76ce816a4e">linearize()</a></code> method whose
- complexity is linear.
- </p>
- <dl>
- <dt>
- <b>Returns:</b>
- </dt>
- <dd>
- The array range of the first continuous array of the internal buffer. In the case the
- <code>circular_buffer</code> is empty the size of the returned array is <code>0</code>.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- Nothing.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- No-throw.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Does not invalidate any iterators.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Constant (in the size of the <code>circular_buffer</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Warning:</b>
- </dt>
- <dd>
- 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 <code><a href=
- "#classboost_1_1circular__buffer_1957cccdcb0c4ef7d80a34a990065818d">array_one()</a></code> and
- <code><a href=
- "#classboost_1_1circular__buffer_1f5081a54afbc2dfc1a7fb20329df7d5b">array_two()</a></code> (and their
- const versions).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Note:</b>
- </dt>
- <dd>
- In the case the internal buffer is linear e.g. <code>|a|b|c|d|e|f|g| | | |</code> the "array one" is
- represented by <code>|a|b|c|d|e|f|g|</code> and the "array two" does not exist (the <code><a href=
- "#classboost_1_1circular__buffer_1f5081a54afbc2dfc1a7fb20329df7d5b">array_two()</a></code> method
- returns an array with the size <code>0</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href=
- "#classboost_1_1circular__buffer_1f5081a54afbc2dfc1a7fb20329df7d5b">array_two()</a></code>,
- <code><a href=
- "#classboost_1_1circular__buffer_1ea728bf57f91aa8946eddf76ce816a4e">linearize()</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_1f5081a54afbc2dfc1a7fb20329df7d5b" name=
- "classboost_1_1circular__buffer_1f5081a54afbc2dfc1a7fb20329df7d5b"></a><code><b><a href=
- "#classboost_1_1circular__buffer_126d279f91fef717e25459a0817ff242f">array_range</a>
- array_two();</b></code><br>
- <br>
- Get the second continuous array of the internal buffer.
- <p>
- This method in combination with <code><a href=
- "#classboost_1_1circular__buffer_1957cccdcb0c4ef7d80a34a990065818d">array_one()</a></code> can be useful
- when passing the stored data into a legacy C API as an array.
- </p>
- <dl>
- <dt>
- <b>Returns:</b>
- </dt>
- <dd>
- The array range of the second continuous array of the internal buffer. In the case the internal buffer
- is linear or the <code>circular_buffer</code> is empty the size of the returned array is
- <code>0</code>.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- Nothing.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- No-throw.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Does not invalidate any iterators.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Constant (in the size of the <code>circular_buffer</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href=
- "#classboost_1_1circular__buffer_1957cccdcb0c4ef7d80a34a990065818d">array_one()</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_10f4b157e27b1170a571417986b239945" name=
- "classboost_1_1circular__buffer_10f4b157e27b1170a571417986b239945"></a><code><b><a href=
- "#classboost_1_1circular__buffer_11885d7f475b7e7a74c95b2448d243025">const_array_range</a> array_one()
- const;</b></code><br>
- <br>
- Get the first continuous array of the internal buffer.
- <p>
- This method in combination with <code><a href=
- "#classboost_1_1circular__buffer_1bb8eb0f298ad2012c55c5303e1f174d5">array_two() const</a></code> can be
- useful when passing the stored data into a legacy C API as an array.
- </p>
- <dl>
- <dt>
- <b>Returns:</b>
- </dt>
- <dd>
- The array range of the first continuous array of the internal buffer. In the case the
- <code>circular_buffer</code> is empty the size of the returned array is <code>0</code>.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- Nothing.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- No-throw.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Does not invalidate any iterators.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Constant (in the size of the <code>circular_buffer</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href="#classboost_1_1circular__buffer_1bb8eb0f298ad2012c55c5303e1f174d5">array_two()
- const</a></code>; <code><a href=
- "#classboost_1_1circular__buffer_1957cccdcb0c4ef7d80a34a990065818d">array_one()</a></code> for more
- details how to pass data into a legacy C API.
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_1bb8eb0f298ad2012c55c5303e1f174d5" name=
- "classboost_1_1circular__buffer_1bb8eb0f298ad2012c55c5303e1f174d5"></a><code><b><a href=
- "#classboost_1_1circular__buffer_11885d7f475b7e7a74c95b2448d243025">const_array_range</a> array_two()
- const;</b></code><br>
- <br>
- Get the second continuous array of the internal buffer.
- <p>
- This method in combination with <code><a href=
- "#classboost_1_1circular__buffer_10f4b157e27b1170a571417986b239945">array_one() const</a></code> can be
- useful when passing the stored data into a legacy C API as an array.
- </p>
- <dl>
- <dt>
- <b>Returns:</b>
- </dt>
- <dd>
- The array range of the second continuous array of the internal buffer. In the case the internal buffer
- is linear or the <code>circular_buffer</code> is empty the size of the returned array is
- <code>0</code>.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- Nothing.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- No-throw.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Does not invalidate any iterators.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Constant (in the size of the <code>circular_buffer</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href="#classboost_1_1circular__buffer_10f4b157e27b1170a571417986b239945">array_one()
- const</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_1ea728bf57f91aa8946eddf76ce816a4e" name=
- "classboost_1_1circular__buffer_1ea728bf57f91aa8946eddf76ce816a4e"></a><code><b><a href=
- "#classboost_1_1circular__buffer_14ff917f8a6131ec18e91606727592a9c">pointer</a> linearize();</b></code><br>
- <br>
- Linearize the internal buffer into a continuous array.
- <p>
- This method can be useful when passing the stored data into a legacy C API as an array.
- </p>
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- <code>&(*this)[0] < &(*this)[1] < ... < &(*this)[<a href=
- "#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> - 1]</code>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Returns:</b>
- </dt>
- <dd>
- A pointer to the beginning of the array or <code>0</code> if empty.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- Whatever <code>T::T(const T&)</code> throws.
- </dd>
- <dd>
- Whatever <code>T::operator = (const T&)</code> throws.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- Basic; no-throw if the operations in the <i>Throws</i> section do not throw anything.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Invalidates all iterators pointing to the <code>circular_buffer</code> (except iterators equal to
- <code>end()</code>);
- does not invalidate any iterators if the postcondition (the <i>Effect</i>) is already met prior calling
- this method.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Linear (in the size of the <code>circular_buffer</code>); constant if the postcondition (the
- <i>Effect</i>) is already met.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Warning:</b>
- </dt>
- <dd>
- In general invoking any method which modifies the internal state of the <code>circular_buffer</code>
- may delinearize the internal buffer and invalidate the returned pointer.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href=
- "#classboost_1_1circular__buffer_1957cccdcb0c4ef7d80a34a990065818d">array_one()</a></code> and
- <code><a href=
- "#classboost_1_1circular__buffer_1f5081a54afbc2dfc1a7fb20329df7d5b">array_two()</a></code> for the
- other option how to pass data into a legacy C API; <code><a href=
- "#classboost_1_1circular__buffer_120f64448dc0723cc68c1096f6b00bc0a">is_linearized()</a></code>,
- <code><a href=
- "#classboost_1_1circular__buffer_1c591bb9e271b10b5240afcff3bd2c619">rotate(const_iterator)</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_120f64448dc0723cc68c1096f6b00bc0a" name=
- "classboost_1_1circular__buffer_120f64448dc0723cc68c1096f6b00bc0a"></a><code><b>bool is_linearized()
- const;</b></code><br>
- <br>
- Is the <code>circular_buffer</code> linearized?
- <dl>
- <dt>
- <b>Returns:</b>
- </dt>
- <dd>
- <code>true</code> if the internal buffer is linearized into a continuous array (i.e. the
- <code>circular_buffer</code> meets a condition <code>&(*this)[0] < &(*this)[1] < ... <
- &(*this)[size() -
- 1]</code>); <code>false</code> otherwise.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- Nothing.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- No-throw.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Does not invalidate any iterators.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Constant (in the size of the <code>circular_buffer</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href=
- "#classboost_1_1circular__buffer_1ea728bf57f91aa8946eddf76ce816a4e">linearize()</a></code>,
- <code><a href=
- "#classboost_1_1circular__buffer_1957cccdcb0c4ef7d80a34a990065818d">array_one()</a></code>,
- <code><a href=
- "#classboost_1_1circular__buffer_1f5081a54afbc2dfc1a7fb20329df7d5b">array_two()</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_1c591bb9e271b10b5240afcff3bd2c619" name=
- "classboost_1_1circular__buffer_1c591bb9e271b10b5240afcff3bd2c619"></a><code><b>void rotate(<a href=
- "#classboost_1_1circular__buffer_15cab6d46f03c40d1e52d41843319ddb9">const_iterator</a>
- new_begin);</b></code><br>
- <br>
- Rotate elements in the <code>circular_buffer</code>.
- <p>
- A more effective implementation of <code><a href=
- "http://www.sgi.com/tech/stl/rotate.html">std::rotate</a></code>.
- </p>
- <dl>
- <dt>
- <b>Precondition:</b>
- </dt>
- <dd>
- <code>new_begin</code> is a valid iterator pointing to the <code>circular_buffer</code> <b>except</b>
- its end.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- Before calling the method suppose:<br>
- <br>
- <code>m == std::distance(new_begin, <a href=
- "#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a>)</code><br>
- <code>n == std::distance(<a href=
- "#classboost_1_1circular__buffer_158d1ede2e85f5d46eda8db3f0c4efef0">begin()</a>, new_begin)</code><br>
- <code>val_0 == *new_begin, val_1 == *(new_begin + 1), ... val_m == *(new_begin + m)</code><br>
- <code>val_r1 == *(new_begin - 1), val_r2 == *(new_begin - 2), ... val_rn == *(new_begin - n)</code><br>
- <br>
- then after call to the method:<br>
- <br>
- <code>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]</code>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>new_begin</code>
- </dt>
- <dd>
- The new beginning.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- Whatever <code>T::T(const T&)</code> throws.
- </dd>
- <dd>
- Whatever <code>T::operator = (const T&)</code> throws.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- Basic; no-throw if the <code>circular_buffer</code> is full or <code>new_begin</code> points to
- <code>begin()</code> or
- if the operations in the <i>Throws</i> section do not throw anything.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- If <code>m < n</code> invalidates iterators pointing to the last <code>m</code> elements
- (<b>including</b> <code>new_begin</code>, but not iterators equal to <code><a href=
- "#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a></code>) else invalidates
- iterators pointing to the first <code>n</code> elements; does not invalidate any iterators if the
- <code>circular_buffer</code> is full.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Linear (in <code>(std::min)(m, n)</code>); constant if the <code>circular_buffer</code> is full.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code>std::rotate</code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32" name=
- "classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32"></a><code><b><a href=
- "#classboost_1_1circular__buffer_19ba12c0142a21a7d960877c22fa3ea00">size_type</a> size()
- const;</b></code><br>
- <br>
- Get the number of elements currently stored in the <code>circular_buffer</code>.
- <dl>
- <dt>
- <b>Returns:</b>
- </dt>
- <dd>
- The number of elements stored in the <code>circular_buffer</code>.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- Nothing.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- No-throw.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Does not invalidate any iterators.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Constant (in the size of the <code>circular_buffer</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href=
- "#classboost_1_1circular__buffer_15ebab2b2538d733790b5752582728e77">capacity()</a></code>,
- <code><a href=
- "#classboost_1_1circular__buffer_157e2d506bc274b2a63fbe1b8fcafebd7">max_size()</a></code>,
- <code>reserve()</code>,
- <code><a href="#classboost_1_1circular__buffer_180c2e2e66a8fa9d0b7adc1b54921a8c3">resize(size_type,
- const_reference)</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_157e2d506bc274b2a63fbe1b8fcafebd7" name=
- "classboost_1_1circular__buffer_157e2d506bc274b2a63fbe1b8fcafebd7"></a><code><b><a href=
- "#classboost_1_1circular__buffer_19ba12c0142a21a7d960877c22fa3ea00">size_type</a> max_size()
- const;</b></code><br>
- <br>
- Get the largest possible size or capacity of the <code>circular_buffer</code>. (It depends on allocator's
- max_size()).
- <dl>
- <dt>
- <b>Returns:</b>
- </dt>
- <dd>
- The maximum size/capacity the <code>circular_buffer</code> can be set to.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- Nothing.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- No-throw.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Does not invalidate any iterators.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Constant (in the size of the <code>circular_buffer</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code>size()</code>,
- <code><a href=
- "#classboost_1_1circular__buffer_15ebab2b2538d733790b5752582728e77">capacity()</a></code>,
- <code>reserve()</code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_15be1c2a005ec9828549ef6dd7ebed583" name=
- "classboost_1_1circular__buffer_15be1c2a005ec9828549ef6dd7ebed583"></a><code><b>bool empty()
- const;</b></code><br>
- <br>
- Is the <code>circular_buffer</code> empty?
- <dl>
- <dt>
- <b>Returns:</b>
- </dt>
- <dd>
- <code>true</code> if there are no elements stored in the <code>circular_buffer</code>;
- <code>false</code> otherwise.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- Nothing.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- No-throw.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Does not invalidate any iterators.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Constant (in the size of the <code>circular_buffer</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code>full()</code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_1fd0eef8ba91210d1575404b7e3e8207a" name=
- "classboost_1_1circular__buffer_1fd0eef8ba91210d1575404b7e3e8207a"></a><code><b>bool full()
- const;</b></code><br>
- <br>
- Is the <code>circular_buffer</code> full?
- <dl>
- <dt>
- <b>Returns:</b>
- </dt>
- <dd>
- <code>true</code> if the number of elements stored in the <code>circular_buffer</code> equals the
- capacity of the <code>circular_buffer</code>; <code>false</code> otherwise.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- Nothing.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- No-throw.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Does not invalidate any iterators.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Constant (in the size of the <code>circular_buffer</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code>empty()</code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_10a02c4fbc53385e98569e810be9843de" name=
- "classboost_1_1circular__buffer_10a02c4fbc53385e98569e810be9843de"></a><code><b><a href=
- "#classboost_1_1circular__buffer_19ba12c0142a21a7d960877c22fa3ea00">size_type</a> reserve()
- const;</b></code><br>
- <br>
- Get the maximum number of elements which can be inserted into the <code>circular_buffer</code> without
- overwriting any of already stored elements.
- <dl>
- <dt>
- <b>Returns:</b>
- </dt>
- <dd>
- <code>capacity() -
- size()</code>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- Nothing.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- No-throw.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Does not invalidate any iterators.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Constant (in the size of the <code>circular_buffer</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href=
- "#classboost_1_1circular__buffer_15ebab2b2538d733790b5752582728e77">capacity()</a></code>,
- <code>size()</code>,
- <code>max_size()</code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_15ebab2b2538d733790b5752582728e77" name=
- "classboost_1_1circular__buffer_15ebab2b2538d733790b5752582728e77"></a><code><b><a href=
- "#classboost_1_1circular__buffer_1dc642ff2be4db0be1a457810e5d09595">capacity_type</a> capacity()
- const;</b></code><br>
- <br>
- Get the capacity of the <code>circular_buffer</code>.
- <dl>
- <dt>
- <b>Returns:</b>
- </dt>
- <dd>
- The maximum number of elements which can be stored in the <code>circular_buffer</code>.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- Nothing.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- No-throw.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Does not invalidate any iterators.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Constant (in the size of the <code>circular_buffer</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code>reserve()</code>,
- <code>size()</code>,
- <code><a href=
- "#classboost_1_1circular__buffer_157e2d506bc274b2a63fbe1b8fcafebd7">max_size()</a></code>,
- <code><a href=
- "#classboost_1_1circular__buffer_161714204ef5172d156e2c7eccd04998f">set_capacity(capacity_type)</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_161714204ef5172d156e2c7eccd04998f" name=
- "classboost_1_1circular__buffer_161714204ef5172d156e2c7eccd04998f"></a><code><b>void set_capacity(<a href=
- "#classboost_1_1circular__buffer_1dc642ff2be4db0be1a457810e5d09595">capacity_type</a>
- new_capacity);</b></code><br>
- <br>
- Change the capacity of the <code>circular_buffer</code>.
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- <code>capacity() ==
- new_capacity && <a href=
- "#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> <=
- new_capacity</code><br>
- <br>
- If the current number of elements stored in the <code>circular_buffer</code> is greater than the
- desired new capacity then number of <code>[<a href=
- "#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> - new_capacity]</code>
- <b>last</b> elements will be removed and the new size will be equal to <code>new_capacity</code>.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>new_capacity</code>
- </dt>
- <dd>
- The new capacity.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- An allocation error if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
- used).
- </dd>
- <dd>
- Whatever <code>T::T(const T&)</code> throws.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- Strong.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Invalidates all iterators pointing to the <code>circular_buffer</code> (except iterators equal to
- <code>end()</code>) if
- the new capacity is different from the original.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Linear (in <code>min[<a href=
- "#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a>, new_capacity]</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href=
- "#classboost_1_1circular__buffer_1477715e9d31d2cc5b02ad8ecf3c68c46">rset_capacity(capacity_type)</a></code>,
- <code><a href="#classboost_1_1circular__buffer_180c2e2e66a8fa9d0b7adc1b54921a8c3">resize(size_type,
- const_reference)</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_180c2e2e66a8fa9d0b7adc1b54921a8c3" name=
- "classboost_1_1circular__buffer_180c2e2e66a8fa9d0b7adc1b54921a8c3"></a><code><b>void resize(<a href=
- "#classboost_1_1circular__buffer_19ba12c0142a21a7d960877c22fa3ea00">size_type</a> new_size, <a href=
- "#classboost_1_1circular__buffer_1a8397191092f5bacee991b623ca4b910">const_reference</a> item =
- value_type());</b></code><br>
- <br>
- Change the size of the <code>circular_buffer</code>.
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- <code>size() ==
- new_size && <a href=
- "#classboost_1_1circular__buffer_15ebab2b2538d733790b5752582728e77">capacity()</a> >=
- new_size</code><br>
- <br>
- If the new size is greater than the current size, copies of <code>item</code> will be inserted at the
- <b>back</b> of the of the <code>circular_buffer</code> in order to achieve the desired size. In the
- case the resulting size exceeds the current capacity the capacity will be set to
- <code>new_size</code>.<br>
- If the current number of elements stored in the <code>circular_buffer</code> is greater than the
- desired new size then number of <code>[<a href=
- "#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> - new_size]</code>
- <b>last</b> elements will be removed. (The capacity will remain unchanged.)
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>new_size</code>
- </dt>
- <dd>
- The new size.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>item</code>
- </dt>
- <dd>
- The element the <code>circular_buffer</code> will be filled with in order to gain the requested
- size. (See the <i>Effect</i>.)
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- An allocation error if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
- used).
- </dd>
- <dd>
- Whatever <code>T::T(const T&)</code> throws.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- Basic.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Invalidates all iterators pointing to the <code>circular_buffer</code> (except iterators equal to
- <code>end()</code>) 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.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Linear (in the new size of the <code>circular_buffer</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href="#classboost_1_1circular__buffer_144ecd9ec5f54a2d61c7d132e445d3483">rresize(size_type,
- const_reference)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer_161714204ef5172d156e2c7eccd04998f">set_capacity(capacity_type)</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_1477715e9d31d2cc5b02ad8ecf3c68c46" name=
- "classboost_1_1circular__buffer_1477715e9d31d2cc5b02ad8ecf3c68c46"></a><code><b>void rset_capacity(<a href=
- "#classboost_1_1circular__buffer_1dc642ff2be4db0be1a457810e5d09595">capacity_type</a>
- new_capacity);</b></code><br>
- <br>
- Change the capacity of the <code>circular_buffer</code>.
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- <code>capacity() ==
- new_capacity && <a href=
- "#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> <=
- new_capacity</code><br>
- <br>
- If the current number of elements stored in the <code>circular_buffer</code> is greater than the
- desired new capacity then number of <code>[<a href=
- "#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> - new_capacity]</code>
- <b>first</b> elements will be removed and the new size will be equal to <code>new_capacity</code>.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>new_capacity</code>
- </dt>
- <dd>
- The new capacity.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- An allocation error if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
- used).
- </dd>
- <dd>
- Whatever <code>T::T(const T&)</code> throws.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- Strong.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Invalidates all iterators pointing to the <code>circular_buffer</code> (except iterators equal to
- <code>end()</code>) if
- the new capacity is different from the original.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Linear (in <code>min[<a href=
- "#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a>, new_capacity]</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href=
- "#classboost_1_1circular__buffer_161714204ef5172d156e2c7eccd04998f">set_capacity(capacity_type)</a></code>,
- <code><a href="#classboost_1_1circular__buffer_144ecd9ec5f54a2d61c7d132e445d3483">rresize(size_type,
- const_reference)</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_144ecd9ec5f54a2d61c7d132e445d3483" name=
- "classboost_1_1circular__buffer_144ecd9ec5f54a2d61c7d132e445d3483"></a><code><b>void rresize(<a href=
- "#classboost_1_1circular__buffer_19ba12c0142a21a7d960877c22fa3ea00">size_type</a> new_size, <a href=
- "#classboost_1_1circular__buffer_1a8397191092f5bacee991b623ca4b910">const_reference</a> item =
- value_type());</b></code><br>
- <br>
- Change the size of the <code>circular_buffer</code>.
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- <code>size() ==
- new_size && <a href=
- "#classboost_1_1circular__buffer_15ebab2b2538d733790b5752582728e77">capacity()</a> >=
- new_size</code><br>
- <br>
- If the new size is greater than the current size, copies of <code>item</code> will be inserted at the
- <b>front</b> of the of the <code>circular_buffer</code> in order to achieve the desired size. In the
- case the resulting size exceeds the current capacity the capacity will be set to
- <code>new_size</code>.<br>
- If the current number of elements stored in the <code>circular_buffer</code> is greater than the
- desired new size then number of <code>[<a href=
- "#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> - new_size]</code>
- <b>first</b> elements will be removed. (The capacity will remain unchanged.)
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>new_size</code>
- </dt>
- <dd>
- The new size.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>item</code>
- </dt>
- <dd>
- The element the <code>circular_buffer</code> will be filled with in order to gain the requested
- size. (See the <i>Effect</i>.)
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- An allocation error if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
- used).
- </dd>
- <dd>
- Whatever <code>T::T(const T&)</code> throws.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- Basic.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Invalidates all iterators pointing to the <code>circular_buffer</code> (except iterators equal to
- <code>end()</code>) 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.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Linear (in the new size of the <code>circular_buffer</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href="#classboost_1_1circular__buffer_180c2e2e66a8fa9d0b7adc1b54921a8c3">resize(size_type,
- const_reference)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer_1477715e9d31d2cc5b02ad8ecf3c68c46">rset_capacity(capacity_type)</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_1db1558911b2e251a587aeb3d8b3d797d" name=
- "classboost_1_1circular__buffer_1db1558911b2e251a587aeb3d8b3d797d"></a><code><b>circular_buffer<T,Alloc>&
- operator=(const circular_buffer<T,Alloc>& cb);</b></code><br>
- <br>
- The assign operator.
- <p>
- Makes this <code>circular_buffer</code> to become a copy of the specified <code>circular_buffer</code>.
- </p>
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- <code>*this == cb</code>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>cb</code>
- </dt>
- <dd>
- The <code>circular_buffer</code> to be copied.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- An allocation error if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
- used).
- </dd>
- <dd>
- Whatever <code>T::T(const T&)</code> throws.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- Strong.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Invalidates all iterators pointing to this <code>circular_buffer</code> (except iterators equal to
- <code>end()</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Linear (in the size of <code>cb</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href="#classboost_1_1circular__buffer_19ba4a81df16f386d31b04b49c82d1ada">assign(size_type,
- const_reference)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer_1dbebb80a5f38e52a37ec9f3ed765600a">assign(capacity_type, size_type,
- const_reference)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer_1253302d9bda5d7efbc4a6c311de3790c">assign(InputIterator,
- InputIterator)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer_127cab6034beeeb0e11863c8c14d14366">assign(capacity_type,
- InputIterator, InputIterator)</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_19ba4a81df16f386d31b04b49c82d1ada" name=
- "classboost_1_1circular__buffer_19ba4a81df16f386d31b04b49c82d1ada"></a><code><b>void assign(<a href=
- "#classboost_1_1circular__buffer_19ba12c0142a21a7d960877c22fa3ea00">size_type</a> n, <a href=
- "#classboost_1_1circular__buffer_1a8397191092f5bacee991b623ca4b910">const_reference</a>
- item);</b></code><br>
- <br>
- Assign <code>n</code> items into the <code>circular_buffer</code>.
- <p>
- The content of the <code>circular_buffer</code> will be removed and replaced with <code>n</code> copies
- of the <code>item</code>.
- </p>
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- <code>capacity() == n
- && size() == n
- && (*this)[0] == item && (*this)[1] == item && ... && (*this) [n - 1]
- == item</code>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>n</code>
- </dt>
- <dd>
- The number of elements the <code>circular_buffer</code> will be filled with.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>item</code>
- </dt>
- <dd>
- The element the <code>circular_buffer</code> will be filled with.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- An allocation error if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
- used).
- </dd>
- <dd>
- Whatever <code>T::T(const T&)</code> throws.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- Basic.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Invalidates all iterators pointing to the <code>circular_buffer</code> (except iterators equal to
- <code>end()</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Linear (in the <code>n</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code>operator=</code>,
- <code><a href="#classboost_1_1circular__buffer_1dbebb80a5f38e52a37ec9f3ed765600a">assign(capacity_type,
- size_type, const_reference)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer_1253302d9bda5d7efbc4a6c311de3790c">assign(InputIterator,
- InputIterator)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer_127cab6034beeeb0e11863c8c14d14366">assign(capacity_type,
- InputIterator, InputIterator)</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_1dbebb80a5f38e52a37ec9f3ed765600a" name=
- "classboost_1_1circular__buffer_1dbebb80a5f38e52a37ec9f3ed765600a"></a><code><b>void assign(<a href=
- "#classboost_1_1circular__buffer_1dc642ff2be4db0be1a457810e5d09595">capacity_type</a> buffer_capacity,
- size_type n, <a href=
- "#classboost_1_1circular__buffer_1a8397191092f5bacee991b623ca4b910">const_reference</a>
- item);</b></code><br>
- <br>
- Assign <code>n</code> items into the <code>circular_buffer</code> specifying the capacity.
- <p>
- The capacity of the <code>circular_buffer</code> will be set to the specified value and the content of
- the <code>circular_buffer</code> will be removed and replaced with <code>n</code> copies of the
- <code>item</code>.
- </p>
- <dl>
- <dt>
- <b>Precondition:</b>
- </dt>
- <dd>
- <code>capacity >= n</code>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- <code>capacity() ==
- buffer_capacity && <a href=
- "#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> == n &&
- (*this)[0] == item && (*this)[1] == item && ... && (*this) [n - 1] ==
- item</code>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>buffer_capacity</code>
- </dt>
- <dd>
- The new capacity.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>n</code>
- </dt>
- <dd>
- The number of elements the <code>circular_buffer</code> will be filled with.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>item</code>
- </dt>
- <dd>
- The element the <code>circular_buffer</code> will be filled with.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- An allocation error if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
- used).
- </dd>
- <dd>
- Whatever <code>T::T(const T&)</code> throws.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- Basic.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Invalidates all iterators pointing to the <code>circular_buffer</code> (except iterators equal to
- <code>end()</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Linear (in the <code>n</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code>operator=</code>,
- <code><a href="#classboost_1_1circular__buffer_19ba4a81df16f386d31b04b49c82d1ada">assign(size_type,
- const_reference)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer_1253302d9bda5d7efbc4a6c311de3790c">assign(InputIterator,
- InputIterator)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer_127cab6034beeeb0e11863c8c14d14366">assign(capacity_type,
- InputIterator, InputIterator)</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_1253302d9bda5d7efbc4a6c311de3790c" name=
- "classboost_1_1circular__buffer_1253302d9bda5d7efbc4a6c311de3790c"></a> <code><b>template <class
- InputIterator><br>
- void assign(InputIterator first, InputIterator last);</b></code><br>
- <br>
- Assign a copy of the range into the <code>circular_buffer</code>.
- <p>
- The content of the <code>circular_buffer</code> will be removed and replaced with copies of elements from
- the specified range.
- </p>
- <dl>
- <dt>
- <b>Precondition:</b>
- </dt>
- <dd>
- Valid range <code>[first, last)</code>.<br>
- <code>first</code> and <code>last</code> have to meet the requirements of <a href=
- "http://www.sgi.com/tech/stl/InputIterator.html">InputIterator</a>.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- <code>capacity() ==
- std::distance(first, last) && <a href=
- "#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> == std::distance(first,
- last) && (*this)[0]== *first && (*this)[1] == *(first + 1) && ... &&
- (*this)[std::distance(first, last) - 1] == *(last - 1)</code>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>first</code>
- </dt>
- <dd>
- The beginning of the range to be copied.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>last</code>
- </dt>
- <dd>
- The end of the range to be copied.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- An allocation error if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
- used).
- </dd>
- <dd>
- Whatever <code>T::T(const T&)</code> throws.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- Basic.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Invalidates all iterators pointing to the <code>circular_buffer</code> (except iterators equal to
- <code>end()</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Linear (in the <code>std::distance(first, last)</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code>operator=</code>,
- <code><a href="#classboost_1_1circular__buffer_19ba4a81df16f386d31b04b49c82d1ada">assign(size_type,
- const_reference)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer_1dbebb80a5f38e52a37ec9f3ed765600a">assign(capacity_type, size_type,
- const_reference)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer_127cab6034beeeb0e11863c8c14d14366">assign(capacity_type,
- InputIterator, InputIterator)</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_127cab6034beeeb0e11863c8c14d14366" name=
- "classboost_1_1circular__buffer_127cab6034beeeb0e11863c8c14d14366"></a> <code><b>template <class
- InputIterator><br>
- void assign(<a href=
- "#classboost_1_1circular__buffer_1dc642ff2be4db0be1a457810e5d09595">capacity_type</a> buffer_capacity,
- InputIterator first, InputIterator last);</b></code><br>
- <br>
- Assign a copy of the range into the <code>circular_buffer</code> specifying the capacity.
- <p>
- The capacity of the <code>circular_buffer</code> will be set to the specified value and the content of
- the <code>circular_buffer</code> will be removed and replaced with copies of elements from the specified
- range.
- </p>
- <dl>
- <dt>
- <b>Precondition:</b>
- </dt>
- <dd>
- Valid range <code>[first, last)</code>.<br>
- <code>first</code> and <code>last</code> have to meet the requirements of <a href=
- "http://www.sgi.com/tech/stl/InputIterator.html">InputIterator</a>.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- <code>capacity() ==
- buffer_capacity && <a href=
- "#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> <=
- std::distance(first, last) && (*this)[0]== *(last - buffer_capacity) && (*this)[1] ==
- *(last - buffer_capacity + 1) && ... && (*this)[buffer_capacity - 1] == *(last -
- 1)</code><br>
- <br>
- If the number of items to be copied from the range <code>[first, last)</code> is greater than the
- specified <code>buffer_capacity</code> then only elements from the range <code>[last - buffer_capacity,
- last)</code> will be copied.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>buffer_capacity</code>
- </dt>
- <dd>
- The new capacity.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>first</code>
- </dt>
- <dd>
- The beginning of the range to be copied.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>last</code>
- </dt>
- <dd>
- The end of the range to be copied.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- An allocation error if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
- used).
- </dd>
- <dd>
- Whatever <code>T::T(const T&)</code> throws.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- Basic.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Invalidates all iterators pointing to the <code>circular_buffer</code> (except iterators equal to
- <code>end()</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Linear (in <code>std::distance(first, last)</code>; in <code>min[capacity, std::distance(first,
- last)]</code> if the <code>InputIterator</code> is a <a href=
- "http://www.sgi.com/tech/stl/RandomAccessIterator.html">RandomAccessIterator</a>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code>operator=</code>,
- <code><a href="#classboost_1_1circular__buffer_19ba4a81df16f386d31b04b49c82d1ada">assign(size_type,
- const_reference)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer_1dbebb80a5f38e52a37ec9f3ed765600a">assign(capacity_type, size_type,
- const_reference)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer_1253302d9bda5d7efbc4a6c311de3790c">assign(InputIterator,
- InputIterator)</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_1270ab7074c365663a6f18808024fd88b" name=
- "classboost_1_1circular__buffer_1270ab7074c365663a6f18808024fd88b"></a><code><b>void
- swap(circular_buffer<T,Alloc>& cb);</b></code><br>
- <br>
- Swap the contents of two <code>circular_buffer</code>s.
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- <code>this</code> contains elements of <code>cb</code> and vice versa; the capacity of
- <code>this</code> equals to the capacity of <code>cb</code> and vice versa.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>cb</code>
- </dt>
- <dd>
- The <code>circular_buffer</code> whose content will be swapped.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- Nothing.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- No-throw.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Invalidates all iterators of both <code>circular_buffer</code>s. (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.)
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Constant (in the size of the <code>circular_buffer</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href="#namespaceboost_14aa8f6a2c9640f3f22e266f0fca85777">swap(circular_buffer<T,
- Alloc>&, circular_buffer<T, Alloc>&)</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_1aa35dd7ef8eb1d04508494d1835cc82e" name=
- "classboost_1_1circular__buffer_1aa35dd7ef8eb1d04508494d1835cc82e"></a><code><b>void push_back(<a href=
- "#classboost_1_1circular__buffer_1a8397191092f5bacee991b623ca4b910">const_reference</a> item =
- value_type());</b></code><br>
- <br>
- Insert a new element at the end of the <code>circular_buffer</code>.
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- if <code>capacity()
- > 0</code> then <code><a href=
- "#classboost_1_1circular__buffer_1d985d974020f88bb4255d8edbae0a30a">back()</a> == item</code><br>
- If the <code>circular_buffer</code> is full, the first element will be removed. If the capacity is
- <code>0</code>, nothing will be inserted.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>item</code>
- </dt>
- <dd>
- The element to be inserted.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- Whatever <code>T::T(const T&)</code> throws.
- </dd>
- <dd>
- Whatever <code>T::operator = (const T&)</code> throws.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- Basic; no-throw if the operation in the <i>Throws</i> section does not throw anything.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Does not invalidate any iterators with the exception of iterators pointing to the overwritten element.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Constant (in the size of the <code>circular_buffer</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href=
- "#classboost_1_1circular__buffer_10ef57e73c193682a649d8eb4a1096dce">push_front(const_reference)</a></code>,
- <code><a href=
- "#classboost_1_1circular__buffer_1df0da00cb501bea75afbbfab9f546a07">pop_back()</a></code>,
- <code><a href=
- "#classboost_1_1circular__buffer_18ac972dc24ef7236faa1875de92b9dd8">pop_front()</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_10ef57e73c193682a649d8eb4a1096dce" name=
- "classboost_1_1circular__buffer_10ef57e73c193682a649d8eb4a1096dce"></a><code><b>void push_front(<a href=
- "#classboost_1_1circular__buffer_1a8397191092f5bacee991b623ca4b910">const_reference</a> item =
- value_type());</b></code><br>
- <br>
- Insert a new element at the beginning of the <code>circular_buffer</code>.
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- if <code>capacity()
- > 0</code> then <code><a href=
- "#classboost_1_1circular__buffer_10d5fdeabeb352f47d1f7bb1ea8d9819f">front()</a> == item</code><br>
- If the <code>circular_buffer</code> is full, the last element will be removed. If the capacity is
- <code>0</code>, nothing will be inserted.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>item</code>
- </dt>
- <dd>
- The element to be inserted.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- Whatever <code>T::T(const T&)</code> throws.
- </dd>
- <dd>
- Whatever <code>T::operator = (const T&)</code> throws.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- Basic; no-throw if the operation in the <i>Throws</i> section does not throw anything.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Does not invalidate any iterators with the exception of iterators pointing to the overwritten element.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Constant (in the size of the <code>circular_buffer</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href=
- "#classboost_1_1circular__buffer_1aa35dd7ef8eb1d04508494d1835cc82e">push_back(const_reference)</a></code>,
- <code><a href=
- "#classboost_1_1circular__buffer_1df0da00cb501bea75afbbfab9f546a07">pop_back()</a></code>,
- <code><a href=
- "#classboost_1_1circular__buffer_18ac972dc24ef7236faa1875de92b9dd8">pop_front()</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_1df0da00cb501bea75afbbfab9f546a07" name=
- "classboost_1_1circular__buffer_1df0da00cb501bea75afbbfab9f546a07"></a><code><b>void
- pop_back();</b></code><br>
- <br>
- Remove the last element from the <code>circular_buffer</code>.
- <dl>
- <dt>
- <b>Precondition:</b>
- </dt>
- <dd>
- <code>!empty()</code>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- The last element is removed from the <code>circular_buffer</code>.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- Nothing.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- No-throw.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Invalidates only iterators pointing to the removed element.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Constant (in the size of the <code>circular_buffer</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href=
- "#classboost_1_1circular__buffer_18ac972dc24ef7236faa1875de92b9dd8">pop_front()</a></code>,
- <code><a href=
- "#classboost_1_1circular__buffer_1aa35dd7ef8eb1d04508494d1835cc82e">push_back(const_reference)</a></code>,
- <code><a href=
- "#classboost_1_1circular__buffer_10ef57e73c193682a649d8eb4a1096dce">push_front(const_reference)</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_18ac972dc24ef7236faa1875de92b9dd8" name=
- "classboost_1_1circular__buffer_18ac972dc24ef7236faa1875de92b9dd8"></a><code><b>void
- pop_front();</b></code><br>
- <br>
- Remove the first element from the <code>circular_buffer</code>.
- <dl>
- <dt>
- <b>Precondition:</b>
- </dt>
- <dd>
- <code>!empty()</code>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- The first element is removed from the <code>circular_buffer</code>.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- Nothing.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- No-throw.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Invalidates only iterators pointing to the removed element.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Constant (in the size of the <code>circular_buffer</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href=
- "#classboost_1_1circular__buffer_1df0da00cb501bea75afbbfab9f546a07">pop_back()</a></code>,
- <code><a href=
- "#classboost_1_1circular__buffer_1aa35dd7ef8eb1d04508494d1835cc82e">push_back(const_reference)</a></code>,
- <code><a href=
- "#classboost_1_1circular__buffer_10ef57e73c193682a649d8eb4a1096dce">push_front(const_reference)</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_128c92740fee1b9deb8c69816e389de95" name=
- "classboost_1_1circular__buffer_128c92740fee1b9deb8c69816e389de95"></a><code><b><a href=
- "#classboost_1_1circular__buffer_11b8a33f2dc8519b8a7d344ed4408c532">iterator</a> insert(<a href=
- "#classboost_1_1circular__buffer_11b8a33f2dc8519b8a7d344ed4408c532">iterator</a> pos, <a href=
- "#classboost_1_1circular__buffer_1a8397191092f5bacee991b623ca4b910">const_reference</a> item =
- value_type());</b></code><br>
- <br>
- Insert an element at the specified position.
- <dl>
- <dt>
- <b>Precondition:</b>
- </dt>
- <dd>
- <code>pos</code> is a valid iterator pointing to the <code>circular_buffer</code> or its end.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- The <code>item</code> will be inserted at the position <code>pos</code>.<br>
- If the <code>circular_buffer</code> is full, the first element will be overwritten. If the
- <code>circular_buffer</code> is full and the <code>pos</code> points to <code><a href=
- "#classboost_1_1circular__buffer_158d1ede2e85f5d46eda8db3f0c4efef0">begin()</a></code>, then the
- <code>item</code> will not be inserted. If the capacity is <code>0</code>, nothing will be inserted.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>pos</code>
- </dt>
- <dd>
- An iterator specifying the position where the <code>item</code> will be inserted.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>item</code>
- </dt>
- <dd>
- The element to be inserted.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Returns:</b>
- </dt>
- <dd>
- Iterator to the inserted element or <code><a href=
- "#classboost_1_1circular__buffer_158d1ede2e85f5d46eda8db3f0c4efef0">begin()</a></code> if the
- <code>item</code> is not inserted. (See the <i>Effect</i>.)
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- Whatever <code>T::T(const T&)</code> throws.
- </dd>
- <dd>
- Whatever <code>T::operator = (const T&)</code> throws.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- Basic; no-throw if the operation in the <i>Throws</i> section does not throw anything.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Invalidates iterators pointing to the elements at the insertion point (including <code>pos</code>) and
- iterators behind the insertion point (towards the end; except iterators equal to <code><a href=
- "#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a></code>). It also
- invalidates iterators pointing to the overwritten element.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Linear (in <code>std::distance(pos, <a href=
- "#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a>)</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href="#classboost_1_1circular__buffer_1b2f197c99d47138db777f0a46783b140">insert(iterator,
- size_type, value_type)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer_1d00091d1d794cab3264b3674e99b33f6">insert(iterator, InputIterator,
- InputIterator)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer_12c9332f457bf5bb3128463cf528c058c">rinsert(iterator,
- value_type)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer_1a47a5358db1b7d7e4925c16db13d2fc5">rinsert(iterator, size_type,
- value_type)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer_1d6479cbc43a304bdbf04262f957fa323">rinsert(iterator, InputIterator,
- InputIterator)</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_1b2f197c99d47138db777f0a46783b140" name=
- "classboost_1_1circular__buffer_1b2f197c99d47138db777f0a46783b140"></a><code><b>void insert(<a href=
- "#classboost_1_1circular__buffer_11b8a33f2dc8519b8a7d344ed4408c532">iterator</a> pos, <a href=
- "#classboost_1_1circular__buffer_19ba12c0142a21a7d960877c22fa3ea00">size_type</a> n, <a href=
- "#classboost_1_1circular__buffer_1a8397191092f5bacee991b623ca4b910">const_reference</a>
- item);</b></code><br>
- <br>
- Insert <code>n</code> copies of the <code>item</code> at the specified position.
- <dl>
- <dt>
- <b>Precondition:</b>
- </dt>
- <dd>
- <code>pos</code> is a valid iterator pointing to the <code>circular_buffer</code> or its end.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- The number of <code>min[n, (pos - <a href=
- "#classboost_1_1circular__buffer_158d1ede2e85f5d46eda8db3f0c4efef0">begin()</a>) + <a href=
- "#classboost_1_1circular__buffer_10a02c4fbc53385e98569e810be9843de">reserve()</a>]</code> elements will
- be inserted at the position <code>pos</code>.<br>
- The number of <code>min[pos - <a href=
- "#classboost_1_1circular__buffer_158d1ede2e85f5d46eda8db3f0c4efef0">begin()</a>, max[0, n - <a href=
- "#classboost_1_1circular__buffer_10a02c4fbc53385e98569e810be9843de">reserve()</a>]]</code> elements
- will be overwritten at the beginning of the <code>circular_buffer</code>.<br>
- (See <i>Example</i> for the explanation.)
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>pos</code>
- </dt>
- <dd>
- An iterator specifying the position where the <code>item</code>s will be inserted.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>n</code>
- </dt>
- <dd>
- The number of <code>item</code>s the to be inserted.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>item</code>
- </dt>
- <dd>
- The element whose copies will be inserted.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- Whatever <code>T::T(const T&)</code> throws.
- </dd>
- <dd>
- Whatever <code>T::operator = (const T&)</code> throws.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- Basic; no-throw if the operations in the <i>Throws</i> section do not throw anything.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Invalidates iterators pointing to the elements at the insertion point (including <code>pos</code>) and
- iterators behind the insertion point (towards the end; except iterators equal to <code><a href=
- "#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a></code>). It also
- invalidates iterators pointing to the overwritten elements.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Linear (in <code>min[<a href=
- "#classboost_1_1circular__buffer_15ebab2b2538d733790b5752582728e77">capacity()</a>, std::distance(pos,
- end()) + n]</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Example:</b>
- </dt>
- <dd>
- Consider a <code>circular_buffer</code> with the capacity of 6 and the size of 4. Its internal buffer
- may look like the one below.<br>
- <br>
- <code>|1|2|3|4| | |</code><br>
- <code>p ---^</code><br>
- <br>
- After inserting 5 elements at the position <code>p</code>:<br>
- <br>
- <code>insert(p, (size_t)5, 0);</code><br>
- <br>
- actually only 4 elements get inserted and elements <code>1</code> and <code>2</code> are overwritten.
- This is due to the fact the insert operation preserves the capacity. After insertion the internal
- buffer looks like this:<br>
- <br>
- <code>|0|0|0|0|3|4|</code><br>
- <br>
- For comparison if the capacity would not be preserved the internal buffer would then result in
- <code>|1|2|0|0|0|0|0|3|4|</code>.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href="#classboost_1_1circular__buffer_128c92740fee1b9deb8c69816e389de95">insert(iterator,
- value_type)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer_1d00091d1d794cab3264b3674e99b33f6">insert(iterator, InputIterator,
- InputIterator)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer_12c9332f457bf5bb3128463cf528c058c">rinsert(iterator,
- value_type)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer_1a47a5358db1b7d7e4925c16db13d2fc5">rinsert(iterator, size_type,
- value_type)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer_1d6479cbc43a304bdbf04262f957fa323">rinsert(iterator, InputIterator,
- InputIterator)</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_1d00091d1d794cab3264b3674e99b33f6" name=
- "classboost_1_1circular__buffer_1d00091d1d794cab3264b3674e99b33f6"></a> <code><b>template <class
- InputIterator><br>
- void insert(iterator
- pos, InputIterator first, InputIterator last);</b></code><br>
- <br>
- Insert the range <code>[first, last)</code> at the specified position.
- <dl>
- <dt>
- <b>Precondition:</b>
- </dt>
- <dd>
- <code>pos</code> is a valid iterator pointing to the <code>circular_buffer</code> or its end.<br>
- Valid range <code>[first, last)</code> where <code>first</code> and <code>last</code> meet the
- requirements of an InputIterator.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- Elements from the range <code>[first + max[0, distance(first, last) - (pos - <a href=
- "#classboost_1_1circular__buffer_158d1ede2e85f5d46eda8db3f0c4efef0">begin()</a>) - <a href=
- "#classboost_1_1circular__buffer_10a02c4fbc53385e98569e810be9843de">reserve()</a>], last)</code> will
- be inserted at the position <code>pos</code>.<br>
- The number of <code>min[pos - <a href=
- "#classboost_1_1circular__buffer_158d1ede2e85f5d46eda8db3f0c4efef0">begin()</a>, max[0, distance(first,
- last) - <a href=
- "#classboost_1_1circular__buffer_10a02c4fbc53385e98569e810be9843de">reserve()</a>]]</code> elements
- will be overwritten at the beginning of the <code>circular_buffer</code>.<br>
- (See <i>Example</i> for the explanation.)
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>pos</code>
- </dt>
- <dd>
- An iterator specifying the position where the range will be inserted.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>first</code>
- </dt>
- <dd>
- The beginning of the range to be inserted.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>last</code>
- </dt>
- <dd>
- The end of the range to be inserted.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- Whatever <code>T::T(const T&)</code> throws.
- </dd>
- <dd>
- Whatever <code>T::operator = (const T&)</code> throws.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- Basic; no-throw if the operations in the <i>Throws</i> section do not throw anything.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Invalidates iterators pointing to the elements at the insertion point (including <code>pos</code>) and
- iterators behind the insertion point (towards the end; except iterators equal to <code><a href=
- "#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a></code>). It also
- invalidates iterators pointing to the overwritten elements.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Linear (in <code>[std::distance(pos, <a href=
- "#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a>) + std::distance(first,
- last)]</code>; in <code>min[<a href=
- "#classboost_1_1circular__buffer_15ebab2b2538d733790b5752582728e77">capacity()</a>, std::distance(pos,
- end()) +
- std::distance(first, last)]</code> if the <code>InputIterator</code> is a <a href=
- "http://www.sgi.com/tech/stl/RandomAccessIterator.html">RandomAccessIterator</a>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Example:</b>
- </dt>
- <dd>
- Consider a <code>circular_buffer</code> with the capacity of 6 and the size of 4. Its internal buffer
- may look like the one below.<br>
- <br>
- <code>|1|2|3|4| | |</code><br>
- <code>p ---^</code><br>
- <br>
- After inserting a range of elements at the position <code>p</code>:<br>
- <br>
- <code>int array[] = { 5, 6, 7, 8, 9 };</code><br>
- <code>insert(p, array, array + 5);</code><br>
- <br>
- actually only elements <code>6</code>, <code>7</code>, <code>8</code> and <code>9</code> from the
- specified range get inserted and elements <code>1</code> and <code>2</code> are overwritten. This is
- due to the fact the insert operation preserves the capacity. After insertion the internal buffer looks
- like this:<br>
- <br>
- <code>|6|7|8|9|3|4|</code><br>
- <br>
- For comparison if the capacity would not be preserved the internal buffer would then result in
- <code>|1|2|5|6|7|8|9|3|4|</code>.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href="#classboost_1_1circular__buffer_128c92740fee1b9deb8c69816e389de95">insert(iterator,
- value_type)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer_1b2f197c99d47138db777f0a46783b140">insert(iterator, size_type,
- value_type)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer_12c9332f457bf5bb3128463cf528c058c">rinsert(iterator,
- value_type)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer_1a47a5358db1b7d7e4925c16db13d2fc5">rinsert(iterator, size_type,
- value_type)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer_1d6479cbc43a304bdbf04262f957fa323">rinsert(iterator, InputIterator,
- InputIterator)</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_12c9332f457bf5bb3128463cf528c058c" name=
- "classboost_1_1circular__buffer_12c9332f457bf5bb3128463cf528c058c"></a><code><b><a href=
- "#classboost_1_1circular__buffer_11b8a33f2dc8519b8a7d344ed4408c532">iterator</a> rinsert(<a href=
- "#classboost_1_1circular__buffer_11b8a33f2dc8519b8a7d344ed4408c532">iterator</a> pos, <a href=
- "#classboost_1_1circular__buffer_1a8397191092f5bacee991b623ca4b910">const_reference</a> item =
- value_type());</b></code><br>
- <br>
- Insert an element before the specified position.
- <dl>
- <dt>
- <b>Precondition:</b>
- </dt>
- <dd>
- <code>pos</code> is a valid iterator pointing to the <code>circular_buffer</code> or its end.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- The <code>item</code> will be inserted before the position <code>pos</code>.<br>
- If the <code>circular_buffer</code> is full, the last element will be overwritten. If the
- <code>circular_buffer</code> is full and the <code>pos</code> points to <code><a href=
- "#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a></code>, then the
- <code>item</code> will not be inserted. If the capacity is <code>0</code>, nothing will be inserted.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>pos</code>
- </dt>
- <dd>
- An iterator specifying the position before which the <code>item</code> will be inserted.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>item</code>
- </dt>
- <dd>
- The element to be inserted.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Returns:</b>
- </dt>
- <dd>
- Iterator to the inserted element or <code><a href=
- "#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a></code> if the
- <code>item</code> is not inserted. (See the <i>Effect</i>.)
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- Whatever <code>T::T(const T&)</code> throws.
- </dd>
- <dd>
- Whatever <code>T::operator = (const T&)</code> throws.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- Basic; no-throw if the operations in the <i>Throws</i> section do not throw anything.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Invalidates iterators pointing to the elements before the insertion point (towards the beginning and
- excluding <code>pos</code>). It also invalidates iterators pointing to the overwritten element.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Linear (in <code>std::distance(<a href=
- "#classboost_1_1circular__buffer_158d1ede2e85f5d46eda8db3f0c4efef0">begin()</a>, pos)</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href="#classboost_1_1circular__buffer_1a47a5358db1b7d7e4925c16db13d2fc5">rinsert(iterator,
- size_type, value_type)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer_1d6479cbc43a304bdbf04262f957fa323">rinsert(iterator, InputIterator,
- InputIterator)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer_128c92740fee1b9deb8c69816e389de95">insert(iterator,
- value_type)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer_1b2f197c99d47138db777f0a46783b140">insert(iterator, size_type,
- value_type)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer_1d00091d1d794cab3264b3674e99b33f6">insert(iterator, InputIterator,
- InputIterator)</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_1a47a5358db1b7d7e4925c16db13d2fc5" name=
- "classboost_1_1circular__buffer_1a47a5358db1b7d7e4925c16db13d2fc5"></a><code><b>void rinsert(<a href=
- "#classboost_1_1circular__buffer_11b8a33f2dc8519b8a7d344ed4408c532">iterator</a> pos, <a href=
- "#classboost_1_1circular__buffer_19ba12c0142a21a7d960877c22fa3ea00">size_type</a> n, <a href=
- "#classboost_1_1circular__buffer_1a8397191092f5bacee991b623ca4b910">const_reference</a>
- item);</b></code><br>
- <br>
- Insert <code>n</code> copies of the <code>item</code> before the specified position.
- <dl>
- <dt>
- <b>Precondition:</b>
- </dt>
- <dd>
- <code>pos</code> is a valid iterator pointing to the <code>circular_buffer</code> or its end.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- The number of <code>min[n, (<a href=
- "#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a> - pos) + <a href=
- "#classboost_1_1circular__buffer_10a02c4fbc53385e98569e810be9843de">reserve()</a>]</code> elements will
- be inserted before the position <code>pos</code>.<br>
- The number of <code>min[<a href=
- "#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a> - pos, max[0, n -
- reserve()]]</code>
- elements will be overwritten at the end of the <code>circular_buffer</code>.<br>
- (See <i>Example</i> for the explanation.)
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>pos</code>
- </dt>
- <dd>
- An iterator specifying the position where the <code>item</code>s will be inserted.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>n</code>
- </dt>
- <dd>
- The number of <code>item</code>s the to be inserted.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>item</code>
- </dt>
- <dd>
- The element whose copies will be inserted.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- Whatever <code>T::T(const T&)</code> throws.
- </dd>
- <dd>
- Whatever <code>T::operator = (const T&)</code> throws.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- Basic; no-throw if the operations in the <i>Throws</i> section do not throw anything.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Invalidates iterators pointing to the elements before the insertion point (towards the beginning and
- excluding <code>pos</code>). It also invalidates iterators pointing to the overwritten elements.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Linear (in <code>min[<a href=
- "#classboost_1_1circular__buffer_15ebab2b2538d733790b5752582728e77">capacity()</a>,
- std::distance(begin(),
- pos) + n]</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Example:</b>
- </dt>
- <dd>
- Consider a <code>circular_buffer</code> with the capacity of 6 and the size of 4. Its internal buffer
- may look like the one below.<br>
- <br>
- <code>|1|2|3|4| | |</code><br>
- <code>p ---^</code><br>
- <br>
- After inserting 5 elements before the position <code>p</code>:<br>
- <br>
- <code>rinsert(p, (size_t)5, 0);</code><br>
- <br>
- actually only 4 elements get inserted and elements <code>3</code> and <code>4</code> are overwritten.
- This is due to the fact the rinsert operation preserves the capacity. After insertion the internal
- buffer looks like this:<br>
- <br>
- <code>|1|2|0|0|0|0|</code><br>
- <br>
- For comparison if the capacity would not be preserved the internal buffer would then result in
- <code>|1|2|0|0|0|0|0|3|4|</code>.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href="#classboost_1_1circular__buffer_12c9332f457bf5bb3128463cf528c058c">rinsert(iterator,
- value_type)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer_1d6479cbc43a304bdbf04262f957fa323">rinsert(iterator, InputIterator,
- InputIterator)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer_128c92740fee1b9deb8c69816e389de95">insert(iterator,
- value_type)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer_1b2f197c99d47138db777f0a46783b140">insert(iterator, size_type,
- value_type)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer_1d00091d1d794cab3264b3674e99b33f6">insert(iterator, InputIterator,
- InputIterator)</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_1d6479cbc43a304bdbf04262f957fa323" name=
- "classboost_1_1circular__buffer_1d6479cbc43a304bdbf04262f957fa323"></a> <code><b>template <class
- InputIterator><br>
- void rinsert(iterator
- pos, InputIterator first, InputIterator last);</b></code><br>
- <br>
- Insert the range <code>[first, last)</code> before the specified position.
- <dl>
- <dt>
- <b>Precondition:</b>
- </dt>
- <dd>
- <code>pos</code> is a valid iterator pointing to the <code>circular_buffer</code> or its end.<br>
- Valid range <code>[first, last)</code> where <code>first</code> and <code>last</code> meet the
- requirements of an InputIterator.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- Elements from the range <code>[first, last - max[0, distance(first, last) - (<a href=
- "#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a> - pos) - <a href=
- "#classboost_1_1circular__buffer_10a02c4fbc53385e98569e810be9843de">reserve()</a>])</code> will be
- inserted before the position <code>pos</code>.<br>
- The number of <code>min[<a href=
- "#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a> - pos, max[0,
- distance(first, last) - <a href=
- "#classboost_1_1circular__buffer_10a02c4fbc53385e98569e810be9843de">reserve()</a>]]</code> elements
- will be overwritten at the end of the <code>circular_buffer</code>.<br>
- (See <i>Example</i> for the explanation.)
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>pos</code>
- </dt>
- <dd>
- An iterator specifying the position where the range will be inserted.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>first</code>
- </dt>
- <dd>
- The beginning of the range to be inserted.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>last</code>
- </dt>
- <dd>
- The end of the range to be inserted.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- Whatever <code>T::T(const T&)</code> throws.
- </dd>
- <dd>
- Whatever <code>T::operator = (const T&)</code> throws.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- Basic; no-throw if the operations in the <i>Throws</i> section do not throw anything.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Invalidates iterators pointing to the elements before the insertion point (towards the beginning and
- excluding <code>pos</code>). It also invalidates iterators pointing to the overwritten elements.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Linear (in <code>[std::distance(<a href=
- "#classboost_1_1circular__buffer_158d1ede2e85f5d46eda8db3f0c4efef0">begin()</a>, pos) +
- std::distance(first, last)]</code>; in <code>min[<a href=
- "#classboost_1_1circular__buffer_15ebab2b2538d733790b5752582728e77">capacity()</a>,
- std::distance(begin(),
- pos) + std::distance(first, last)]</code> if the <code>InputIterator</code> is a <a href=
- "http://www.sgi.com/tech/stl/RandomAccessIterator.html">RandomAccessIterator</a>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Example:</b>
- </dt>
- <dd>
- Consider a <code>circular_buffer</code> with the capacity of 6 and the size of 4. Its internal buffer
- may look like the one below.<br>
- <br>
- <code>|1|2|3|4| | |</code><br>
- <code>p ---^</code><br>
- <br>
- After inserting a range of elements before the position <code>p</code>:<br>
- <br>
- <code>int array[] = { 5, 6, 7, 8, 9 };</code><br>
- <code>insert(p, array, array + 5);</code><br>
- <br>
- actually only elements <code>5</code>, <code>6</code>, <code>7</code> and <code>8</code> from the
- specified range get inserted and elements <code>3</code> and <code>4</code> are overwritten. This is
- due to the fact the rinsert operation preserves the capacity. After insertion the internal buffer looks
- like this:<br>
- <br>
- <code>|1|2|5|6|7|8|</code><br>
- <br>
- For comparison if the capacity would not be preserved the internal buffer would then result in
- <code>|1|2|5|6|7|8|9|3|4|</code>.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href="#classboost_1_1circular__buffer_12c9332f457bf5bb3128463cf528c058c">rinsert(iterator,
- value_type)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer_1a47a5358db1b7d7e4925c16db13d2fc5">rinsert(iterator, size_type,
- value_type)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer_128c92740fee1b9deb8c69816e389de95">insert(iterator,
- value_type)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer_1b2f197c99d47138db777f0a46783b140">insert(iterator, size_type,
- value_type)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer_1d00091d1d794cab3264b3674e99b33f6">insert(iterator, InputIterator,
- InputIterator)</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_197155de712db1759e1698455b49a0be3" name=
- "classboost_1_1circular__buffer_197155de712db1759e1698455b49a0be3"></a><code><b><a href=
- "#classboost_1_1circular__buffer_11b8a33f2dc8519b8a7d344ed4408c532">iterator</a> erase(<a href=
- "#classboost_1_1circular__buffer_11b8a33f2dc8519b8a7d344ed4408c532">iterator</a> pos);</b></code><br>
- <br>
- Remove an element at the specified position.
- <dl>
- <dt>
- <b>Precondition:</b>
- </dt>
- <dd>
- <code>pos</code> is a valid iterator pointing to the <code>circular_buffer</code> (but not an
- <code>end()</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- The element at the position <code>pos</code> is removed.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>pos</code>
- </dt>
- <dd>
- An iterator pointing at the element to be removed.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Returns:</b>
- </dt>
- <dd>
- Iterator to the first element remaining beyond the removed element or <code><a href=
- "#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a></code> if no such element
- exists.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- Whatever <code>T::operator = (const T&)</code> throws.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- Basic; no-throw if the operation in the <i>Throws</i> section does not throw anything.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Invalidates iterators pointing to the erased element and iterators pointing to the elements behind the
- erased element (towards the end; except iterators equal to <code><a href=
- "#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a></code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Linear (in <code>std::distance(pos, <a href=
- "#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a>)</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href="#classboost_1_1circular__buffer_1a96415389509a18bd7d7b5d8e4dda9bd">erase(iterator,
- iterator)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer_1b6d4ae77d7445f844e30e78592f1e06f">rerase(iterator)</a></code>,
- <code><a href="#classboost_1_1circular__buffer_1b0f98ae303584ded5397f067bbfc911f">rerase(iterator,
- iterator)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer_1b25d379cf66ace025036a47ddb344abd">erase_begin(size_type)</a></code>,
- <code><a href=
- "#classboost_1_1circular__buffer_17485ee7f58b01363170114f2123a48d7">erase_end(size_type)</a></code>,
- <code>clear()</code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_1a96415389509a18bd7d7b5d8e4dda9bd" name=
- "classboost_1_1circular__buffer_1a96415389509a18bd7d7b5d8e4dda9bd"></a><code><b><a href=
- "#classboost_1_1circular__buffer_11b8a33f2dc8519b8a7d344ed4408c532">iterator</a> erase(<a href=
- "#classboost_1_1circular__buffer_11b8a33f2dc8519b8a7d344ed4408c532">iterator</a> first, <a href=
- "#classboost_1_1circular__buffer_11b8a33f2dc8519b8a7d344ed4408c532">iterator</a> last);</b></code><br>
- <br>
- Erase the range <code>[first, last)</code>.
- <dl>
- <dt>
- <b>Precondition:</b>
- </dt>
- <dd>
- Valid range <code>[first, last)</code>.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- The elements from the range <code>[first, last)</code> are removed. (If <code>first == last</code>
- nothing is removed.)
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>first</code>
- </dt>
- <dd>
- The beginning of the range to be removed.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>last</code>
- </dt>
- <dd>
- The end of the range to be removed.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Returns:</b>
- </dt>
- <dd>
- Iterator to the first element remaining beyond the removed elements or <code><a href=
- "#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a></code> if no such element
- exists.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- Whatever <code>T::operator = (const T&)</code> throws.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- Basic; no-throw if the operation in the <i>Throws</i> section does not throw anything.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Invalidates iterators pointing to the erased elements and iterators pointing to the elements behind the
- erased range (towards the end; except iterators equal to <code><a href=
- "#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a></code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Linear (in <code>std::distance(first, <a href=
- "#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a>)</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href=
- "#classboost_1_1circular__buffer_197155de712db1759e1698455b49a0be3">erase(iterator)</a></code>,
- <code><a href=
- "#classboost_1_1circular__buffer_1b6d4ae77d7445f844e30e78592f1e06f">rerase(iterator)</a></code>,
- <code><a href="#classboost_1_1circular__buffer_1b0f98ae303584ded5397f067bbfc911f">rerase(iterator,
- iterator)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer_1b25d379cf66ace025036a47ddb344abd">erase_begin(size_type)</a></code>,
- <code><a href=
- "#classboost_1_1circular__buffer_17485ee7f58b01363170114f2123a48d7">erase_end(size_type)</a></code>,
- <code>clear()</code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_1b6d4ae77d7445f844e30e78592f1e06f" name=
- "classboost_1_1circular__buffer_1b6d4ae77d7445f844e30e78592f1e06f"></a><code><b><a href=
- "#classboost_1_1circular__buffer_11b8a33f2dc8519b8a7d344ed4408c532">iterator</a> rerase(<a href=
- "#classboost_1_1circular__buffer_11b8a33f2dc8519b8a7d344ed4408c532">iterator</a> pos);</b></code><br>
- <br>
- Remove an element at the specified position.
- <dl>
- <dt>
- <b>Precondition:</b>
- </dt>
- <dd>
- <code>pos</code> is a valid iterator pointing to the <code>circular_buffer</code> (but not an
- <code>end()</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- The element at the position <code>pos</code> is removed.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>pos</code>
- </dt>
- <dd>
- An iterator pointing at the element to be removed.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Returns:</b>
- </dt>
- <dd>
- Iterator to the first element remaining in front of the removed element or <code><a href=
- "#classboost_1_1circular__buffer_158d1ede2e85f5d46eda8db3f0c4efef0">begin()</a></code> if no such
- element exists.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- Whatever <code>T::operator = (const T&)</code> throws.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- Basic; no-throw if the operation in the <i>Throws</i> section does not throw anything.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Invalidates iterators pointing to the erased element and iterators pointing to the elements in front of
- the erased element (towards the beginning).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Linear (in <code>std::distance(<a href=
- "#classboost_1_1circular__buffer_158d1ede2e85f5d46eda8db3f0c4efef0">begin()</a>, pos)</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Note:</b>
- </dt>
- <dd>
- This method is symetric to the <code><a href=
- "#classboost_1_1circular__buffer_197155de712db1759e1698455b49a0be3">erase(iterator)</a></code> method
- and is more effective than <code><a href=
- "#classboost_1_1circular__buffer_197155de712db1759e1698455b49a0be3">erase(iterator)</a></code> if the
- iterator <code>pos</code> is close to the beginning of the <code>circular_buffer</code>. (See the
- <i>Complexity</i>.)
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href=
- "#classboost_1_1circular__buffer_197155de712db1759e1698455b49a0be3">erase(iterator)</a></code>,
- <code><a href="#classboost_1_1circular__buffer_1a96415389509a18bd7d7b5d8e4dda9bd">erase(iterator,
- iterator)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer_1b0f98ae303584ded5397f067bbfc911f">rerase(iterator,
- iterator)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer_1b25d379cf66ace025036a47ddb344abd">erase_begin(size_type)</a></code>,
- <code><a href=
- "#classboost_1_1circular__buffer_17485ee7f58b01363170114f2123a48d7">erase_end(size_type)</a></code>,
- <code>clear()</code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_1b0f98ae303584ded5397f067bbfc911f" name=
- "classboost_1_1circular__buffer_1b0f98ae303584ded5397f067bbfc911f"></a><code><b><a href=
- "#classboost_1_1circular__buffer_11b8a33f2dc8519b8a7d344ed4408c532">iterator</a> rerase(<a href=
- "#classboost_1_1circular__buffer_11b8a33f2dc8519b8a7d344ed4408c532">iterator</a> first, <a href=
- "#classboost_1_1circular__buffer_11b8a33f2dc8519b8a7d344ed4408c532">iterator</a> last);</b></code><br>
- <br>
- Erase the range <code>[first, last)</code>.
- <dl>
- <dt>
- <b>Precondition:</b>
- </dt>
- <dd>
- Valid range <code>[first, last)</code>.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- The elements from the range <code>[first, last)</code> are removed. (If <code>first == last</code>
- nothing is removed.)
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>first</code>
- </dt>
- <dd>
- The beginning of the range to be removed.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>last</code>
- </dt>
- <dd>
- The end of the range to be removed.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Returns:</b>
- </dt>
- <dd>
- Iterator to the first element remaining in front of the removed elements or <code><a href=
- "#classboost_1_1circular__buffer_158d1ede2e85f5d46eda8db3f0c4efef0">begin()</a></code> if no such
- element exists.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- Whatever <code>T::operator = (const T&)</code> throws.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- Basic; no-throw if the operation in the <i>Throws</i> section does not throw anything.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Invalidates iterators pointing to the erased elements and iterators pointing to the elements in front
- of the erased range (towards the beginning).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Linear (in <code>std::distance(<a href=
- "#classboost_1_1circular__buffer_158d1ede2e85f5d46eda8db3f0c4efef0">begin()</a>, last)</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Note:</b>
- </dt>
- <dd>
- This method is symetric to the <code><a href=
- "#classboost_1_1circular__buffer_1a96415389509a18bd7d7b5d8e4dda9bd">erase(iterator,
- iterator)</a></code> method and is more effective than <code><a href=
- "#classboost_1_1circular__buffer_1a96415389509a18bd7d7b5d8e4dda9bd">erase(iterator,
- iterator)</a></code> if <code>std::distance(<a href=
- "#classboost_1_1circular__buffer_158d1ede2e85f5d46eda8db3f0c4efef0">begin()</a>, first)</code> is lower
- that <code>std::distance(last, <a href=
- "#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a>)</code>.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href=
- "#classboost_1_1circular__buffer_197155de712db1759e1698455b49a0be3">erase(iterator)</a></code>,
- <code><a href="#classboost_1_1circular__buffer_1a96415389509a18bd7d7b5d8e4dda9bd">erase(iterator,
- iterator)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer_1b6d4ae77d7445f844e30e78592f1e06f">rerase(iterator)</a></code>,
- <code><a href=
- "#classboost_1_1circular__buffer_1b25d379cf66ace025036a47ddb344abd">erase_begin(size_type)</a></code>,
- <code><a href=
- "#classboost_1_1circular__buffer_17485ee7f58b01363170114f2123a48d7">erase_end(size_type)</a></code>,
- <code>clear()</code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_1b25d379cf66ace025036a47ddb344abd" name=
- "classboost_1_1circular__buffer_1b25d379cf66ace025036a47ddb344abd"></a><code><b>void erase_begin(<a href=
- "#classboost_1_1circular__buffer_19ba12c0142a21a7d960877c22fa3ea00">size_type</a> n);</b></code><br>
- <br>
- Remove first <code>n</code> elements (with constant complexity for scalar types).
- <dl>
- <dt>
- <b>Precondition:</b>
- </dt>
- <dd>
- <code>n <= <a href=
- "#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a></code>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- The <code>n</code> elements at the beginning of the <code>circular_buffer</code> will be removed.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>n</code>
- </dt>
- <dd>
- The number of elements to be removed.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- Whatever <code>T::operator = (const T&)</code> throws. (Does not throw anything in case of
- scalars.)
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- Basic; no-throw if the operation in the <i>Throws</i> section does not throw anything. (I.e. no throw
- in case of scalars.)
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Invalidates iterators pointing to the first <code>n</code> erased elements.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Constant (in <code>n</code>) for scalar types; linear for other types.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Note:</b>
- </dt>
- <dd>
- 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 <code><a href=
- "#classboost_1_1circular__buffer_1b0f98ae303584ded5397f067bbfc911f">rerase(begin(), begin() +
- n)</a></code>.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href=
- "#classboost_1_1circular__buffer_197155de712db1759e1698455b49a0be3">erase(iterator)</a></code>,
- <code><a href="#classboost_1_1circular__buffer_1a96415389509a18bd7d7b5d8e4dda9bd">erase(iterator,
- iterator)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer_1b6d4ae77d7445f844e30e78592f1e06f">rerase(iterator)</a></code>,
- <code><a href="#classboost_1_1circular__buffer_1b0f98ae303584ded5397f067bbfc911f">rerase(iterator,
- iterator)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer_17485ee7f58b01363170114f2123a48d7">erase_end(size_type)</a></code>,
- <code>clear()</code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_17485ee7f58b01363170114f2123a48d7" name=
- "classboost_1_1circular__buffer_17485ee7f58b01363170114f2123a48d7"></a><code><b>void erase_end(<a href=
- "#classboost_1_1circular__buffer_19ba12c0142a21a7d960877c22fa3ea00">size_type</a> n);</b></code><br>
- <br>
- Remove last <code>n</code> elements (with constant complexity for scalar types).
- <dl>
- <dt>
- <b>Precondition:</b>
- </dt>
- <dd>
- <code>n <= <a href=
- "#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a></code>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- The <code>n</code> elements at the end of the <code>circular_buffer</code> will be removed.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>n</code>
- </dt>
- <dd>
- The number of elements to be removed.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- Whatever <code>T::operator = (const T&)</code> throws. (Does not throw anything in case of
- scalars.)
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- Basic; no-throw if the operation in the <i>Throws</i> section does not throw anything. (I.e. no throw
- in case of scalars.)
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Invalidates iterators pointing to the last <code>n</code> erased elements.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Constant (in <code>n</code>) for scalar types; linear for other types.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Note:</b>
- </dt>
- <dd>
- 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 <code><a href=
- "#classboost_1_1circular__buffer_1a96415389509a18bd7d7b5d8e4dda9bd">erase(end() - n, end())</a></code>.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href=
- "#classboost_1_1circular__buffer_197155de712db1759e1698455b49a0be3">erase(iterator)</a></code>,
- <code><a href="#classboost_1_1circular__buffer_1a96415389509a18bd7d7b5d8e4dda9bd">erase(iterator,
- iterator)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer_1b6d4ae77d7445f844e30e78592f1e06f">rerase(iterator)</a></code>,
- <code><a href="#classboost_1_1circular__buffer_1b0f98ae303584ded5397f067bbfc911f">rerase(iterator,
- iterator)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer_1b25d379cf66ace025036a47ddb344abd">erase_begin(size_type)</a></code>,
- <code>clear()</code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer_1826f5770a40b8b752eb9587378464d1e" name=
- "classboost_1_1circular__buffer_1826f5770a40b8b752eb9587378464d1e"></a><code><b>void
- clear();</b></code><br>
- <br>
- Remove all stored elements from the <code>circular_buffer</code>.
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- <code>size() ==
- 0</code>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- Nothing.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- No-throw.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Invalidates all iterators pointing to the <code>circular_buffer</code> (except iterators equal to
- <code>end()</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Constant (in the size of the <code>circular_buffer</code>) for scalar types; linear for other types.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href=
- "#classboost_1_1circular__buffer_164250ffbbbdbc62b99e8301fc195b80c">~circular_buffer()</a></code>,
- <code><a href=
- "#classboost_1_1circular__buffer_197155de712db1759e1698455b49a0be3">erase(iterator)</a></code>,
- <code><a href="#classboost_1_1circular__buffer_1a96415389509a18bd7d7b5d8e4dda9bd">erase(iterator,
- iterator)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer_1b6d4ae77d7445f844e30e78592f1e06f">rerase(iterator)</a></code>,
- <code><a href="#classboost_1_1circular__buffer_1b0f98ae303584ded5397f067bbfc911f">rerase(iterator,
- iterator)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer_1b25d379cf66ace025036a47ddb344abd">erase_begin(size_type)</a></code>,
- <code><a href=
- "#classboost_1_1circular__buffer_17485ee7f58b01363170114f2123a48d7">erase_end(size_type)</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- </table>
- </div>
- <h2>
- <a name="functions" id="functions">Standalone Functions</a>
- </h2>
- <div id="srcdoc_functions">
- <table id="table_functions" border="1" cellpadding="3">
- <tr>
- <td>
- <a id="namespaceboost_1d35871e838359b5215e1cbb353663207" name=
- "namespaceboost_1d35871e838359b5215e1cbb353663207"></a> <code><b>template <class T, class Alloc><br>
- bool operator==(const circular_buffer<T,Alloc>& lhs, const
- circular_buffer<T,Alloc>& rhs);</b></code><br>
- <br>
- Compare two <code>circular_buffer</code>s element-by-element to determine if they are equal.
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>lhs</code>
- </dt>
- <dd>
- The <code>circular_buffer</code> to compare.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>rhs</code>
- </dt>
- <dd>
- The <code>circular_buffer</code> to compare.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Returns:</b>
- </dt>
- <dd>
- <code>lhs.size() ==
- rhs.size() &&
- std::equal(lhs.<a href=
- "#classboost_1_1circular__buffer_158d1ede2e85f5d46eda8db3f0c4efef0">begin()</a>, lhs.<a href=
- "#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a>, rhs.<a href=
- "#classboost_1_1circular__buffer_158d1ede2e85f5d46eda8db3f0c4efef0">begin()</a>)</code>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- Nothing.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Linear (in the size of the <code>circular_buffer</code>s).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Does not invalidate any iterators.
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="namespaceboost_195b08213f201c2067d8acb024756329d" name=
- "namespaceboost_195b08213f201c2067d8acb024756329d"></a> <code><b>template <class T, class Alloc><br>
- bool operator<(const circular_buffer<T,Alloc>& lhs, const
- circular_buffer<T,Alloc>& rhs);</b></code><br>
- <br>
- Compare two <code>circular_buffer</code>s element-by-element to determine if the left one is lesser than
- the right one.
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>lhs</code>
- </dt>
- <dd>
- The <code>circular_buffer</code> to compare.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>rhs</code>
- </dt>
- <dd>
- The <code>circular_buffer</code> to compare.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Returns:</b>
- </dt>
- <dd>
- <code><a href=
- "http://www.sgi.com/tech/stl/lexicographical_compare.html">std::lexicographical_compare</a>(lhs.begin(),
- lhs.end(), rhs.<a href=
- "#classboost_1_1circular__buffer_158d1ede2e85f5d46eda8db3f0c4efef0">begin()</a>, rhs.<a href=
- "#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a>)</code>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- Nothing.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Linear (in the size of the <code>circular_buffer</code>s).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Does not invalidate any iterators.
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="namespaceboost_1f5717e2f6532581a6492ff1839b18f6d" name=
- "namespaceboost_1f5717e2f6532581a6492ff1839b18f6d"></a> <code><b>template <class T, class Alloc><br>
- bool operator!=(const circular_buffer<T,Alloc>& lhs, const
- circular_buffer<T,Alloc>& rhs);</b></code><br>
- <br>
- Compare two <code>circular_buffer</code>s element-by-element to determine if they are non-equal.
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>lhs</code>
- </dt>
- <dd>
- The <code>circular_buffer</code> to compare.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>rhs</code>
- </dt>
- <dd>
- The <code>circular_buffer</code> to compare.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Returns:</b>
- </dt>
- <dd>
- <code>!(lhs == rhs)</code>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- Nothing.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Linear (in the size of the <code>circular_buffer</code>s).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Does not invalidate any iterators.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href="#namespaceboost_1d35871e838359b5215e1cbb353663207">operator==(const
- circular_buffer<T,Alloc>&, const circular_buffer<T,Alloc>&)</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="namespaceboost_1f575d7a9741c2044424de50c966c12f3" name=
- "namespaceboost_1f575d7a9741c2044424de50c966c12f3"></a> <code><b>template <class T, class Alloc><br>
- bool operator>(const circular_buffer<T,Alloc>& lhs, const
- circular_buffer<T,Alloc>& rhs);</b></code><br>
- <br>
- Compare two <code>circular_buffer</code>s element-by-element to determine if the left one is greater than
- the right one.
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>lhs</code>
- </dt>
- <dd>
- The <code>circular_buffer</code> to compare.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>rhs</code>
- </dt>
- <dd>
- The <code>circular_buffer</code> to compare.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Returns:</b>
- </dt>
- <dd>
- <code>rhs < lhs</code>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- Nothing.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Linear (in the size of the <code>circular_buffer</code>s).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Does not invalidate any iterators.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href="#namespaceboost_195b08213f201c2067d8acb024756329d">operator<(const
- circular_buffer<T,Alloc>&, const circular_buffer<T,Alloc>&)</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="namespaceboost_179abcbacd24b67f08185db54aec8600d" name=
- "namespaceboost_179abcbacd24b67f08185db54aec8600d"></a> <code><b>template <class T, class Alloc><br>
- bool operator<=(const circular_buffer<T,Alloc>& lhs, const
- circular_buffer<T,Alloc>& rhs);</b></code><br>
- <br>
- Compare two <code>circular_buffer</code>s element-by-element to determine if the left one is lesser or
- equal to the right one.
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>lhs</code>
- </dt>
- <dd>
- The <code>circular_buffer</code> to compare.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>rhs</code>
- </dt>
- <dd>
- The <code>circular_buffer</code> to compare.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Returns:</b>
- </dt>
- <dd>
- <code>!(rhs < lhs)</code>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- Nothing.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Linear (in the size of the <code>circular_buffer</code>s).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Does not invalidate any iterators.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href="#namespaceboost_195b08213f201c2067d8acb024756329d">operator<(const
- circular_buffer<T,Alloc>&, const circular_buffer<T,Alloc>&)</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="namespaceboost_11c31150380272af67deebef578c80b05" name=
- "namespaceboost_11c31150380272af67deebef578c80b05"></a> <code><b>template <class T, class Alloc><br>
- bool operator>=(const circular_buffer<T,Alloc>& lhs, const
- circular_buffer<T,Alloc>& rhs);</b></code><br>
- <br>
- Compare two <code>circular_buffer</code>s element-by-element to determine if the left one is greater or
- equal to the right one.
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>lhs</code>
- </dt>
- <dd>
- The <code>circular_buffer</code> to compare.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>rhs</code>
- </dt>
- <dd>
- The <code>circular_buffer</code> to compare.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Returns:</b>
- </dt>
- <dd>
- <code>!(lhs < rhs)</code>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- Nothing.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Linear (in the size of the <code>circular_buffer</code>s).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Does not invalidate any iterators.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href="#namespaceboost_195b08213f201c2067d8acb024756329d">operator<(const
- circular_buffer<T,Alloc>&, const circular_buffer<T,Alloc>&)</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="namespaceboost_14aa8f6a2c9640f3f22e266f0fca85777" name=
- "namespaceboost_14aa8f6a2c9640f3f22e266f0fca85777"></a> <code><b>template <class T, class Alloc><br>
- void swap(circular_buffer<T,Alloc>& lhs, circular_buffer<T,Alloc>&
- rhs);</b></code><br>
- <br>
- Swap the contents of two <code>circular_buffer</code>s.
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- <code>lhs</code> contains elements of <code>rhs</code> and vice versa.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>lhs</code>
- </dt>
- <dd>
- The <code>circular_buffer</code> whose content will be swapped with <code>rhs</code>.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>rhs</code>
- </dt>
- <dd>
- The <code>circular_buffer</code> whose content will be swapped with <code>lhs</code>.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- Nothing.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Constant (in the size of the <code>circular_buffer</code>s).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Invalidates all iterators of both <code>circular_buffer</code>s. (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.)
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href=
- "#classboost_1_1circular__buffer_1270ab7074c365663a6f18808024fd88b">swap(circular_buffer<T,
- Alloc>&)</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- </table>
- </div>
- <h2>
- <a name="notes" id="notes">Notes</a>
- </h2>
- <ol>
- <li>
- <a name="note1" id="note1"></a>
- <p>
- A good implementation of smart pointers is included in Boost.
- </p>
- </li>
- <li>
- <a name="note2" id="note2"></a>
- <p>
- Never create a circular buffer of <code>std::auto_ptr</code>. Refer to <a href=
- "http://www.aristeia.com">Scott Meyers</a> ' excellent book <em>Effective STL</em> for a detailed discussion.
- (Meyers S., <i>Effective STL: 50 Specific Ways to Improve Your Use of the Standard Template Library</i>.
- Addison-Wesley, 2001.)
- </p>
- </li>
- </ol>
- <h2>
- <a name="see" id="see">See also</a>
- </h2>
- <p>
- <code>boost::circular_buffer_space_optimized, <a href=
- "http://www.sgi.com/tech/stl/Vector.html">std::vector</a>, <a href=
- "http://www.sgi.com/tech/stl/List.html">std::list</a>, <a href=
- "http://www.sgi.com/tech/stl/Deque.html">std::deque</a></code>
- </p>
- <h2>
- <a name="ack" id="ack">Acknowledgements</a>
- </h2>
- <p>
- The <code>circular_buffer</code> has a short history. Its first version was a <code>std::deque</code> adaptor.
- This container was not very effective because of many reallocations when inserting/removing an element. Thomas
- Wenish did a review of this version and motivated me to create a circular buffer which allocates memory at once
- when created.
- </p>
- <p>
- The second version adapted <code>std::vector</code> but it has been abandoned soon because of limited control
- over iterator invalidation.
- </p>
- <p>
- The current version is a full-fledged STL compliant container. Pavel Vozenilek did a thorough review of this
- version and came with many good ideas and improvements. Also, I would like to thank Howard Hinnant, Nigel Stewart
- and everyone who participated at the formal review for valuable comments and ideas.
- </p>
- <h2>
- <a name="relnotes" id="relnotes">Release Notes</a>
- </h2>
- <dl>
- <dd>
- <h3>
- Boost 1.42
- </h3>
- </dd>
- <dd>
- <ul>
- <li>Added methods <code>erase_begin(size_type)</code> and <code>erase_end(size_type)</code> with constant
- complexity for such types of stored elements which do not need an explicit destruction e.g. <code>int</code>
- or <code>double</code>.
- </li>
- <li>Similarly changed implementation of the <code>clear()</code> method and the destructor so their
- complexity is now constant for such types of stored elements which do not require an explicit destruction
- (the complexity for other types remains linear).
- </li>
- </ul>
- </dd>
- <dd>
- <h3>
- Boost 1.37
- </h3>
- </dd>
- <dd>
- <ul>
- <li>Added new methods <code>is_linearized()</code> and <code>rotate(const_iterator)</code>.
- </li>
- <li>Fixed bugs:<br>
- #1987 Patch to make <code>circular_buffer.hpp</code> #includes absolute.<br>
- #1852 Copy constructor does not copy capacity.
- </li>
- </ul>
- </dd>
- <dd>
- <h3>
- Boost 1.36
- </h3>
- </dd>
- <dd>
- <ul>
- <li>Changed behaviour of the <code>circular_buffer(const allocator_type&)</code> constructor. Since this
- version the constructor does not allocate any memory and both capacity and size are set to zero.
- </li>
- <li>Fixed bug:<br>
- #1919 Default constructed circular buffer throws <code>std::bad_alloc</code>.<br>
- </li>
- </ul>
- </dd>
- <dd>
- <h3>
- Boost 1.35
- </h3>
- </dd>
- <dd>
- <ul>
- <li>Initial release.
- </li>
- </ul>
- </dd>
- </dl>
- <hr size="1">
- <p>
- <small>Copyright © 2003-2008 Jan Gaspar</small>
- </p>
- <p>
- <small>Use, modification, and distribution is subject to the Boost Software License, Version 1.0.<br>
- (See accompanying file <code>LICENSE_1_0.txt</code> or copy at <a href=
- "http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt>)</small>
- </p>
- </body>
-</html>
Copied: branches/release/libs/circular_buffer/doc/circular_buffer.idx (from r85122, trunk/libs/circular_buffer/doc/circular_buffer.idx)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/release/libs/circular_buffer/doc/circular_buffer.idx 2013-08-29 04:39:09 EDT (Thu, 29 Aug 2013) (r85510, copy of r85122, trunk/libs/circular_buffer/doc/circular_buffer.idx)
@@ -0,0 +1,22 @@
+# circular_buffer.idx index script file
+# for Boost.circular_buffer Quickbook Doxygen documentation Auto-indexing forcircular_buffer library.
+
+# Copyright (c) 2011 Paul A. Bristow
+# Copyright (c) 2003 - 2008 Jan Gaspar
+
+# boost-no-inspect
+
+# Use, modification and distribution is subject to the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE_1_0.txt
+# or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+# All header files, recursing down to include sub-folders.
+!scan-path "boost/circular_buffer" ".*\.hpp" true
+
+# All example source files, assuming no sub-folders.
+!scan-path "libs/circular_buffer/example" ".*\.cpp"
+
+
+
+
+
Deleted: branches/release/libs/circular_buffer/doc/circular_buffer.png
==============================================================================
Binary file. No diff available.
Copied and modified: branches/release/libs/circular_buffer/doc/circular_buffer.qbk (from r85122, trunk/libs/circular_buffer/doc/circular_buffer.qbk)
==============================================================================
--- trunk/libs/circular_buffer/doc/circular_buffer.qbk Tue Jul 23 00:56:21 2013 (r85122, copy source)
+++ branches/release/libs/circular_buffer/doc/circular_buffer.qbk 2013-08-29 04:39:09 EDT (Thu, 29 Aug 2013) (r85510)
@@ -267,6 +267,49 @@
The rules when the iterator is still valid can be inferred from the code in
[@../../libs/circular_buffer/test/soft_iterator_invalidation.cpp soft_iterator_invalidation.cpp].
+
+[h3 Move emulation and rvalues]
+
+Since Boost 1.54.0 support for move semantics was implemented using
+the [@boost:libs/move/doc/html/move.html Boost.Move] library.
+If rvalue references are available __cb will use them, but if not it uses a close,
+but imperfect emulation. On such compilers:
+
+* Non-copyable objects can be stored in the containers.
+ They can be constructed in place using `emplace`, or if they support
+ Boost.Move, moved into place.
+* The containers themselves are not movable.
+* Argument forwarding is not perfect.
+
+__cb will use rvalues and move emulations for value types only if move constructor and move assignment operator of the value type do not throw;
+or if the value type has no copy constructor.
+
+Some methods won't use move constructor for the value type at all, if the constructor throws. This is
+required for data consistency and avoidance of situations, when aftrer an exception __cb
+contains moved away objects along with the good ones.
+
+See documentation for [@boost:libs/type_traits/doc/html/boost_typetraits/reference/is_copy_constructible.html `is_copy_constructible`], [@boost:libs/type_traits/doc/html/boost_typetraits/reference/is_nothrow_move_assignable.html `is_nothrow_move_assignable`] and [@boost:libs/type_traits/doc/html/boost_typetraits/reference/is_nothrow_move_constructible.html `is_nothrow_move_constructible`] type triats.
+There you'll find information about how to make constructor of class noexcept and how to make a non-copyable
+class in C++03 and C++98.
+
+Performance of __cb will *greatly improve* if value type has noexcept move constructor and noexcept move assignment.
+
+[h3 Exceptions of move_if_noexcept(T&)]
+
+Reference documentation of the __cb contains notes like "Throws: See Exceptions of `move_if_noexcept(T&)`".
+That note means the following: `move_if_noexcept(T& value)` does not throws exceptions at all, but it returns
+`value` as rvalue reference only if class `T` have noexcept move constructor and noexcept move assignment operator;
+or if it has no copy constructor. Otherwise `move_if_noexcept(T& value)` returns `value` as const reference.
+
+This leads us to the following situation:
+
+* If `value` has a noexcept move constructor and noexcept move assignment operator, then no exceptions will be thrown at all.
+* If `value` has a throwing move constructor and some copy constructor, then method may throw exceptions of copy constructor.
+* If `value` has no copy constructor, then method may throw exceptions of move constructor.
+
+`move_if_noexcept(T&)` uses [@boost:libs/move/doc/html/move.html Boost.Move], [@boost:libs/type_traits/doc/html/boost_typetraits/reference/is_copy_constructible.html `is_copy_constructible`], [@boost:libs/type_traits/doc/html/boost_typetraits/reference/is_nothrow_move_assignable.html `is_nothrow_move_assignable`] and [@boost:libs/type_traits/doc/html/boost_typetraits/reference/is_nothrow_move_constructible.html `is_nothrow_move_constructible`] type triats.
+
+
[h3 Caveats]
The __cb should not be used for storing pointers to dynamically allocated objects.
@@ -492,6 +535,7 @@
[h4 Boost 1.55]
* Documentation refactored by Paul A. Bristow using Quickbook, Doxygen and Autoindexing.
+* Rvalue references emulation added by Antony Polukhin using Boost.Move.
[h4 Boost 1.42]
Deleted: branches/release/libs/circular_buffer/doc/circular_buffer.xslt
==============================================================================
--- branches/release/libs/circular_buffer/doc/circular_buffer.xslt 2013-08-29 04:39:09 EDT (Thu, 29 Aug 2013) (r85509)
+++ /dev/null 00:00:00 1970 (deleted)
@@ -1,68 +0,0 @@
-<?xml version='1.0' encoding='iso-8859-1'?>
-<!--
-XSL transformation from the XML files generated by Doxygen into XHTML source
-code documentation of the circular_buffer.
-
-Copyright (c) 2003-2008 Jan Gaspar
-
-Use, modification, and distribution is subject to the Boost Software
-License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-http://www.boost.org/LICENSE_1_0.txt)
--->
-
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
-
- <xsl:import href="doxygen2html.xslt"/>
-
- <xsl:output method="xml" version="1.0" encoding="iso-8859-1" indent="yes" media-type="text/xml"/>
-
- <xsl:variable name="link-prefix" select="''"/>
- <xsl:variable name="standalone-functions" select="document(concat($xmldir, '/namespaceboost.xml'))/doxygen/compounddef/sectiondef[@kind='func']"/>
-
- <xsl:template name="reference">
- <xsl:value-of select="concat('#', @refid)"/>
- </xsl:template>
-
- <xsl:template name="template-parameters">
- <xsl:apply-templates select="templateparamlist/param" mode="synopsis"/>
- </xsl:template>
-
- <xsl:template name="public-types">
- <xsl:apply-templates select="sectiondef[@kind='public-type']/memberdef" mode="synopsis"/>
- </xsl:template>
-
- <xsl:template name="constructors">
- <xsl:apply-templates select="sectiondef[@kind='public-func']/memberdef[type = '']" mode="synopsis"/>
- </xsl:template>
-
- <xsl:template name="member-functions">
- <xsl:apply-templates select="sectiondef[@kind='public-func']/memberdef[type != '']" mode="synopsis"/>
- </xsl:template>
-
- <xsl:template name="standalone-functions">
- <xsl:apply-templates select="$standalone-functions/memberdef[contains(argsstring, 'circular_buffer<')]" mode="synopsis">
- <xsl:with-param name="indent" select="''"/>
- </xsl:apply-templates>
- </xsl:template>
-
- <xsl:template name="template-parameters-details">
- <xsl:apply-templates select="detaileddescription//parameterlist[@kind='param']/parameteritem" mode="description"/>
- </xsl:template>
-
- <xsl:template name="public-types-details">
- <xsl:apply-templates select="sectiondef[@kind='public-type']/memberdef" mode="description"/>
- </xsl:template>
-
- <xsl:template name="constructors-details">
- <xsl:apply-templates select="sectiondef[@kind='public-func']/memberdef[type = '']" mode="description"/>
- </xsl:template>
-
- <xsl:template name="member-functions-details">
- <xsl:apply-templates select="sectiondef[@kind='public-func']/memberdef[type != '']" mode="description"/>
- </xsl:template>
-
- <xsl:template name="standalone-functions-details">
- <xsl:apply-templates select="$standalone-functions/memberdef[contains(argsstring, 'circular_buffer<')]" mode="description"/>
- </xsl:template>
-
-</xsl:stylesheet>
Deleted: branches/release/libs/circular_buffer/doc/copy.xslt
==============================================================================
--- branches/release/libs/circular_buffer/doc/copy.xslt 2013-08-29 04:39:09 EDT (Thu, 29 Aug 2013) (r85509)
+++ /dev/null 00:00:00 1970 (deleted)
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="iso-8859-1"?>
-<!--
-Helper XSL transformation making plain copy of an XML tree.
-
-Copyright (c) 2003-2008 Jan Gaspar
-
-Use, modification, and distribution is subject to the Boost Software
-License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-http://www.boost.org/LICENSE_1_0.txt)
--->
-
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
-
- <xsl:template match="/ | node() | @* | comment() | processing-instruction()">
- <xsl:copy>
- <xsl:apply-templates select="@* | node()"/>
- </xsl:copy>
- </xsl:template>
-
-</xsl:stylesheet>
Deleted: branches/release/libs/circular_buffer/doc/doxygen2html.xslt
==============================================================================
--- branches/release/libs/circular_buffer/doc/doxygen2html.xslt 2013-08-29 04:39:09 EDT (Thu, 29 Aug 2013) (r85509)
+++ /dev/null 00:00:00 1970 (deleted)
@@ -1,363 +0,0 @@
-<?xml version='1.0' encoding='iso-8859-1'?>
-<!--
-Generic XSL transformation from the XML files generated by Doxygen into XHTML
-source code documentation.
-
-Copyright (c) 2003-2008 Jan Gaspar
-
-Use, modification, and distribution is subject to the Boost Software
-License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-http://www.boost.org/LICENSE_1_0.txt)
--->
-
-<!DOCTYPE stylesheet [
- <!ENTITY nbsp " ">
- <!ENTITY space " ">
-]>
-
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
-
- <xsl:param name="container"/>
- <xsl:param name="xmldir"/>
- <xsl:variable name="container-ref" select="//compound[name=concat('boost::', $container) and @kind='class']/@refid"/>
- <xsl:variable name="class-file" select="concat($xmldir, '/', $container-ref, '.xml')"/>
- <xsl:variable name="class" select="document($class-file)/doxygen/compounddef[@id = $container-ref]"/>
-
- <xsl:template match="/">
- <html>
- <header><title>Source Code Documentation</title></header>
- <body>
- <xsl:apply-templates select="$class" mode="synopsis"/>
- <xsl:apply-templates select="$class" mode="description"/>
- </body>
- </html>
- </xsl:template>
-
- <xsl:template match="nonbreakablespace">
-
- </xsl:template>
-
- <xsl:template match="bold">
- <b><xsl:apply-templates/></b>
- </xsl:template>
-
- <xsl:template match="emphasis">
- <i><xsl:apply-templates/></i>
- </xsl:template>
-
- <xsl:template match="linebreak">
- <br />
- </xsl:template>
-
- <xsl:template match="preformatted">
- <pre><xsl:apply-templates/></pre>
- </xsl:template>
-
- <xsl:template match="computeroutput">
- <code><xsl:apply-templates/></code>
- </xsl:template>
-
- <xsl:template match="para">
- <xsl:apply-templates/>
- </xsl:template>
-
- <xsl:template match="ref">
- <xsl:variable name="link-text" select="substring-after(text(), concat($container, '::'))"/>
- <xsl:choose>
- <xsl:when test="string-length($link-text) > 0">
- <xsl:element name="a">
- <xsl:attribute name="href"><xsl:call-template name="reference"/></xsl:attribute>
- <xsl:value-of select="$link-text"/>
- </xsl:element>
- </xsl:when>
- <xsl:when test="text() = $container">
- <xsl:value-of select="text()"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:element name="a">
- <xsl:choose>
- <xsl:when test="count(//memberdef[@id=current()/@refid]) > 0">
- <xsl:attribute name="href"><xsl:value-of select="concat('#', @refid)"/></xsl:attribute>
- </xsl:when>
- <xsl:otherwise>
- <xsl:attribute name="href"><xsl:value-of select="concat($link-prefix, '#', @refid)"/></xsl:attribute>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:value-of select="text()"/>
- </xsl:element>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template match="ulink">
-
- </xsl:template>
-
- <xsl:template match="parameteritem">
- <xsl:param name="desc" select="''"/>
- <xsl:param name="style" select="'code'"/>
- <xsl:if test="$desc != ''">
- <dt><b><xsl:value-of select="$desc"/></b></dt>
- </xsl:if>
- <dd>
- <xsl:choose>
- <xsl:when test="$style = 'code'">
- <dl compact="yes">
- <dt><code><xsl:apply-templates select="parameternamelist/parametername"/></code></dt>
- <dd><xsl:apply-templates select="parameterdescription"/></dd>
- </dl>
- </xsl:when>
- <xsl:when test="contains(parameternamelist/parametername, '<code>')">
- <code><xsl:value-of select="substring-before(substring-after(parameternamelist/parametername, '<code>'), '</code>')"/></code>
- <xsl:apply-templates select="parameterdescription"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates select="parameternamelist/parametername"/>
- <xsl:apply-templates select="parameterdescription"/>
- </xsl:otherwise>
- </xsl:choose>
- </dd>
- <xsl:apply-templates select="following-sibling::parameteritem[1]">
- <xsl:with-param name="style" select="$style"/>
- </xsl:apply-templates>
- </xsl:template>
-
- <xsl:template match="simplesect[@kind='return']">
- <dl><dt><b>Returns:</b></dt><dd><xsl:apply-templates/></dd></dl>
- </xsl:template>
-
- <xsl:template match="simplesect[@kind='pre']">
- <dl><dt><b>Precondition:</b></dt><dd><xsl:apply-templates/></dd></dl>
- </xsl:template>
-
- <xsl:template match="simplesect[@kind='post']">
- <dl><dt><b>Effect:</b></dt><dd><xsl:apply-templates/></dd></dl>
- </xsl:template>
-
- <xsl:template match="simplesect[@kind='par']">
- <dl><dt><b><xsl:value-of select="title"/>:</b></dt><dd><xsl:apply-templates select="para"/></dd></dl>
- </xsl:template>
-
- <xsl:template match="simplesect[@kind='warning']">
- <dl><dt><b>Warning:</b></dt><dd><xsl:apply-templates/></dd></dl>
- </xsl:template>
-
- <xsl:template match="simplesect[@kind='note']">
- <dl><dt><b>Note:</b></dt><dd><xsl:apply-templates/></dd></dl>
- </xsl:template>
-
- <xsl:template match="simplesect[@kind='see']">
- <dl><dt><b>See Also:</b></dt><dd><xsl:apply-templates/></dd></dl>
- </xsl:template>
-
- <xsl:template match="parameterlist[@kind='param']">
- <dl><xsl:apply-templates select="parameteritem[1]">
- <xsl:with-param name="desc" select="'Parameter(s):'"/>
- </xsl:apply-templates></dl>
- </xsl:template>
-
- <xsl:template match="parameterlist[@kind='exception']">
- <dl><xsl:apply-templates select="parameteritem[1]">
- <xsl:with-param name="desc" select="'Throws:'"/>
- <xsl:with-param name="style" select="'plain'"/>
- </xsl:apply-templates></dl>
- </xsl:template>
-
- <xsl:template match="briefdescription">
- <xsl:apply-templates/>
- </xsl:template>
-
- <!-- Synopsis mode -->
-
- <xsl:template match="compounddef[@kind = 'class']" mode="synopsis">
- <div id="srcdoc_synopsis">
- <table id="table_synopsis" border="0" cellpadding="10">
- <tr><td>
-<pre>
-namespace boost {
-
-template <<xsl:call-template name="template-parameters"/>>
-class <xsl:value-of select="$container"/>
-{
-public:
-<xsl:call-template name="public-types"/><xsl:text disable-output-escaping="yes">
-</xsl:text>
-<xsl:call-template name="constructors"/><xsl:text disable-output-escaping="yes">
-</xsl:text>
-<xsl:call-template name="member-functions"/><xsl:text disable-output-escaping="yes">};
-
-</xsl:text>
-<xsl:call-template name="standalone-functions"/>
-} // namespace boost
-</pre>
- </td></tr>
- </table>
- </div>
- </xsl:template>
-
- <xsl:template match="param" mode="synopsis">
- <xsl:param name="link-prefix" select="''"/>
- <xsl:value-of select="type"/>
- </xsl:template>
-
- <xsl:template match="memberdef[@kind='typedef']" mode="synopsis">
- <xsl:param name="link-prefix" select="''"/>
- <xsl:if test="normalize-space(briefdescription) != ''"> typedef <xsl:value-of select="substring('typename ', 1 div (contains(type, '::') and not(contains(type, '>'))))"/>
- <xsl:choose>
- <xsl:when test="contains(type, 'cb_details::')"><i>implementation-defined</i> </xsl:when>
- <xsl:otherwise><xsl:apply-templates select="type" mode="synopsis"/> </xsl:otherwise>
- </xsl:choose>
-
-</xsl:text>
- </xsl:if>
- </xsl:template>
-
- <xsl:template match="memberdef[@kind='function']" mode="synopsis">
- <xsl:param name="indent" select="' '"/>
- <xsl:param name="link-prefix" select="''"/>
- <xsl:param name="link" select="''"/>
- <xsl:value-of select="$indent"/>
- <xsl:value-of select="substring('explicit ', 1 div (@explicit = 'yes'))"/>
- <xsl:if test="count(templateparamlist) > 0">template <<xsl:for-each select="templateparamlist/param"><xsl:value-of select="type"/> <xsl:value-of select="declname"/><xsl:value-of select="substring(', ', 1 div (count(following-sibling::param) != 0))"/></xsl:for-each>><xsl:text disable-output-escaping="yes">
- </xsl:text><xsl:value-of select="$indent"/>
- </xsl:if>
- <xsl:if test="type != ''"><xsl:apply-templates select="type" mode="synopsis"/> </xsl:if>
- <a href="{$link-prefix}#{concat(substring(@id, 1 div (string-length($link) = 0)), substring($link, 1 div (string-length($link) > 0)))}">
- <xsl:value-of select="name"/>
- </a>(<xsl:for-each select="param">
- <xsl:apply-templates select="type" mode="synopsis"/> <xsl:value-of select="declname"/>
- <xsl:value-of select="substring(concat(' = ', defval), 1 div (normalize-space(defval) != ''))"/>
- <xsl:value-of select="substring(', ', 1 div (count(following-sibling::param) != 0))"/>
- </xsl:for-each>)<xsl:value-of select="substring(' const', 1 div (@const = 'yes'))"/>;<xsl:text disable-output-escaping="yes">
-</xsl:text>
- </xsl:template>
-
- <xsl:template match="type" mode="synopsis">
- <xsl:for-each select="text() | ref">
- <xsl:variable name="item" select="translate(., '&space;', '')"/>
- <xsl:choose>
- <xsl:when test="contains($item, 'return_value_type') or contains($item, 'param_value_type')">const_reference</xsl:when>
- <xsl:otherwise>
- <xsl:choose>
- <xsl:when test="contains($item, ',')"><xsl:value-of select="concat(substring-before($item, ','), ', ', substring-after($item, ','))"/></xsl:when>
- <xsl:otherwise><xsl:value-of select="$item"/></xsl:otherwise>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:if test="not(contains($item, '<')) and not(contains($item, ',')) and name(.) != 'ref' and position() != last()"> </xsl:if>
- </xsl:for-each>
- </xsl:template>
-
- <!-- Description mode -->
-
- <xsl:template match="compounddef[@kind = 'class']" mode="description">
- <div id="srcdoc_params">
- <table id="table_template_params" border="1" cellpadding="3">
- <tr><th>Parameter</th><th>Description</th><th>Default</th></tr>
- <xsl:call-template name="template-parameters-details"/>
- </table>
- </div>
- <div id="srcdoc_types">
- <table id="table_public_types" border="1" cellpadding="3">
- <tr><th>Type</th><th>Description</th></tr>
- <xsl:call-template name="public-types-details"/>
- </table>
- </div>
- <div id="srcdoc_constructors">
- <table id="table_constructors" border="1" cellpadding="3">
- <xsl:call-template name="constructors-details"/>
- </table>
- </div>
- <div id="srcdoc_methods">
- <table id="table_methods" border="1" cellpadding="3">
- <xsl:call-template name="member-functions-details"/>
- </table>
- </div>
- <div id="srcdoc_functions">
- <table id="table_functions" border="1" cellpadding="3">
- <xsl:call-template name="standalone-functions-details"/>
- </table>
- </div>
- </xsl:template>
-
- <xsl:template match="parameteritem" mode="description">
- <tr><td><a id="templateparam_{parameternamelist/parametername}"><code><xsl:value-of select="parameternamelist/parametername"/></code></a></td>
- <td>
- <xsl:apply-templates select="parameterdescription"/>
- <xsl:variable name="type-rqmts" select="concat('Type Requirements ', parameternamelist/parametername)"/>
- <xsl:if test="../../simplesect[@kind='par']/title = $type-rqmts">
- <dl><dt><b>Type Requirements:</b></dt>
- <dd><xsl:apply-templates select="../../simplesect[@kind='par'][title=$type-rqmts]/para"/></dd></dl>
- </xsl:if>
- </td>
- <xsl:variable name="default-value" select="concat('Default ', parameternamelist/parametername)"/>
- <xsl:choose>
- <xsl:when test="../../simplesect[@kind='par']/title = $default-value">
- <td><code><xsl:value-of select="../../simplesect[@kind='par'][title=$default-value]/para"/></code></td>
- </xsl:when>
- <xsl:otherwise><td><br/></td></xsl:otherwise>
- </xsl:choose>
- </tr>
- </xsl:template>
-
- <xsl:template match="memberdef[@kind='typedef']" mode="description">
- <xsl:if test="normalize-space(briefdescription) != ''">
- <tr><td><a id="{@id}"><code><xsl:value-of select="name"/></code></a></td>
- <td>
- <xsl:apply-templates select="briefdescription/child::*"/>
- <xsl:if test="boolean(detaileddescription/para)">
- <xsl:apply-templates select="detaileddescription/para/text()|detaileddescription/para/child::*"/>
- </xsl:if>
- </td></tr>
- </xsl:if>
- </xsl:template>
-
- <xsl:template match="memberdef[@kind='function']" mode="description">
- <xsl:param name="link-prefix" select="''"/>
- <tr><td><a id="{@id}" /><code><b><xsl:value-of select="substring('explicit ', 1 div (@explicit = 'yes'))"/>
- <xsl:if test="count(templateparamlist) > 0">
- template <<xsl:for-each select="templateparamlist/param"><xsl:value-of select="type"/> <xsl:value-of select="declname"/><xsl:value-of select="substring(', ', 1 div (count(following-sibling::param) != 0))"/></xsl:for-each>><br />
- </xsl:if>
- <xsl:if test="type != ''"><xsl:apply-templates select="type" mode="description"/> </xsl:if>
- <xsl:value-of select="name"/>(<xsl:for-each select="param">
- <xsl:apply-templates select="type" mode="description"/> <xsl:value-of select="declname"/>
- <xsl:value-of select="substring(concat(' = ', defval), 1 div (normalize-space(defval) != ''))"/>
- <xsl:value-of select="substring(', ', 1 div (count(following-sibling::param) != 0))"/>
- </xsl:for-each>)<xsl:value-of select="substring(' const', 1 div (@const = 'yes'))"/>;</b></code><br /><br />
- <xsl:apply-templates select="briefdescription"/>
- <xsl:if test="normalize-space(detaileddescription) = ''">
- <br /><br />
- </xsl:if>
- <p><xsl:apply-templates select="detaileddescription"/></p>
- </td></tr>
- </xsl:template>
-
- <xsl:template match="type" mode="description">
- <xsl:for-each select="text() | ref">
- <xsl:variable name="item" select="translate(., '&space;', '')"/>
- <xsl:choose>
- <xsl:when test="$item = 'return_value_type' or $item = 'param_value_type'">
- <xsl:variable name="const-reference" select="$class[@kind = 'class']/sectiondef[@kind='public-type']/memberdef[@kind='typedef' and name='const_reference']"/>
- <xsl:choose>
- <xsl:when test="boolean($const-reference/reimplements)">
- const_reference
- </xsl:when>
- <xsl:otherwise>
- const_reference
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:when test="contains($item, 'circular_buffer')"><xsl:value-of select="$item"/></xsl:when>
- <xsl:when test="@refid">
- <xsl:element name="a">
- <xsl:attribute name="href"><xsl:call-template name="reference"/></xsl:attribute>
- <xsl:value-of select="$item"/>
- </xsl:element>
- </xsl:when>
- <xsl:otherwise><xsl:value-of select="$item"/></xsl:otherwise>
- </xsl:choose>
- <xsl:if test="name(.) != 'ref' and position() != last()"> </xsl:if>
- </xsl:for-each>
- </xsl:template>
-
-</xsl:stylesheet>
Deleted: branches/release/libs/circular_buffer/doc/html2xhtml.xslt
==============================================================================
--- branches/release/libs/circular_buffer/doc/html2xhtml.xslt 2013-08-29 04:39:09 EDT (Thu, 29 Aug 2013) (r85509)
+++ /dev/null 00:00:00 1970 (deleted)
@@ -1,18 +0,0 @@
-<?xml version='1.0' encoding='iso-8859-1'?>
-<!--
-Helper XSL transformation which converts HTML into XHTML.
-
-Copyright (c) 2003-2008 Jan Gaspar
-
-Use, modification, and distribution is subject to the Boost Software
-License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-http://www.boost.org/LICENSE_1_0.txt)
--->
-
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
-
- <xsl:import href="copy.xslt"/>
-
- <xsl:output method="xml" version="1.0" encoding="iso-8859-1" indent="yes" media-type="text/html"/>
-
-</xsl:stylesheet>
Copied and modified: branches/release/libs/circular_buffer/doc/jamfile.v2 (from r85122, trunk/libs/circular_buffer/doc/jamfile.v2)
==============================================================================
--- trunk/libs/circular_buffer/doc/jamfile.v2 Tue Jul 23 00:56:21 2013 (r85122, copy source)
+++ branches/release/libs/circular_buffer/doc/jamfile.v2 2013-08-29 04:39:09 EDT (Thu, 29 Aug 2013) (r85510)
@@ -34,42 +34,45 @@
:
# Pass some setting parameters to Doxygen.
- <doxygen:param>WARNINGS=YES # Default NO, but useful to see warnings, especially in a logfile.
- # It is also wise to to set a warnings logfile like this:
- <doxygen:param>WARN_LOGFILE=AutoDoxywarnings.log # This may not be empty (usually not a good sign!), depending on options chosen.
- # Much better to send message to a logfile than the default stderr.
- # and make sure that there are no Doxygen errors or significant warnings in the log file.
- <doxygen:param>RECURSIVE=NO # Search recursively down .hpp and .cpp subdirectories.
+ <doxygen:param>WARNINGS=YES # Default NO, but useful to see warnings, especially in a logfile.
+ # It is also wise to to set a warnings logfile like this:
+ <doxygen:param>WARN_LOGFILE=AutoDoxywarnings.log # This may not be empty (usually not a good sign!), depending on options chosen.
+ # Much better to send message to a logfile than the default stderr.
+ # and make sure that there are no Doxygen errors or significant warnings in the log file.
+ <doxygen:param>RECURSIVE=NO # Search recursively down .hpp and .cpp subdirectories.
<doxygen:param>EXTRACT_ALL=NO
- <doxygen:param>EXTRACT_PRIVATE=NO # NO means do not extract info about private member functions and data.
- <doxygen:param>HIDE_UNDOC_MEMBERS=YES # Only show members that have some documentation like \param, \return ...
- <doxygen:param>MACRO_EXPANSION=YES # YES will expand all macro names in the source code (default = NO).
- <doxygen:param>EXPAND_ONLY_PREDEF=YES # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
- # then the macro expansion is limited to the macros specified with the PREDEFINED and EXPAND_AS_DEFINED tags.
- # If EXPAND_ONLY_PREDEF tag can be used to specify a list of macro names that should be expanded (as defined).
- # The PREDEFINED tag can be used to specify one or more macro names that are defined
- # before the preprocessor is started (similar to the -D option of gcc).
- # The argument of the tag is a list of macros of the form:
- # name or name=definition (no spaces).
- # If the definition and the "=" are omitted, "=1" is assumed.
- # To prevent a macro definition from being undefined via #undef or
- # recursively expanded use the := operator instead of the = operator.
- # See http://www.stack.nl/~dimitri/doxygen/config.html#cfg_predefined.
- # static char *malloc BOOST_PREVENT_MACRO_SUBSTITUTION(const size_type bytes);
- # will not produce a helpful Doxygen output, so
- # replace some with more helpful text, or none, for example:
- <doxygen:param>"PREDEFINED= \\
- \"BOOST_PREVENT_MACRO_SUBSTITUTION\" \\
- \"BOOST_STATIC_CONSTANT(T,V)=static x const y\" \\
- \"BOOST_UNITS_AUTO_STATIC_CONSTANT(a,b)=static const auto a = b\" \\
- \"BOOST_DEDUCED_TYPENAME=typename\" \\
- \"BOOST_CONSTEXPR=constexpr\" \\
- \"BOOST_UNITS_TYPEOF(a)=typeof(a)\" \\
- \"BOOST_UNITS_HAS_TYPEOF=1\" \\
- \"BOOST_MPL_ASSERT(expr)=\" \\
- \"BOOST_ASSERT(expr)=\" \\
- \"ASSERT(x)=assert(x)\" \\
- \"__cplusplus \""
+ <doxygen:param>EXTRACT_PRIVATE=NO # NO means do not extract info about private member functions and data.
+ <doxygen:param>HIDE_UNDOC_MEMBERS=YES # Only show members that have some documentation like \param, \return ...
+ <doxygen:param>MACRO_EXPANSION=YES # YES will expand all macro names in the source code (default = NO).
+ <doxygen:param>EXPAND_ONLY_PREDEF=YES # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
+ # then the macro expansion is limited to the macros specified with the PREDEFINED and EXPAND_AS_DEFINED tags.
+ # If EXPAND_ONLY_PREDEF tag can be used to specify a list of macro names that should be expanded (as defined).
+ # The PREDEFINED tag can be used to specify one or more macro names that are defined
+ # before the preprocessor is started (similar to the -D option of gcc).
+ # The argument of the tag is a list of macros of the form:
+ # name or name=definition (no spaces).
+ # If the definition and the "=" are omitted, "=1" is assumed.
+ # To prevent a macro definition from being undefined via #undef or
+ # recursively expanded use the := operator instead of the = operator.
+ # See http://www.stack.nl/~dimitri/doxygen/config.html#cfg_predefined.
+ # static char *malloc BOOST_PREVENT_MACRO_SUBSTITUTION(const size_type bytes);
+ # will not produce a helpful Doxygen output, so
+ # replace some with more helpful text, or none, for example:
+ <doxygen:param>"PREDEFINED= \\
+ \"BOOST_PREVENT_MACRO_SUBSTITUTION\" \\
+ \"BOOST_STATIC_CONSTANT(T,V)=static x const y\" \\
+ \"BOOST_UNITS_AUTO_STATIC_CONSTANT(a,b)=static const auto a = b\" \\
+ \"BOOST_DEDUCED_TYPENAME=typename\" \\
+ \"BOOST_CONSTEXPR=constexpr\" \\
+ \"BOOST_CONTAINER_NOEXCEPT=noexcept\" \\
+ \"BOOST_CONTAINER_NOEXCEPT_IF(T)=noexcept(T)\" \\
+ \"BOOST_UNITS_TYPEOF(a)=typeof(a)\" \\
+ \"BOOST_UNITS_HAS_TYPEOF=1\" \\
+ \"BOOST_MPL_ASSERT(expr)=\" \\
+ \"BOOST_ASSERT(expr)=\" \\
+ \"BOOST_RV_REF(T)=T &&\" \\
+ \"ASSERT(x)=assert(x)\" \\
+ \"__cplusplus \""
# BOOST_PREVENT_MACRO_SUBSTITUTION, will not be replaced by ,
# BOOST_STATIC_CONSTANT will be replaced by "static x const y",
# BOOST_DEDUCED_TYPENAME will be replaced by "typename",
@@ -89,7 +92,7 @@
# Boost Libraries with useful examples are: Accumulators, Interprocess, MPI, Random, Units, Expressive.
# Optionally, you can provide a Reference section name specific for your library, for example:
- <xsl:param>"boost.doxygen.reftitle=Boost.Circular_buffer C++ Reference"
+ <xsl:param>"boost.doxygen.reftitle=Boost.Circular_buffer C++ Reference"
;
xml circular_buffer : circular_buffer.qbk ;
@@ -103,38 +106,39 @@
# General settings
# =================
-
- # Options for html and pdf
- # ========================
- # No indent on body text:
- <xsl:param>body.start.indent=0pt
- # Margin size:
- <xsl:param>page.margin.inner=0.5in
- # Margin size:
- <xsl:param>page.margin.outer=0.5in
- # Yes, we want graphics for admonishments:
- <xsl:param>admon.graphics=1
+ <xsl:param>boost.root=../../../..
+
+ # Options for html and pdf
+ # ========================
+ # No indent on body text:
+ <xsl:param>body.start.indent=0pt
+ # Margin size:
+ <xsl:param>page.margin.inner=0.5in
+ # Margin size:
+ <xsl:param>page.margin.outer=0.5in
+ # Yes, we want graphics for admonishments:
+ <xsl:param>admon.graphics=1
- # HTML options:
- # =============
- # Use graphics icons not text for navigation:
- <xsl:param>navig.graphics=1
- # How far down we chunk nested sections, basically all of them:
- <xsl:param>chunk.section.depth=2
- # Don't put the first section on the same page as the TOC itself:
- <xsl:param>chunk.first.sections=1
- # How far down sections get TOC's
- <xsl:param>toc.section.depth=4
- # Max depth in each TOC:
- <xsl:param>toc.max.depth=2
- # How far down we go with TOC's
- <xsl:param>generate.section.toc.level=10
- # Horizontal ? spacing in table cells.
- <format>html:<xsl:param>html.cellspacing=3 # pixels
- # Vertical spacing in table cells.
- <format>html:<xsl:param>html.cellpadding=5 # pixels
- # Not sure if these are right way round?
-
+ # HTML options:
+ # =============
+ # Use graphics icons not text for navigation:
+ <xsl:param>navig.graphics=1
+ # How far down we chunk nested sections, basically all of them:
+ <xsl:param>chunk.section.depth=2
+ # Don't put the first section on the same page as the TOC itself:
+ <xsl:param>chunk.first.sections=1
+ # How far down sections get TOC's
+ <xsl:param>toc.section.depth=4
+ # Max depth in each TOC:
+ <xsl:param>toc.max.depth=2
+ # How far down we go with TOC's
+ <xsl:param>generate.section.toc.level=10
+ # Horizontal ? spacing in table cells.
+ <format>html:<xsl:param>html.cellspacing=3 # pixels
+ # Vertical spacing in table cells.
+ <format>html:<xsl:param>html.cellpadding=5 # pixels
+ # Not sure if these are right way round?
+
<auto-index>on # Turns on index (or off).
# Turns on (or off) index-verbose for diagnostic info (using /bin auto-index-verbose folders).
<auto-index-verbose>on
@@ -149,42 +153,43 @@
# Without this would need !scan-path "../../../boost/circular_buffer"
# Used by Quickbook to invoke indexing.
- # Required by boost-trunk/doc/ see jamfile.v2 to use auto-index.
+ # Required by boost-trunk/doc/ see jamfile.v2 to use auto-index.
# Choose indexing method for html:
<format>html:<auto-index-internal>on
<format>docbook:<auto-index-internal>on
- # PDF Options:
- # ============
- # TOC Generation: this is needed for FOP-0.9 and later:
- <format>pdf:<xsl:param>fop1.extensions=0
- # Or enable this if you're using XEP:
- <format>pdf:<xsl:param>xep.extensions=1
- # TOC generation: this is needed for FOP 0.2, but must not be set to zero for FOP-0.9!
- <format>pdf:<xsl:param>fop.extensions=0
- # No indent on body text:
- <xsl:param>body.start.indent=0pt
- # Margin size:
- <xsl:param>page.margin.inner=0.5in
- # Margin size:
- <xsl:param>page.margin.outer=0.5in
-
- # Yes, we want graphics for admonishments:
- <xsl:param>admon.graphics=1
-
- # Set these one for PDF generation *only*:
- # default png graphics are awful in PDF form,
- # better use SVG instead:
- #<format>pdf:<xsl:param>admon.graphics.extension=".svg"
- <format>pdf:<xsl:param>admon.graphics.extension=".png" # Only png images are available.
- <format>pdf:<xsl:param>admon.graphics.path=$(nav_images)/ # next, prev, note, tip ... for pdf.
- <format>pdf:<xsl:param>use.role.for.mediaobject=1
- <format>pdf:<xsl:param>preferred.mediaobject.role=print
+ # PDF Options:
+ # ============
+ # TOC Generation: this is needed for FOP-0.9 and later:
+ <format>pdf:<xsl:param>fop1.extensions=0
+ # Or enable this if you're using XEP:
+ <format>pdf:<xsl:param>xep.extensions=1
+ # TOC generation: this is needed for FOP 0.2, but must not be set to zero for FOP-0.9!
+ <format>pdf:<xsl:param>fop.extensions=0
+ # No indent on body text:
+ <xsl:param>body.start.indent=0pt
+ # Margin size:
+ <xsl:param>page.margin.inner=0.5in
+ # Margin size:
+ <xsl:param>page.margin.outer=0.5in
+
+ # Yes, we want graphics for admonishments:
+ <xsl:param>admon.graphics=1
+
+ # Set these one for PDF generation *only*:
+ # default png graphics are awful in PDF form,
+ # better use SVG instead:
+ #<format>pdf:<xsl:param>admon.graphics.extension=".svg"
+ <format>pdf:<xsl:param>admon.graphics.extension=".png" # Only png images are available.
+ <format>pdf:<xsl:param>admon.graphics.path=$(nav_images)/ # next, prev, note, tip ... for pdf.
+ <format>pdf:<xsl:param>use.role.for.mediaobject=1
+ <format>pdf:<xsl:param>preferred.mediaobject.role=print
<format>pdf:<xsl:param>img.src.path=$(pdf_images_location)/ # graphics (diagrams) for pdf.
- <format>pdf:<xsl:param>draft.mode="no"
-
- <dependency>autodoc #
- <dependency>png_install
+ <format>pdf:<xsl:param>draft.mode="no"
+ <format>pdf:<xsl:param>boost.url.prefix=../../../..
+
+ <dependency>autodoc #
+ <dependency>png_install
;
# Install (copy) the 'master' copies of all icon images (both PNG and SVG)
Deleted: branches/release/libs/circular_buffer/doc/space_optimized.html
==============================================================================
--- branches/release/libs/circular_buffer/doc/space_optimized.html 2013-08-29 04:39:09 EDT (Thu, 29 Aug 2013) (r85509)
+++ /dev/null 00:00:00 1970 (deleted)
@@ -1,4232 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
-"http://www.w3.org/TR/html4/loose.dtd">
-<html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <title>
- Space Optimized Circular Buffer
- </title>
- <link rel="stylesheet" href="../../../boost.css" type="text/css">
- </head>
- <body>
- <h1>
- Space Optimized Circular Buffer
- </h1>
- <table id="title" border="0">
- <tr>
- <td>
- <h1>
- circular_buffer_space_optimized<T, Alloc>
- </h1>
- </td>
- <td>
-
- </td>
- </tr>
- </table>
- <h2>
- Contents
- </h2>Description<br>
- Synopsis<br>
- Rationale<br>
- Header Files<br>
- Modelled concepts<br>
- Specific Public Types<br>
- Constructors and Destructor<br>
- Specific Public Member Functions<br>
- See also<br>
- Acknowledgements<br>
- Release Notes
- <h2>
- <a name="description" id="description">Description</a>
- </h2>
- <p>
- The <code>circular_buffer_space_optimized</code> container is an adaptor of the <code><a href=
- "circular_buffer.html">circular_buffer</a></code>. The functionality of the
- <code>circular_buffer_space_optimized</code> is similar to the base <code>circular_buffer</code> except it does
- not allocate memory at once when created rather it allocates memory as needed. (The predictive memory allocation
- is similar to typical <code>std::vector</code> implementation.) Moreover the memory is automatically freed as the
- size of the container decreases.
- </p>
- <table id="figure" border="0">
- <tr>
- <td></td>
- <td>
- <img src="space_optimized.png" width="700" height="350" alt="Space Optimized Circular Buffer" border="0">
- </td>
- </tr>
- <tr>
- <td valign="top">
- <b>Figure:</b>
- </td>
- <td valign="top">
- The memory allocation process of the space optimized circular buffer. The <code>min_capacity()</code> of the
- capacity controller represents the minimal guaranteed amount of allocated memory. The
- allocated memory will never drop under this value. The default value of the <code>min_capacity()</code> is
- set to <code>0</code>.
- </td>
- </tr>
- </table>
- <h2>
- <a name="synopsis" id="synopsis">Synopsis</a>
- </h2>
- <p>
- Note that some of the links point to the original <code>circular_buffer</code>
- if the functionality is the same.
- </p>
- <div id="srcdoc_synopsis">
- <table id="table_synopsis" border="0" cellpadding="10">
- <tr>
- <td>
- <pre>
-namespace boost {
-
-template <class T, class <a href=
-"circular_buffer.html#templateparam_Alloc">Alloc</a>>
-class circular_buffer_space_optimized
-{
-public:
- typedef typename Alloc::value_type <a href=
-"circular_buffer.html#classboost_1_1circular__buffer_1cbdd7ca87e147c08cd2be267eefd6540">value_type</a>;
- typedef typename Alloc::pointer <a href=
-"circular_buffer.html#classboost_1_1circular__buffer_14ff917f8a6131ec18e91606727592a9c">pointer</a>;
- typedef typename Alloc::const_pointer <a href=
-"circular_buffer.html#classboost_1_1circular__buffer_190f7c6bcb624ad507de546366f49028a">const_pointer</a>;
- typedef typename Alloc::reference <a href=
-"circular_buffer.html#classboost_1_1circular__buffer_1f38a9bc64d84757c661c2542ff9a7f65">reference</a>;
- typedef typename Alloc::const_reference <a href=
-"circular_buffer.html#classboost_1_1circular__buffer_1a8397191092f5bacee991b623ca4b910">const_reference</a>;
- typedef typename Alloc::size_type <a href=
-"circular_buffer.html#classboost_1_1circular__buffer_19ba12c0142a21a7d960877c22fa3ea00">size_type</a>;
- typedef typename Alloc::difference_type <a href=
-"circular_buffer.html#classboost_1_1circular__buffer_15313e723fa85d73db5826f8b722aa2a9">difference_type</a>;
- typedef Alloc <a href=
-"circular_buffer.html#classboost_1_1circular__buffer_14e07c6ddfe89debe384e59bed06e7cb7">allocator_type</a>;
- typedef <i>implementation-defined</i> <a href=
-"circular_buffer.html#classboost_1_1circular__buffer_15cab6d46f03c40d1e52d41843319ddb9">const_iterator</a>;
- typedef <i>implementation-defined</i> <a href=
-"circular_buffer.html#classboost_1_1circular__buffer_11b8a33f2dc8519b8a7d344ed4408c532">iterator</a>;
- typedef boost::reverse_iterator<const_iterator> <a href=
-"circular_buffer.html#classboost_1_1circular__buffer_1c7317701b511bc5f7a663b06b53e2b73">const_reverse_iterator</a>;
- typedef boost::reverse_iterator<iterator> <a href=
-"circular_buffer.html#classboost_1_1circular__buffer_1002fb890dded89e75dfeb6f021fb58a5">reverse_iterator</a>;
- typedef std::pair<pointer, size_type> <a href=
-"circular_buffer.html#classboost_1_1circular__buffer_126d279f91fef717e25459a0817ff242f">array_range</a>;
- typedef std::pair<const_pointer, size_type> <a href=
-"circular_buffer.html#classboost_1_1circular__buffer_11885d7f475b7e7a74c95b2448d243025">const_array_range</a>;
- typedef <i>implementation-defined</i> <a href=
-"#classboost_1_1circular__buffer__space__optimized_1051350e031c50c8b4a7ca1e1902e92f0">capacity_type</a>;
-
- explicit <a href=
-"#classboost_1_1circular__buffer__space__optimized_1a05f824b31cd93d7695f4039edc7597f">circular_buffer_space_optimized</a>(const allocator_type& alloc = allocator_type());
- explicit <a href=
-"#classboost_1_1circular__buffer__space__optimized_1741159a0511a4e0fed6eaab6d6959fa7">circular_buffer_space_optimized</a>(capacity_type capacity_ctrl, const allocator_type& alloc = allocator_type());
- <a href=
-"#classboost_1_1circular__buffer__space__optimized_1f8c9fa872f9a84d454d7e245cc2eadbd">circular_buffer_space_optimized</a>(capacity_type capacity_ctrl, const_reference item, const allocator_type& alloc = allocator_type());
- <a href=
-"#classboost_1_1circular__buffer__space__optimized_1d29ce80b10d4a3250fedeb9427210d96">circular_buffer_space_optimized</a>(capacity_type capacity_ctrl, size_type n, const_reference item, const allocator_type& alloc = allocator_type());
- <a href=
-"#classboost_1_1circular__buffer__space__optimized_1d9f273c1a794f84484d220e977a3e24b">circular_buffer_space_optimized</a>(const circular_buffer_space_optimized<T, Alloc>& cb);
- template <class InputIterator>
- <a href=
-"#classboost_1_1circular__buffer__space__optimized_11dd04145492c82a959b1df1167b4e217">circular_buffer_space_optimized</a>(InputIterator first, InputIterator last, const allocator_type& alloc = allocator_type());
- template <class InputIterator>
- <a href=
-"#classboost_1_1circular__buffer__space__optimized_196c63e0ecd56f6f1ac87bc79d2fd5b9f">circular_buffer_space_optimized</a>(capacity_type capacity_ctrl, InputIterator first, InputIterator last, const allocator_type& alloc = allocator_type());
- <a href=
-"#classboost_1_1circular__buffer__space__optimized_16839c3ea656ff0f800e38096748fe8ac">~circular_buffer_space_optimized</a>();
-
- allocator_type <a href=
-"circular_buffer.html#classboost_1_1circular__buffer_1a20b7d0e7a4da0af13286df9f53d660c">get_allocator</a>() const;
- allocator_type& <a href=
-"circular_buffer.html#classboost_1_1circular__buffer_1af7758a36ac2f84a3024b50b4fc7e098">get_allocator</a>();
- iterator <a href=
-"circular_buffer.html#classboost_1_1circular__buffer_158d1ede2e85f5d46eda8db3f0c4efef0">begin</a>();
- iterator end();
- const_iterator <a href=
-"circular_buffer.html#classboost_1_1circular__buffer_10640d3d41c13b6089b6f169224cf1038">begin</a>() const;
- const_iterator <a href=
-"circular_buffer.html#classboost_1_1circular__buffer_17890810d07bc595cfb87f9c47cb075ac">end</a>() const;
- reverse_iterator <a href=
-"circular_buffer.html#classboost_1_1circular__buffer_1db3d6b10b6763549f54d2627228fa7aa">rbegin</a>();
- reverse_iterator <a href=
-"circular_buffer.html#classboost_1_1circular__buffer_1cff9236a50107188b8942847a4dc2697">rend</a>();
- const_reverse_iterator <a href=
-"circular_buffer.html#classboost_1_1circular__buffer_1765d91bf48341907418433a1e3aab026">rbegin</a>() const;
- const_reverse_iterator <a href=
-"circular_buffer.html#classboost_1_1circular__buffer_108dbf538b00a14daf5582ece80746fc3">rend</a>() const;
- reference <a href=
-"circular_buffer.html#classboost_1_1circular__buffer_1d219f0d3203fb43b964a8cf63f1865cd">operator[]</a>(size_type index);
- const_reference <a href=
-"circular_buffer.html#classboost_1_1circular__buffer_1eb0a7fe7f8a56a4dc4c933b93adfcef4">operator[]</a>(size_type index) const;
- reference <a href=
-"circular_buffer.html#classboost_1_1circular__buffer_1cd84838cb4fffb6c113fd0297e502edc">at</a>(size_type index);
- const_reference <a href=
-"circular_buffer.html#classboost_1_1circular__buffer_1b233a298f5845a0fcf2ecc56f4170810">at</a>(size_type index) const;
- reference <a href=
-"circular_buffer.html#classboost_1_1circular__buffer_10d5fdeabeb352f47d1f7bb1ea8d9819f">front</a>();
- reference <a href=
-"circular_buffer.html#classboost_1_1circular__buffer_1d985d974020f88bb4255d8edbae0a30a">back</a>();
- const_reference <a href=
-"circular_buffer.html#classboost_1_1circular__buffer_10df8595d83bb9d8a7ce50aabc678f90b">front</a>() const;
- const_reference <a href=
-"circular_buffer.html#classboost_1_1circular__buffer_1027201797868c6274feb6712f670a132">back</a>() const;
- array_range <a href=
-"circular_buffer.html#classboost_1_1circular__buffer_1957cccdcb0c4ef7d80a34a990065818d">array_one</a>();
- array_range <a href=
-"circular_buffer.html#classboost_1_1circular__buffer_1f5081a54afbc2dfc1a7fb20329df7d5b">array_two</a>();
- const_array_range <a href=
-"circular_buffer.html#classboost_1_1circular__buffer_10f4b157e27b1170a571417986b239945">array_one</a>() const;
- const_array_range <a href=
-"circular_buffer.html#classboost_1_1circular__buffer_1bb8eb0f298ad2012c55c5303e1f174d5">array_two</a>() const;
- pointer <a href=
-"circular_buffer.html#classboost_1_1circular__buffer_1ea728bf57f91aa8946eddf76ce816a4e">linearize</a>();
- bool <a href=
-"circular_buffer.html#classboost_1_1circular__buffer_120f64448dc0723cc68c1096f6b00bc0a">is_linearized</a>() const;
- void <a href=
-"circular_buffer.html#classboost_1_1circular__buffer_1c591bb9e271b10b5240afcff3bd2c619">rotate</a>(const_iterator new_begin);
- size_type <a href=
-"circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size</a>() const;
- size_type <a href=
-"circular_buffer.html#classboost_1_1circular__buffer_157e2d506bc274b2a63fbe1b8fcafebd7">max_size</a>() const;
- bool <a href=
-"circular_buffer.html#classboost_1_1circular__buffer_15be1c2a005ec9828549ef6dd7ebed583">empty</a>() const;
- bool full() const;
- size_type <a href=
-"#classboost_1_1circular__buffer__space__optimized_170eec72a6e8d088b58e26ac7e2dd7c9f">reserve</a>() const;
- const capacity_type& <a href=
-"#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity</a>() const;
- void <a href=
-"#classboost_1_1circular__buffer__space__optimized_149f28bc5b33d2062b9f6a33b48264e3f">set_capacity</a>(const capacity_type& capacity_ctrl);
- void <a href=
-"#classboost_1_1circular__buffer__space__optimized_1f244ff5576b79f8d60e273c02d71c9f2">resize</a>(size_type new_size, const_reference item = value_type());
- void <a href=
-"#classboost_1_1circular__buffer__space__optimized_10f096c108ebde69ae83a9de41b3bea56">rset_capacity</a>(const capacity_type& capacity_ctrl);
- void <a href=
-"#classboost_1_1circular__buffer__space__optimized_1d45e2e72d9e3fb42e090ebc47ac8d7ee">rresize</a>(size_type new_size, const_reference item = value_type());
- circular_buffer_space_optimized<T, Alloc>& <a href=
-"#classboost_1_1circular__buffer__space__optimized_177e35432c5e69b7a16ef7d937950e7a8">operator=</a>(const circular_buffer_space_optimized<T, Alloc>& cb);
- void <a href=
-"#classboost_1_1circular__buffer__space__optimized_17ca4fda9526d0dad99706763c3b2d9f1">assign</a>(size_type n, const_reference item);
- void <a href=
-"#classboost_1_1circular__buffer__space__optimized_1108055ae3f6b1635e1428b0455902cbf">assign</a>(capacity_type capacity_ctrl, size_type n, const_reference item);
- template <class InputIterator>
- void <a href=
-"#classboost_1_1circular__buffer__space__optimized_1417de2c2419c44d83a92c463762df5fb">assign</a>(InputIterator first, InputIterator last);
- template <class InputIterator>
- void <a href=
-"#classboost_1_1circular__buffer__space__optimized_1e9347091d2d644854af0821d4b46869b">assign</a>(capacity_type capacity_ctrl, InputIterator first, InputIterator last);
- void <a href=
-"#classboost_1_1circular__buffer__space__optimized_14fd3b613f754d529ca250f2563b2f863">swap</a>(circular_buffer_space_optimized<T, Alloc>& cb);
- void <a href=
-"#classboost_1_1circular__buffer__space__optimized_1cf3ffed54f5fece9315fb96726e5e205">push_back</a>(const_reference item = value_type());
- void <a href=
-"#classboost_1_1circular__buffer__space__optimized_1f0484fd492b377ff80c0bcb76183162c">push_front</a>(const_reference item = value_type());
- void pop_back();
- void pop_front();
- iterator <a href=
-"#classboost_1_1circular__buffer__space__optimized_145877a0d46400f4894a13d25d138c130">insert</a>(iterator pos, const_reference item = value_type());
- void <a href=
-"#classboost_1_1circular__buffer__space__optimized_1dc2060ce1105d80429ff3f004ca0691b">insert</a>(iterator pos, size_type n, const_reference item);
- template <class InputIterator>
- void <a href=
-"#classboost_1_1circular__buffer__space__optimized_19eec983bc010f2e8415618455dd81da0">insert</a>(iterator pos, InputIterator first, InputIterator last);
- iterator <a href=
-"#classboost_1_1circular__buffer__space__optimized_1cb3586429e49eeb2df2d2a09e19775de">rinsert</a>(iterator pos, const_reference item = value_type());
- void <a href=
-"#classboost_1_1circular__buffer__space__optimized_11eff7ec0eb603d489bd12f8c48928c9d">rinsert</a>(iterator pos, size_type n, const_reference item);
- template <class InputIterator>
- void <a href=
-"#classboost_1_1circular__buffer__space__optimized_1faeda7342f4717d7fb6b4589cb43b74e">rinsert</a>(iterator pos, InputIterator first, InputIterator last);
- iterator <a href=
-"#classboost_1_1circular__buffer__space__optimized_136feadef225bd8a10962a92c4ffcdfd3">erase</a>(iterator pos);
- iterator <a href=
-"#classboost_1_1circular__buffer__space__optimized_19e9a4e0dfca27329da78e014d97201ca">erase</a>(iterator first, iterator last);
- iterator <a href=
-"#classboost_1_1circular__buffer__space__optimized_16e96800422211d02621526c894b71fa1">rerase</a>(iterator pos);
- iterator <a href=
-"#classboost_1_1circular__buffer__space__optimized_154fd4c2a67c7d6de6cbf6c8255729e98">rerase</a>(iterator first, iterator last);
- void clear();
-};
-
-template <class T, class Alloc>
- bool <a href=
-"circular_buffer.html#namespaceboost_1d35871e838359b5215e1cbb353663207">operator==</a>(const circular_buffer_space_optimized<T, Alloc>& lhs, const circular_buffer_space_optimized<T, Alloc>& rhs);
-template <class T, class Alloc>
- bool <a href=
-"circular_buffer.html#namespaceboost_195b08213f201c2067d8acb024756329d">operator<</a>(const circular_buffer_space_optimized<T, Alloc>& lhs, const circular_buffer_space_optimized<T, Alloc>& rhs);
-template <class T, class Alloc>
- bool <a href=
-"circular_buffer.html#namespaceboost_1f5717e2f6532581a6492ff1839b18f6d">operator!=</a>(const circular_buffer_space_optimized<T, Alloc>& lhs, const circular_buffer_space_optimized<T, Alloc>& rhs);
-template <class T, class Alloc>
- bool <a href=
-"circular_buffer.html#namespaceboost_1f575d7a9741c2044424de50c966c12f3">operator></a>(const circular_buffer_space_optimized<T, Alloc>& lhs, const circular_buffer_space_optimized<T, Alloc>& rhs);
-template <class T, class Alloc>
- bool <a href=
-"circular_buffer.html#namespaceboost_179abcbacd24b67f08185db54aec8600d">operator<=</a>(const circular_buffer_space_optimized<T, Alloc>& lhs, const circular_buffer_space_optimized<T, Alloc>& rhs);
-template <class T, class Alloc>
- bool <a href=
-"circular_buffer.html#namespaceboost_11c31150380272af67deebef578c80b05">operator>=</a>(const circular_buffer_space_optimized<T, Alloc>& lhs, const circular_buffer_space_optimized<T, Alloc>& rhs);
-template <class T, class Alloc>
- void <a href=
-"circular_buffer.html#namespaceboost_14aa8f6a2c9640f3f22e266f0fca85777">swap</a>(circular_buffer_space_optimized<T, Alloc>& lhs, circular_buffer_space_optimized<T, Alloc>& rhs);
-
-} // namespace boost
-</pre>
- </td>
- </tr>
- </table>
- </div>
- <h2>
- <a name="rationale" id="rationale">Rationale</a>
- </h2>
- <p>
- The auto-resizing mode of the space optimized circular buffer can be useful in situations when the container can
- possibly store large number of elements but most of its lifetime the container stores just few of them. The usage
- of the <code>circular_buffer_space_optimized</code> will result in decreased memory consumption and can improve
- the CPU cache effectiveness.
- </p>
- <h2>
- <a name="header" id="header">Header Files</a>
- </h2>
- <p>
- The <code>circular_buffer_space_optimized</code> is defined in the file <code><a href=
- "../../../boost/circular_buffer.hpp">boost/circular_buffer.hpp</a></code>. There is also a forward declaration
- for the <code>circular_buffer_space_optimized</code> in the header file <code><a href=
- "../../../boost/circular_buffer_fwd.hpp">boost/circular_buffer_fwd.hpp</a></code>.
- </p>
- <h2>
- <a name="model" id="model">Modelled concepts</a>
- </h2>
- <p>
- Random Access Container, <a href=
- "http://www.sgi.com/tech/stl/FrontInsertionSequence.html">Front Insertion Sequence</a> and <a href=
- "http://www.sgi.com/tech/stl/BackInsertionSequence.html">Back Insertion Sequence</a>.
- </p>
- <h2>
- <a name="types" id="types">Specific Public Types</a>
- </h2>
- <p>
- Following public types are specific to the <code>circular_buffer_space_optimized</code>. Description of the
- public types common with the <code>circular_buffer</code> can be found in the <code>circular_buffer</code>'s
- documentation.
- </p>
- <div id="srcdoc_types">
- <table id="table_public_types" border="1" cellpadding="3">
- <tr>
- <th>
- Type
- </th>
- <th>
- Description
- </th>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer__space__optimized_1051350e031c50c8b4a7ca1e1902e92f0" name=
- "classboost_1_1circular__buffer__space__optimized_1051350e031c50c8b4a7ca1e1902e92f0"><code>capacity_type</code></a>
- </td>
- <td>
- Capacity controller of the space optimized circular buffer.
- <pre>
-class capacity_control {
- size_type m_capacity;
- size_type m_min_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; }
-};
-</pre>
- <dl>
- <dt>
- <b>Precondition:</b>
- </dt>
- <dd>
- <code>capacity >= min_capacity</code>
- </dd>
- </dl>The <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a></code>
- represents the capacity of the <code>circular_buffer_space_optimized</code> and the
- <code>min_capacity()</code> determines the minimal allocated size of its internal buffer. The converting
- constructor of the <code>capacity_control</code> allows implicit conversion from
- <code>size_type</code>-like types which ensures compatibility of creating an instance of the
- <code>circular_buffer_space_optimized</code> with other STL containers. On the other hand the operator
- <code>size_type()</code> provides implicit conversion to the <code>size_type</code> which allows to treat
- the capacity of the <code>circular_buffer_space_optimized</code> the same way as in the <code><a href=
- "circular_buffer.html">circular_buffer</a></code>.
- </td>
- </tr>
- </table>
- </div>
- <h2>
- <a name="constructors" id="constructors">Constructors and Destructor</a>
- </h2>
- <div id="srcdoc_constructors">
- <table id="table_constructors" border="1" cellpadding="3">
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer__space__optimized_1a05f824b31cd93d7695f4039edc7597f" name=
- "classboost_1_1circular__buffer__space__optimized_1a05f824b31cd93d7695f4039edc7597f"></a><code><b>explicit
- circular_buffer_space_optimized(const <a href=
- "circular_buffer.html#classboost_1_1circular__buffer_14e07c6ddfe89debe384e59bed06e7cb7">allocator_type</a>&
- alloc = allocator_type());</b></code><br>
- <br>
- Create an empty space optimized circular buffer with zero capacity.
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a>.capacity()
- == 0 && <a href=
- "#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a>.min_capacity()
- == 0 && <a href=
- "circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> ==
- 0</code>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>alloc</code>
- </dt>
- <dd>
- The allocator.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- Nothing.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Constant.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Warning:</b>
- </dt>
- <dd>
- Since Boost version 1.36 the behaviour of this constructor has changed. Now it creates a space
- optimized circular buffer with zero capacity.
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer__space__optimized_1741159a0511a4e0fed6eaab6d6959fa7" name=
- "classboost_1_1circular__buffer__space__optimized_1741159a0511a4e0fed6eaab6d6959fa7"></a><code><b>explicit
- circular_buffer_space_optimized(<a href=
- "#classboost_1_1circular__buffer__space__optimized_1051350e031c50c8b4a7ca1e1902e92f0">capacity_type</a>
- capacity_ctrl, const <a href=
- "circular_buffer.html#classboost_1_1circular__buffer_14e07c6ddfe89debe384e59bed06e7cb7">allocator_type</a>&
- alloc = allocator_type());</b></code><br>
- <br>
- Create an empty space optimized circular buffer with the specified capacity.
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a> ==
- capacity_ctrl && <a href=
- "circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> ==
- 0</code><br>
- <br>
- The amount of allocated memory in the internal buffer is <code>capacity_ctrl.min_capacity()</code>.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>capacity_ctrl</code>
- </dt>
- <dd>
- The capacity controller representing the maximum number of elements which can be stored in the
- <code>circular_buffer_space_optimized</code> and the minimal allocated size of the internal buffer.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>alloc</code>
- </dt>
- <dd>
- The allocator.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- An allocation error if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
- used).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Constant.
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer__space__optimized_1f8c9fa872f9a84d454d7e245cc2eadbd" name=
- "classboost_1_1circular__buffer__space__optimized_1f8c9fa872f9a84d454d7e245cc2eadbd"></a><code><b>circular_buffer_space_optimized(capacity_type
- capacity_ctrl, <a href=
- "circular_buffer.html#classboost_1_1circular__buffer_1a8397191092f5bacee991b623ca4b910">const_reference</a>
- item, const <a href=
- "circular_buffer.html#classboost_1_1circular__buffer_14e07c6ddfe89debe384e59bed06e7cb7">allocator_type</a>&
- alloc = allocator_type());</b></code><br>
- <br>
- Create a full space optimized circular buffer with the specified capacity filled with
- <code>capacity_ctrl.capacity()</code> copies of <code>item</code>.
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a> ==
- capacity_ctrl && <a href=
- "#classboost_1_1circular__buffer__space__optimized_142f4a13c50904a4ac0bf746c88451954">full()</a>
- && (*this)[0] == item && (*this)[1] == item && ... && (*this)
- [capacity_ctrl.capacity() - 1] == item</code><br>
- <br>
- The amount of allocated memory in the internal buffer is <code>capacity_ctrl.capacity()</code>.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>capacity_ctrl</code>
- </dt>
- <dd>
- The capacity controller representing the maximum number of elements which can be stored in the
- <code>circular_buffer_space_optimized</code> and the minimal allocated size of the internal buffer.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>item</code>
- </dt>
- <dd>
- The element the created <code>circular_buffer_space_optimized</code> will be filled with.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>alloc</code>
- </dt>
- <dd>
- The allocator.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- An allocation error if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
- used).
- </dd>
- <dd>
- Whatever <code>T::T(const T&)</code> throws.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Linear (in the <code>capacity_ctrl.capacity()</code>).
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer__space__optimized_1d29ce80b10d4a3250fedeb9427210d96" name=
- "classboost_1_1circular__buffer__space__optimized_1d29ce80b10d4a3250fedeb9427210d96"></a><code><b>circular_buffer_space_optimized(capacity_type
- capacity_ctrl, <a href=
- "circular_buffer.html#classboost_1_1circular__buffer_19ba12c0142a21a7d960877c22fa3ea00">size_type</a> n,
- <a href=
- "circular_buffer.html#classboost_1_1circular__buffer_1a8397191092f5bacee991b623ca4b910">const_reference</a>
- item, const <a href=
- "circular_buffer.html#classboost_1_1circular__buffer_14e07c6ddfe89debe384e59bed06e7cb7">allocator_type</a>&
- alloc = allocator_type());</b></code><br>
- <br>
- Create a space optimized circular buffer with the specified capacity filled with <code>n</code> copies of
- <code>item</code>.
- <dl>
- <dt>
- <b>Precondition:</b>
- </dt>
- <dd>
- <code>capacity_ctrl.capacity() >= n</code>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a> ==
- capacity_ctrl && <a href=
- "circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> == n
- && (*this)[0] == item && (*this)[1] == item && ... && (*this)[n - 1] ==
- item</code><br>
- <br>
- The amount of allocated memory in the internal buffer is <code>max[n,
- capacity_ctrl.min_capacity()]</code>.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>capacity_ctrl</code>
- </dt>
- <dd>
- The capacity controller representing the maximum number of elements which can be stored in the
- <code>circular_buffer_space_optimized</code> and the minimal allocated size of the internal buffer.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>n</code>
- </dt>
- <dd>
- The number of elements the created <code>circular_buffer_space_optimized</code> will be filled
- with.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>item</code>
- </dt>
- <dd>
- The element the created <code>circular_buffer_space_optimized</code> will be filled with.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>alloc</code>
- </dt>
- <dd>
- The allocator.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- An allocation error if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
- used).
- </dd>
- <dd>
- Whatever <code>T::T(const T&)</code> throws.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Linear (in the <code>n</code>).
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer__space__optimized_1d9f273c1a794f84484d220e977a3e24b" name=
- "classboost_1_1circular__buffer__space__optimized_1d9f273c1a794f84484d220e977a3e24b"></a><code><b>circular_buffer_space_optimized(const
- circular_buffer_space_optimized<T,Alloc>& cb);</b></code><br>
- <br>
- The copy constructor.
- <p>
- Creates a copy of the specified <code>circular_buffer_space_optimized</code>.
- </p>
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- <code>*this == cb</code><br>
- <br>
- The amount of allocated memory in the internal buffer is <code>cb.size()</code>.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>cb</code>
- </dt>
- <dd>
- The <code>circular_buffer_space_optimized</code> to be copied.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- An allocation error if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
- used).
- </dd>
- <dd>
- Whatever <code>T::T(const T&)</code> throws.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Linear (in the size of <code>cb</code>).
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer__space__optimized_11dd04145492c82a959b1df1167b4e217" name=
- "classboost_1_1circular__buffer__space__optimized_11dd04145492c82a959b1df1167b4e217"></a> <code><b>template
- <class InputIterator><br>
- circular_buffer_space_optimized(InputIterator first, InputIterator last, const <a href=
- "circular_buffer.html#classboost_1_1circular__buffer_14e07c6ddfe89debe384e59bed06e7cb7">allocator_type</a>&
- alloc = allocator_type());</b></code><br>
- <br>
- Create a full space optimized circular buffer filled with a copy of the range.
- <dl>
- <dt>
- <b>Precondition:</b>
- </dt>
- <dd>
- Valid range <code>[first, last)</code>.<br>
- <code>first</code> and <code>last</code> have to meet the requirements of <a href=
- "http://www.sgi.com/tech/stl/InputIterator.html">InputIterator</a>.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a>.capacity()
- == std::distance(first, last) && <a href=
- "#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a>.min_capacity()
- == 0 && <a href=
- "#classboost_1_1circular__buffer__space__optimized_142f4a13c50904a4ac0bf746c88451954">full()</a>
- && (*this)[0]== *first && (*this)[1] == *(first + 1) && ... &&
- (*this)[std::distance(first, last) - 1] == *(last - 1)</code><br>
- <br>
- The amount of allocated memory in the internal buffer is <code>std::distance(first, last)</code>.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>first</code>
- </dt>
- <dd>
- The beginning of the range to be copied.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>last</code>
- </dt>
- <dd>
- The end of the range to be copied.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>alloc</code>
- </dt>
- <dd>
- The allocator.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- An allocation error if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
- used).
- </dd>
- <dd>
- Whatever <code>T::T(const T&)</code> throws.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Linear (in the <code>std::distance(first, last)</code>).
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer__space__optimized_196c63e0ecd56f6f1ac87bc79d2fd5b9f" name=
- "classboost_1_1circular__buffer__space__optimized_196c63e0ecd56f6f1ac87bc79d2fd5b9f"></a> <code><b>template
- <class InputIterator><br>
- circular_buffer_space_optimized(<a href=
- "#classboost_1_1circular__buffer__space__optimized_1051350e031c50c8b4a7ca1e1902e92f0">capacity_type</a>
- capacity_ctrl, InputIterator first, InputIterator last, const <a href=
- "circular_buffer.html#classboost_1_1circular__buffer_14e07c6ddfe89debe384e59bed06e7cb7">allocator_type</a>&
- alloc = allocator_type());</b></code><br>
- <br>
- 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.
- <dl>
- <dt>
- <b>Precondition:</b>
- </dt>
- <dd>
- Valid range <code>[first, last)</code>.<br>
- <code>first</code> and <code>last</code> have to meet the requirements of <a href=
- "http://www.sgi.com/tech/stl/InputIterator.html">InputIterator</a>.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a> ==
- capacity_ctrl && <a href=
- "circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a>
- <= std::distance(first, last) && (*this)[0]== (last - capacity_ctrl.capacity()) &&
- (*this)[1] == *(last - capacity_ctrl.capacity() + 1) && ... &&
- (*this)[capacity_ctrl.capacity() - 1] == *(last - 1)</code><br>
- <br>
- If the number of items to be copied from the range <code>[first, last)</code> is greater than the
- specified <code>capacity_ctrl.capacity()</code> then only elements from the range <code>[last -
- capacity_ctrl.capacity(), last)</code> will be copied.<br>
- <br>
- The amount of allocated memory in the internal buffer is <code>max[capacity_ctrl.min_capacity(),
- min[capacity_ctrl.capacity(), std::distance(first, last)]]</code>.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>capacity_ctrl</code>
- </dt>
- <dd>
- The capacity controller representing the maximum number of elements which can be stored in the
- <code>circular_buffer_space_optimized</code> and the minimal allocated size of the internal buffer.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>first</code>
- </dt>
- <dd>
- The beginning of the range to be copied.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>last</code>
- </dt>
- <dd>
- The end of the range to be copied.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>alloc</code>
- </dt>
- <dd>
- The allocator.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- An allocation error if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
- used).
- </dd>
- <dd>
- Whatever <code>T::T(const T&)</code> throws.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Linear (in <code>std::distance(first, last)</code>; in <code>min[capacity_ctrl.capacity(),
- std::distance(first, last)]</code> if the <code>InputIterator</code> is a <a href=
- "http://www.sgi.com/tech/stl/RandomAccessIterator.html">RandomAccessIterator</a>).
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer__space__optimized_16839c3ea656ff0f800e38096748fe8ac" name=
- "classboost_1_1circular__buffer__space__optimized_16839c3ea656ff0f800e38096748fe8ac"></a><code><b>~circular_buffer_space_optimized();</b></code><br>
-
- <br>
- The destructor.
- <p>
- Destroys the <code>circular_buffer_space_optimized</code>.
- </p>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- Nothing.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Invalidates all iterators pointing to the <code>circular_buffer_space_optimized</code> (including
- iterators equal to <code><a href=
- "circular_buffer.html#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a></code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Linear (in the size of the <code>circular_buffer_space_optimized</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_12aa1dd29bd9509b5482ca2666c61deab">clear()</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- </table>
- </div>
- <h2>
- <a name="methods" id="methods">Specific Public Member Functions</a>
- </h2>
- <p>
- Following public member functions of the <code>circular_buffer_space_optimized</code> have different behaviour
- from the base <code>circular_buffer</code>. Description of the public member functions with the same behaviour
- can be found in the <code>circular_buffer</code>'s documentation.
- </p>
- <div id="srcdoc_methods">
- <table id="table_methods" border="1" cellpadding="3">
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer__space__optimized_142f4a13c50904a4ac0bf746c88451954" name=
- "classboost_1_1circular__buffer__space__optimized_142f4a13c50904a4ac0bf746c88451954"></a><code><b>bool
- full() const;</b></code><br>
- <br>
- Is the <code>circular_buffer_space_optimized</code> full?
- <dl>
- <dt>
- <b>Returns:</b>
- </dt>
- <dd>
- <code>true</code> if the number of elements stored in the <code>circular_buffer_space_optimized</code>
- equals the capacity of the <code>circular_buffer_space_optimized</code>; <code>false</code> otherwise.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- Nothing.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- No-throw.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Does not invalidate any iterators.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Constant (in the size of the <code>circular_buffer_space_optimized</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href=
- "circular_buffer.html#classboost_1_1circular__buffer_15be1c2a005ec9828549ef6dd7ebed583">empty()</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer__space__optimized_170eec72a6e8d088b58e26ac7e2dd7c9f" name=
- "classboost_1_1circular__buffer__space__optimized_170eec72a6e8d088b58e26ac7e2dd7c9f"></a><code><b><a href=
- "circular_buffer.html#classboost_1_1circular__buffer_19ba12c0142a21a7d960877c22fa3ea00">size_type</a>
- reserve() const;</b></code><br>
- <br>
- Get the maximum number of elements which can be inserted into the
- <code>circular_buffer_space_optimized</code> without overwriting any of already stored elements.
- <dl>
- <dt>
- <b>Returns:</b>
- </dt>
- <dd>
- <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a>.capacity()
- - <a href=
- "circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a></code>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- Nothing.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- No-throw.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Does not invalidate any iterators.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Constant (in the size of the <code>circular_buffer_space_optimized</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a></code>,
- <code><a href=
- "circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a></code>,
- <code><a href=
- "circular_buffer.html#classboost_1_1circular__buffer_157e2d506bc274b2a63fbe1b8fcafebd7">max_size()</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa" name=
- "classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa"></a><code><b>const
- <a href=
- "#classboost_1_1circular__buffer__space__optimized_1051350e031c50c8b4a7ca1e1902e92f0">capacity_type</a>&
- capacity() const;</b></code><br>
- <br>
- Get the capacity of the <code>circular_buffer_space_optimized</code>.
- <dl>
- <dt>
- <b>Returns:</b>
- </dt>
- <dd>
- The capacity controller representing the maximum number of elements which can be stored in the
- <code>circular_buffer_space_optimized</code> and the minimal allocated size of the internal buffer.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- Nothing.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- No-throw.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Does not invalidate any iterators.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Constant (in the size of the <code>circular_buffer_space_optimized</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_170eec72a6e8d088b58e26ac7e2dd7c9f">reserve()</a></code>,
- <code><a href=
- "circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a></code>,
- <code><a href=
- "circular_buffer.html#classboost_1_1circular__buffer_157e2d506bc274b2a63fbe1b8fcafebd7">max_size()</a></code>,
- <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_149f28bc5b33d2062b9f6a33b48264e3f">set_capacity(const
- capacity_type&)</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer__space__optimized_149f28bc5b33d2062b9f6a33b48264e3f" name=
- "classboost_1_1circular__buffer__space__optimized_149f28bc5b33d2062b9f6a33b48264e3f"></a><code><b>void
- set_capacity(const <a href=
- "#classboost_1_1circular__buffer__space__optimized_1051350e031c50c8b4a7ca1e1902e92f0">capacity_type</a>&
- capacity_ctrl);</b></code><br>
- <br>
- Change the capacity (and the minimal guaranteed amount of allocated memory) of the
- <code>circular_buffer_space_optimized</code>.
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a> ==
- capacity_ctrl && <a href=
- "circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a>
- <= capacity_ctrl.capacity()</code><br>
- <br>
- If the current number of elements stored in the <code>circular_buffer_space_optimized</code> is greater
- than the desired new capacity then number of <code>[<a href=
- "circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> -
- capacity_ctrl.capacity()]</code> <b>last</b> elements will be removed and the new size will be equal to
- <code>capacity_ctrl.capacity()</code>.<br>
- <br>
- If the current number of elements stored in the <code>circular_buffer_space_optimized</code> 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 <code>capacity_ctrl.min_capacity()</code>.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>capacity_ctrl</code>
- </dt>
- <dd>
- The new capacity controller.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- An allocation error if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
- used).
- </dd>
- <dd>
- Whatever <code>T::T(const T&)</code> throws.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- Strong.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Invalidates all iterators pointing to the <code>circular_buffer_space_optimized</code> (except
- iterators equal to <code><a href=
- "circular_buffer.html#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a></code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Linear (in <code>min[<a href=
- "circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a>,
- capacity_ctrl.capacity()]</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Note:</b>
- </dt>
- <dd>
- To explicitly clear the extra allocated memory use the <b>shrink-to-fit</b> technique:<br>
- <br>
- <code>boost::circular_buffer_space_optimized<int> cb(1000);<br>
- ...<br>
- boost::circular_buffer_space_optimized<int>(cb).swap(cb);</code><br>
- <br>
- For more information about the shrink-to-fit technique in STL see <a href=
- "http://www.gotw.ca/gotw/054.htm">http://www.gotw.ca/gotw/054.htm>.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_10f096c108ebde69ae83a9de41b3bea56">rset_capacity(const
- capacity_type&)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_1f244ff5576b79f8d60e273c02d71c9f2">resize(size_type,
- const_reference)</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer__space__optimized_1f244ff5576b79f8d60e273c02d71c9f2" name=
- "classboost_1_1circular__buffer__space__optimized_1f244ff5576b79f8d60e273c02d71c9f2"></a><code><b>void
- resize(<a href=
- "circular_buffer.html#classboost_1_1circular__buffer_19ba12c0142a21a7d960877c22fa3ea00">size_type</a>
- new_size, <a href=
- "circular_buffer.html#classboost_1_1circular__buffer_1a8397191092f5bacee991b623ca4b910">const_reference</a>
- item = value_type());</b></code><br>
- <br>
- Change the size of the <code>circular_buffer_space_optimized</code>.
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- <code><a href=
- "circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> ==
- new_size && <a href=
- "#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a>.capacity()
- >= new_size</code><br>
- <br>
- If the new size is greater than the current size, copies of <code>item</code> will be inserted at the
- <b>back</b> of the of the <code>circular_buffer_space_optimized</code> in order to achieve the desired
- size. In the case the resulting size exceeds the current capacity the capacity will be set to
- <code>new_size</code>.<br>
- <br>
- If the current number of elements stored in the <code>circular_buffer_space_optimized</code> is greater
- than the desired new size then number of <code>[<a href=
- "circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> -
- new_size]</code> <b>last</b> elements will be removed. (The capacity will remain unchanged.)<br>
- <br>
- The amount of allocated memory in the internal buffer may be accommodated as necessary.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>new_size</code>
- </dt>
- <dd>
- The new size.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>item</code>
- </dt>
- <dd>
- The element the <code>circular_buffer_space_optimized</code> will be filled with in order to gain
- the requested size. (See the <i>Effect</i>.)
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- An allocation error if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
- used).
- </dd>
- <dd>
- Whatever <code>T::T(const T&)</code> throws.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- Basic.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Invalidates all iterators pointing to the <code>circular_buffer_space_optimized</code> (except
- iterators equal to <code><a href=
- "circular_buffer.html#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a></code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Linear (in the new size of the <code>circular_buffer_space_optimized</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_1d45e2e72d9e3fb42e090ebc47ac8d7ee">rresize(size_type,
- const_reference)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_149f28bc5b33d2062b9f6a33b48264e3f">set_capacity(const
- capacity_type&)</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer__space__optimized_10f096c108ebde69ae83a9de41b3bea56" name=
- "classboost_1_1circular__buffer__space__optimized_10f096c108ebde69ae83a9de41b3bea56"></a><code><b>void
- rset_capacity(const <a href=
- "#classboost_1_1circular__buffer__space__optimized_1051350e031c50c8b4a7ca1e1902e92f0">capacity_type</a>&
- capacity_ctrl);</b></code><br>
- <br>
- Change the capacity (and the minimal guaranteed amount of allocated memory) of the
- <code>circular_buffer_space_optimized</code>.
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a> ==
- capacity_ctrl && <a href=
- "circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a>
- <= capacity_ctrl</code><br>
- <br>
- If the current number of elements stored in the <code>circular_buffer_space_optimized</code> is greater
- than the desired new capacity then number of <code>[<a href=
- "circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> -
- capacity_ctrl.capacity()]</code> <b>first</b> elements will be removed and the new size will be equal
- to <code>capacity_ctrl.capacity()</code>.<br>
- <br>
- If the current number of elements stored in the <code>circular_buffer_space_optimized</code> 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 <code>capacity_ctrl.min_capacity()</code>.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>capacity_ctrl</code>
- </dt>
- <dd>
- The new capacity controller.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- An allocation error if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
- used).
- </dd>
- <dd>
- Whatever <code>T::T(const T&)</code> throws.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- Strong.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Invalidates all iterators pointing to the <code>circular_buffer_space_optimized</code> (except
- iterators equal to <code><a href=
- "circular_buffer.html#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a></code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Linear (in <code>min[<a href=
- "circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a>,
- capacity_ctrl.capacity()]</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_149f28bc5b33d2062b9f6a33b48264e3f">set_capacity(const
- capacity_type&)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_1d45e2e72d9e3fb42e090ebc47ac8d7ee">rresize(size_type,
- const_reference)</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer__space__optimized_1d45e2e72d9e3fb42e090ebc47ac8d7ee" name=
- "classboost_1_1circular__buffer__space__optimized_1d45e2e72d9e3fb42e090ebc47ac8d7ee"></a><code><b>void
- rresize(<a href=
- "circular_buffer.html#classboost_1_1circular__buffer_19ba12c0142a21a7d960877c22fa3ea00">size_type</a>
- new_size, <a href=
- "circular_buffer.html#classboost_1_1circular__buffer_1a8397191092f5bacee991b623ca4b910">const_reference</a>
- item = value_type());</b></code><br>
- <br>
- Change the size of the <code>circular_buffer_space_optimized</code>.
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- <code><a href=
- "circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> ==
- new_size && <a href=
- "#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a>.capacity()
- >= new_size</code><br>
- <br>
- If the new size is greater than the current size, copies of <code>item</code> will be inserted at the
- <b>front</b> of the of the <code>circular_buffer_space_optimized</code> in order to achieve the desired
- size. In the case the resulting size exceeds the current capacity the capacity will be set to
- <code>new_size</code>.<br>
- <br>
- If the current number of elements stored in the <code>circular_buffer_space_optimized</code> is greater
- than the desired new size then number of <code>[<a href=
- "circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> -
- new_size]</code> <b>first</b> elements will be removed. (The capacity will remain unchanged.)<br>
- <br>
- The amount of allocated memory in the internal buffer may be accommodated as necessary.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>new_size</code>
- </dt>
- <dd>
- The new size.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>item</code>
- </dt>
- <dd>
- The element the <code>circular_buffer_space_optimized</code> will be filled with in order to gain
- the requested size. (See the <i>Effect</i>.)
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- An allocation error if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
- used).
- </dd>
- <dd>
- Whatever <code>T::T(const T&)</code> throws.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- Basic.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Invalidates all iterators pointing to the <code>circular_buffer_space_optimized</code> (except
- iterators equal to <code><a href=
- "circular_buffer.html#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a></code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Linear (in the new size of the <code>circular_buffer_space_optimized</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_1f244ff5576b79f8d60e273c02d71c9f2">resize(size_type,
- const_reference)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_10f096c108ebde69ae83a9de41b3bea56">rset_capacity(const
- capacity_type&)</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer__space__optimized_177e35432c5e69b7a16ef7d937950e7a8" name=
- "classboost_1_1circular__buffer__space__optimized_177e35432c5e69b7a16ef7d937950e7a8"></a><code><b>circular_buffer_space_optimized<T,Alloc>&
- operator=(const circular_buffer_space_optimized<T,Alloc>& cb);</b></code><br>
- <br>
- The assign operator.
- <p>
- Makes this <code>circular_buffer_space_optimized</code> to become a copy of the specified
- <code>circular_buffer_space_optimized</code>.
- </p>
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- <code>*this == cb</code><br>
- <br>
- The amount of allocated memory in the internal buffer is <code>cb.size()</code>.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>cb</code>
- </dt>
- <dd>
- The <code>circular_buffer_space_optimized</code> to be copied.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- An allocation error if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
- used).
- </dd>
- <dd>
- Whatever <code>T::T(const T&)</code> throws.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- Strong.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Invalidates all iterators pointing to this <code>circular_buffer_space_optimized</code> (except
- iterators equal to <code><a href=
- "circular_buffer.html#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a></code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Linear (in the size of <code>cb</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_17ca4fda9526d0dad99706763c3b2d9f1">assign(size_type,
- const_reference)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_1108055ae3f6b1635e1428b0455902cbf">assign(capacity_type,
- size_type, const_reference)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_1417de2c2419c44d83a92c463762df5fb">assign(InputIterator,
- InputIterator)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_1e9347091d2d644854af0821d4b46869b">assign(capacity_type,
- InputIterator, InputIterator)</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer__space__optimized_17ca4fda9526d0dad99706763c3b2d9f1" name=
- "classboost_1_1circular__buffer__space__optimized_17ca4fda9526d0dad99706763c3b2d9f1"></a><code><b>void
- assign(<a href=
- "circular_buffer.html#classboost_1_1circular__buffer_19ba12c0142a21a7d960877c22fa3ea00">size_type</a> n,
- <a href=
- "circular_buffer.html#classboost_1_1circular__buffer_1a8397191092f5bacee991b623ca4b910">const_reference</a>
- item);</b></code><br>
- <br>
- Assign <code>n</code> items into the space optimized circular buffer.
- <p>
- The content of the <code>circular_buffer_space_optimized</code> will be removed and replaced with
- <code>n</code> copies of the <code>item</code>.
- </p>
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a>.capacity()
- == n && <a href=
- "#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a>.min_capacity()
- == 0 && <a href=
- "circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> == n
- && (*this)[0] == item && (*this)[1] == item && ... && (*this) [n - 1]
- == item</code><br>
- <br>
- The amount of allocated memory in the internal buffer is <code>n</code>.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>n</code>
- </dt>
- <dd>
- The number of elements the <code>circular_buffer_space_optimized</code> will be filled with.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>item</code>
- </dt>
- <dd>
- The element the <code>circular_buffer_space_optimized</code> will be filled with.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- An allocation error if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
- used).
- </dd>
- <dd>
- Whatever <code>T::T(const T&)</code> throws.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- Basic.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Invalidates all iterators pointing to the <code>circular_buffer_space_optimized</code> (except
- iterators equal to <code><a href=
- "circular_buffer.html#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a></code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Linear (in the <code>n</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_177e35432c5e69b7a16ef7d937950e7a8">operator=</a></code>,
- <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_1108055ae3f6b1635e1428b0455902cbf">assign(capacity_type,
- size_type, const_reference)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_1417de2c2419c44d83a92c463762df5fb">assign(InputIterator,
- InputIterator)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_1e9347091d2d644854af0821d4b46869b">assign(capacity_type,
- InputIterator, InputIterator)</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer__space__optimized_1108055ae3f6b1635e1428b0455902cbf" name=
- "classboost_1_1circular__buffer__space__optimized_1108055ae3f6b1635e1428b0455902cbf"></a><code><b>void
- assign(<a href=
- "#classboost_1_1circular__buffer__space__optimized_1051350e031c50c8b4a7ca1e1902e92f0">capacity_type</a>
- capacity_ctrl, <a href=
- "circular_buffer.html#classboost_1_1circular__buffer_19ba12c0142a21a7d960877c22fa3ea00">size_type</a> n,
- <a href=
- "circular_buffer.html#classboost_1_1circular__buffer_1a8397191092f5bacee991b623ca4b910">const_reference</a>
- item);</b></code><br>
- <br>
- Assign <code>n</code> items into the space optimized circular buffer specifying the capacity.
- <p>
- The capacity of the <code>circular_buffer_space_optimized</code> will be set to the specified value and
- the content of the <code>circular_buffer_space_optimized</code> will be removed and replaced with
- <code>n</code> copies of the <code>item</code>.
- </p>
- <dl>
- <dt>
- <b>Precondition:</b>
- </dt>
- <dd>
- <code>capacity_ctrl.capacity() >= n</code>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a> ==
- capacity_ctrl && <a href=
- "circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> == n
- && (*this)[0] == item && (*this)[1] == item && ... && (*this) [n - 1]
- == item</code><br>
- <br>
- The amount of allocated memory will be <code>max[n, capacity_ctrl.min_capacity()]</code>.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>capacity_ctrl</code>
- </dt>
- <dd>
- The new capacity controller.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>n</code>
- </dt>
- <dd>
- The number of elements the <code>circular_buffer_space_optimized</code> will be filled with.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>item</code>
- </dt>
- <dd>
- The element the <code>circular_buffer_space_optimized</code> will be filled with.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- An allocation error if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
- used).
- </dd>
- <dd>
- Whatever <code>T::T(const T&)</code> throws.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- Basic.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Invalidates all iterators pointing to the <code>circular_buffer_space_optimized</code> (except
- iterators equal to <code><a href=
- "circular_buffer.html#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a></code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Linear (in the <code>n</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_177e35432c5e69b7a16ef7d937950e7a8">operator=</a></code>,
- <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_17ca4fda9526d0dad99706763c3b2d9f1">assign(size_type,
- const_reference)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_1417de2c2419c44d83a92c463762df5fb">assign(InputIterator,
- InputIterator)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_1e9347091d2d644854af0821d4b46869b">assign(capacity_type,
- InputIterator, InputIterator)</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer__space__optimized_1417de2c2419c44d83a92c463762df5fb" name=
- "classboost_1_1circular__buffer__space__optimized_1417de2c2419c44d83a92c463762df5fb"></a> <code><b>template
- <class InputIterator><br>
- void assign(InputIterator first, InputIterator last);</b></code><br>
- <br>
- Assign a copy of the range into the space optimized circular buffer.
- <p>
- The content of the <code>circular_buffer_space_optimized</code> will be removed and replaced with copies
- of elements from the specified range.
- </p>
- <dl>
- <dt>
- <b>Precondition:</b>
- </dt>
- <dd>
- Valid range <code>[first, last)</code>.<br>
- <code>first</code> and <code>last</code> have to meet the requirements of <a href=
- "http://www.sgi.com/tech/stl/InputIterator.html">InputIterator</a>.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a>.capacity()
- == std::distance(first, last) && <a href=
- "#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a>.min_capacity()
- == 0 && <a href=
- "circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> ==
- std::distance(first, last) && (*this)[0]== *first && (*this)[1] == *(first + 1)
- && ... && (*this)[std::distance(first, last) - 1] == *(last - 1)</code><br>
- <br>
- The amount of allocated memory in the internal buffer is <code>std::distance(first, last)</code>.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>first</code>
- </dt>
- <dd>
- The beginning of the range to be copied.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>last</code>
- </dt>
- <dd>
- The end of the range to be copied.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- An allocation error if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
- used).
- </dd>
- <dd>
- Whatever <code>T::T(const T&)</code> throws.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- Basic.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Invalidates all iterators pointing to the <code>circular_buffer_space_optimized</code> (except
- iterators equal to <code><a href=
- "circular_buffer.html#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a></code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Linear (in the <code>std::distance(first, last)</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_177e35432c5e69b7a16ef7d937950e7a8">operator=</a></code>,
- <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_17ca4fda9526d0dad99706763c3b2d9f1">assign(size_type,
- const_reference)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_1108055ae3f6b1635e1428b0455902cbf">assign(capacity_type,
- size_type, const_reference)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_1e9347091d2d644854af0821d4b46869b">assign(capacity_type,
- InputIterator, InputIterator)</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer__space__optimized_1e9347091d2d644854af0821d4b46869b" name=
- "classboost_1_1circular__buffer__space__optimized_1e9347091d2d644854af0821d4b46869b"></a> <code><b>template
- <class InputIterator><br>
- void assign(<a href=
- "#classboost_1_1circular__buffer__space__optimized_1051350e031c50c8b4a7ca1e1902e92f0">capacity_type</a>
- capacity_ctrl, InputIterator first, InputIterator last);</b></code><br>
- <br>
- Assign a copy of the range into the space optimized circular buffer specifying the capacity.
- <p>
- The capacity of the <code>circular_buffer_space_optimized</code> will be set to the specified value and
- the content of the <code>circular_buffer_space_optimized</code> will be removed and replaced with copies
- of elements from the specified range.
- </p>
- <dl>
- <dt>
- <b>Precondition:</b>
- </dt>
- <dd>
- Valid range <code>[first, last)</code>.<br>
- <code>first</code> and <code>last</code> have to meet the requirements of <a href=
- "http://www.sgi.com/tech/stl/InputIterator.html">InputIterator</a>.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a> ==
- capacity_ctrl && <a href=
- "circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a>
- <= std::distance(first, last) && (*this)[0]== *(last - capacity) && (*this)[1] ==
- *(last - capacity + 1) && ... && (*this)[capacity - 1] == *(last - 1)</code><br>
- <br>
- If the number of items to be copied from the range <code>[first, last)</code> is greater than the
- specified <code>capacity</code> then only elements from the range <code>[last - capacity, last)</code>
- will be copied.<br>
- <br>
- The amount of allocated memory in the internal buffer is <code>max[std::distance(first, last),
- capacity_ctrl.min_capacity()]</code>.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>capacity_ctrl</code>
- </dt>
- <dd>
- The new capacity controller.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>first</code>
- </dt>
- <dd>
- The beginning of the range to be copied.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>last</code>
- </dt>
- <dd>
- The end of the range to be copied.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- An allocation error if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
- used).
- </dd>
- <dd>
- Whatever <code>T::T(const T&)</code> throws.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- Basic.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Invalidates all iterators pointing to the <code>circular_buffer_space_optimized</code> (except
- iterators equal to <code><a href=
- "circular_buffer.html#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a></code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Linear (in <code>std::distance(first, last)</code>; in <code>min[capacity_ctrl.capacity(),
- std::distance(first, last)]</code> if the <code>InputIterator</code> is a <a href=
- "http://www.sgi.com/tech/stl/RandomAccessIterator.html">RandomAccessIterator</a>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_177e35432c5e69b7a16ef7d937950e7a8">operator=</a></code>,
- <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_17ca4fda9526d0dad99706763c3b2d9f1">assign(size_type,
- const_reference)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_1108055ae3f6b1635e1428b0455902cbf">assign(capacity_type,
- size_type, const_reference)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_1417de2c2419c44d83a92c463762df5fb">assign(InputIterator,
- InputIterator)</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer__space__optimized_14fd3b613f754d529ca250f2563b2f863" name=
- "classboost_1_1circular__buffer__space__optimized_14fd3b613f754d529ca250f2563b2f863"></a><code><b>void
- swap(circular_buffer_space_optimized<T,Alloc>& cb);</b></code><br>
- <br>
- Swap the contents of two space optimized circular buffers.
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- <code>this</code> contains elements of <code>cb</code> and vice versa; the capacity and the amount of
- allocated memory in the internal buffer of <code>this</code> equal to the capacity and the amount of
- allocated memory of <code>cb</code> and vice versa.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>cb</code>
- </dt>
- <dd>
- The <code>circular_buffer_space_optimized</code> whose content will be swapped.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- Nothing.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- No-throw.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Invalidates all iterators of both <code>circular_buffer_space_optimized</code> 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.)
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Constant (in the size of the <code>circular_buffer_space_optimized</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href=
- "circular_buffer.html#namespaceboost_14aa8f6a2c9640f3f22e266f0fca85777">swap(circular_buffer_space_optimized<T,
- Alloc>&, circular_buffer_space_optimized<T, Alloc>&)</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer__space__optimized_1cf3ffed54f5fece9315fb96726e5e205" name=
- "classboost_1_1circular__buffer__space__optimized_1cf3ffed54f5fece9315fb96726e5e205"></a><code><b>void
- push_back(<a href=
- "circular_buffer.html#classboost_1_1circular__buffer_1a8397191092f5bacee991b623ca4b910">const_reference</a>
- item = value_type());</b></code><br>
- <br>
- Insert a new element at the end of the space optimized circular buffer.
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- if <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a>.capacity()
- > 0</code> then <code><a href=
- "circular_buffer.html#classboost_1_1circular__buffer_1d985d974020f88bb4255d8edbae0a30a">back()</a> ==
- item</code><br>
- If the <code>circular_buffer_space_optimized</code> is full, the first element will be removed. If the
- capacity is <code>0</code>, nothing will be inserted.<br>
- <br>
- The amount of allocated memory in the internal buffer may be predictively increased.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>item</code>
- </dt>
- <dd>
- The element to be inserted.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- An allocation error if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
- used).
- </dd>
- <dd>
- Whatever <code>T::T(const T&)</code> throws.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- Basic.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Invalidates all iterators pointing to the <code>circular_buffer_space_optimized</code> (except
- iterators equal to <code><a href=
- "circular_buffer.html#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a></code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Linear (in the size of the <code>circular_buffer_space_optimized</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_1f0484fd492b377ff80c0bcb76183162c">push_front(const_reference)</a></code>,
- <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_19c4290c18ab3dd2462dc01fb8368dff6">pop_back()</a></code>,
- <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_1d7d496c40fc053258ac7d19cf5261788">pop_front()</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer__space__optimized_1f0484fd492b377ff80c0bcb76183162c" name=
- "classboost_1_1circular__buffer__space__optimized_1f0484fd492b377ff80c0bcb76183162c"></a><code><b>void
- push_front(<a href=
- "circular_buffer.html#classboost_1_1circular__buffer_1a8397191092f5bacee991b623ca4b910">const_reference</a>
- item = value_type());</b></code><br>
- <br>
- Insert a new element at the beginning of the space optimized circular buffer.
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- if <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a>.capacity()
- > 0</code> then <code><a href=
- "circular_buffer.html#classboost_1_1circular__buffer_10d5fdeabeb352f47d1f7bb1ea8d9819f">front()</a> ==
- item</code><br>
- If the <code>circular_buffer_space_optimized</code> is full, the last element will be removed. If the
- capacity is <code>0</code>, nothing will be inserted.<br>
- <br>
- The amount of allocated memory in the internal buffer may be predictively increased.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>item</code>
- </dt>
- <dd>
- The element to be inserted.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- An allocation error if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
- used).
- </dd>
- <dd>
- Whatever <code>T::T(const T&)</code> throws.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- Basic.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Invalidates all iterators pointing to the <code>circular_buffer_space_optimized</code> (except
- iterators equal to <code><a href=
- "circular_buffer.html#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a></code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Linear (in the size of the <code>circular_buffer_space_optimized</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_1cf3ffed54f5fece9315fb96726e5e205">push_back(const_reference)</a></code>,
- <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_19c4290c18ab3dd2462dc01fb8368dff6">pop_back()</a></code>,
- <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_1d7d496c40fc053258ac7d19cf5261788">pop_front()</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer__space__optimized_19c4290c18ab3dd2462dc01fb8368dff6" name=
- "classboost_1_1circular__buffer__space__optimized_19c4290c18ab3dd2462dc01fb8368dff6"></a><code><b>void
- pop_back();</b></code><br>
- <br>
- Remove the last element from the space optimized circular buffer.
- <dl>
- <dt>
- <b>Precondition:</b>
- </dt>
- <dd>
- <code>!empty()</code>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- The last element is removed from the <code>circular_buffer_space_optimized</code>.<br>
- <br>
- The amount of allocated memory in the internal buffer may be predictively decreased.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- An allocation error if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
- used).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- Basic.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Invalidates all iterators pointing to the <code>circular_buffer_space_optimized</code> (except
- iterators equal to <code><a href=
- "circular_buffer.html#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a></code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Linear (in the size of the <code>circular_buffer_space_optimized</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_1d7d496c40fc053258ac7d19cf5261788">pop_front()</a></code>,
- <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_1cf3ffed54f5fece9315fb96726e5e205">push_back(const_reference)</a></code>,
- <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_1f0484fd492b377ff80c0bcb76183162c">push_front(const_reference)</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer__space__optimized_1d7d496c40fc053258ac7d19cf5261788" name=
- "classboost_1_1circular__buffer__space__optimized_1d7d496c40fc053258ac7d19cf5261788"></a><code><b>void
- pop_front();</b></code><br>
- <br>
- Remove the first element from the space optimized circular buffer.
- <dl>
- <dt>
- <b>Precondition:</b>
- </dt>
- <dd>
- <code>!empty()</code>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- The first element is removed from the <code>circular_buffer_space_optimized</code>.<br>
- <br>
- The amount of allocated memory in the internal buffer may be predictively decreased.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- An allocation error if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
- used).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- Basic.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Invalidates all iterators pointing to the <code>circular_buffer_space_optimized</code> (except
- iterators equal to <code><a href=
- "circular_buffer.html#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a></code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Linear (in the size of the <code>circular_buffer_space_optimized</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_19c4290c18ab3dd2462dc01fb8368dff6">pop_back()</a></code>,
- <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_1cf3ffed54f5fece9315fb96726e5e205">push_back(const_reference)</a></code>,
- <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_1f0484fd492b377ff80c0bcb76183162c">push_front(const_reference)</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer__space__optimized_145877a0d46400f4894a13d25d138c130" name=
- "classboost_1_1circular__buffer__space__optimized_145877a0d46400f4894a13d25d138c130"></a><code><b><a href=
- "circular_buffer.html#classboost_1_1circular__buffer_11b8a33f2dc8519b8a7d344ed4408c532">iterator</a>
- insert(<a href=
- "circular_buffer.html#classboost_1_1circular__buffer_11b8a33f2dc8519b8a7d344ed4408c532">iterator</a> pos,
- <a href=
- "circular_buffer.html#classboost_1_1circular__buffer_1a8397191092f5bacee991b623ca4b910">const_reference</a>
- item = value_type());</b></code><br>
- <br>
- Insert an element at the specified position.
- <dl>
- <dt>
- <b>Precondition:</b>
- </dt>
- <dd>
- <code>pos</code> is a valid iterator pointing to the <code>circular_buffer_space_optimized</code> or
- its end.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- The <code>item</code> will be inserted at the position <code>pos</code>.<br>
- If the <code>circular_buffer_space_optimized</code> is full, the first element will be overwritten. If
- the <code>circular_buffer_space_optimized</code> is full and the <code>pos</code> points to
- <code><a href=
- "circular_buffer.html#classboost_1_1circular__buffer_158d1ede2e85f5d46eda8db3f0c4efef0">begin()</a></code>,
- then the <code>item</code> will not be inserted. If the capacity is <code>0</code>, nothing will be
- inserted.<br>
- <br>
- The amount of allocated memory in the internal buffer may be predictively increased.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>pos</code>
- </dt>
- <dd>
- An iterator specifying the position where the <code>item</code> will be inserted.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>item</code>
- </dt>
- <dd>
- The element to be inserted.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Returns:</b>
- </dt>
- <dd>
- Iterator to the inserted element or <code><a href=
- "circular_buffer.html#classboost_1_1circular__buffer_158d1ede2e85f5d46eda8db3f0c4efef0">begin()</a></code>
- if the <code>item</code> is not inserted. (See the <i>Effect</i>.)
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- An allocation error if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
- used).
- </dd>
- <dd>
- Whatever <code>T::T(const T&)</code> throws.
- </dd>
- <dd>
- Whatever <code>T::operator = (const T&)</code> throws.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- Basic.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Invalidates all iterators pointing to the <code>circular_buffer_space_optimized</code> (except
- iterators equal to <code><a href=
- "circular_buffer.html#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a></code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Linear (in the size of the <code>circular_buffer_space_optimized</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_1dc2060ce1105d80429ff3f004ca0691b">insert(iterator,
- size_type, value_type)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_19eec983bc010f2e8415618455dd81da0">insert(iterator,
- InputIterator, InputIterator)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_1cb3586429e49eeb2df2d2a09e19775de">rinsert(iterator,
- value_type)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_11eff7ec0eb603d489bd12f8c48928c9d">rinsert(iterator,
- size_type, value_type)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_1faeda7342f4717d7fb6b4589cb43b74e">rinsert(iterator,
- InputIterator, InputIterator)</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer__space__optimized_1dc2060ce1105d80429ff3f004ca0691b" name=
- "classboost_1_1circular__buffer__space__optimized_1dc2060ce1105d80429ff3f004ca0691b"></a><code><b>void
- insert(<a href=
- "circular_buffer.html#classboost_1_1circular__buffer_11b8a33f2dc8519b8a7d344ed4408c532">iterator</a> pos,
- <a href=
- "circular_buffer.html#classboost_1_1circular__buffer_19ba12c0142a21a7d960877c22fa3ea00">size_type</a> n,
- <a href=
- "circular_buffer.html#classboost_1_1circular__buffer_1a8397191092f5bacee991b623ca4b910">const_reference</a>
- item);</b></code><br>
- <br>
- Insert <code>n</code> copies of the <code>item</code> at the specified position.
- <dl>
- <dt>
- <b>Precondition:</b>
- </dt>
- <dd>
- <code>pos</code> is a valid iterator pointing to the <code>circular_buffer_space_optimized</code> or
- its end.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- The number of <code>min[n, (pos - <a href=
- "circular_buffer.html#classboost_1_1circular__buffer_158d1ede2e85f5d46eda8db3f0c4efef0">begin()</a>) +
- <a href=
- "#classboost_1_1circular__buffer__space__optimized_170eec72a6e8d088b58e26ac7e2dd7c9f">reserve()</a>]</code>
- elements will be inserted at the position <code>pos</code>.<br>
- The number of <code>min[pos - <a href=
- "circular_buffer.html#classboost_1_1circular__buffer_158d1ede2e85f5d46eda8db3f0c4efef0">begin()</a>,
- max[0, n - <a href=
- "#classboost_1_1circular__buffer__space__optimized_170eec72a6e8d088b58e26ac7e2dd7c9f">reserve()</a>]]</code>
- elements will be overwritten at the beginning of the <code>circular_buffer_space_optimized</code>.<br>
- (See <i>Example</i> for the explanation.)<br>
- <br>
- The amount of allocated memory in the internal buffer may be predictively increased.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>pos</code>
- </dt>
- <dd>
- An iterator specifying the position where the <code>item</code>s will be inserted.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>n</code>
- </dt>
- <dd>
- The number of <code>item</code>s the to be inserted.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>item</code>
- </dt>
- <dd>
- The element whose copies will be inserted.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- An allocation error if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
- used).
- </dd>
- <dd>
- Whatever <code>T::T(const T&)</code> throws.
- </dd>
- <dd>
- Whatever <code>T::operator = (const T&)</code> throws.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- Basic.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Invalidates all iterators pointing to the <code>circular_buffer_space_optimized</code> (except
- iterators equal to <code><a href=
- "circular_buffer.html#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a></code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Linear (in <code>min[<a href=
- "#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a>.capacity(),
- <a href=
- "circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> +
- n]</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Example:</b>
- </dt>
- <dd>
- Consider a <code>circular_buffer_space_optimized</code> with the capacity of 6 and the size of 4. Its
- internal buffer may look like the one below.<br>
- <br>
- <code>|1|2|3|4| | |</code><br>
- <code>p ---^</code><br>
- <br>
- After inserting 5 elements at the position <code>p</code>:<br>
- <br>
- <code>insert(p, (size_t)5, 0);</code><br>
- <br>
- actually only 4 elements get inserted and elements <code>1</code> and <code>2</code> are overwritten.
- This is due to the fact the insert operation preserves the capacity. After insertion the internal
- buffer looks like this:<br>
- <br>
- <code>|0|0|0|0|3|4|</code><br>
- <br>
- For comparison if the capacity would not be preserved the internal buffer would then result in
- <code>|1|2|0|0|0|0|0|3|4|</code>.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_145877a0d46400f4894a13d25d138c130">insert(iterator,
- value_type)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_19eec983bc010f2e8415618455dd81da0">insert(iterator,
- InputIterator, InputIterator)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_1cb3586429e49eeb2df2d2a09e19775de">rinsert(iterator,
- value_type)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_11eff7ec0eb603d489bd12f8c48928c9d">rinsert(iterator,
- size_type, value_type)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_1faeda7342f4717d7fb6b4589cb43b74e">rinsert(iterator,
- InputIterator, InputIterator)</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer__space__optimized_19eec983bc010f2e8415618455dd81da0" name=
- "classboost_1_1circular__buffer__space__optimized_19eec983bc010f2e8415618455dd81da0"></a> <code><b>template
- <class InputIterator><br>
- void insert(<a href=
- "circular_buffer.html#classboost_1_1circular__buffer_11b8a33f2dc8519b8a7d344ed4408c532">iterator</a> pos,
- InputIterator first, InputIterator last);</b></code><br>
- <br>
- Insert the range <code>[first, last)</code> at the specified position.
- <dl>
- <dt>
- <b>Precondition:</b>
- </dt>
- <dd>
- <code>pos</code> is a valid iterator pointing to the <code>circular_buffer_space_optimized</code> or
- its end.<br>
- Valid range <code>[first, last)</code> where <code>first</code> and <code>last</code> meet the
- requirements of an InputIterator.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- Elements from the range <code>[first + max[0, distance(first, last) - (pos - <a href=
- "circular_buffer.html#classboost_1_1circular__buffer_158d1ede2e85f5d46eda8db3f0c4efef0">begin()</a>) -
- <a href=
- "#classboost_1_1circular__buffer__space__optimized_170eec72a6e8d088b58e26ac7e2dd7c9f">reserve()</a>],
- last)</code> will be inserted at the position <code>pos</code>.<br>
- The number of <code>min[pos - <a href=
- "circular_buffer.html#classboost_1_1circular__buffer_158d1ede2e85f5d46eda8db3f0c4efef0">begin()</a>,
- max[0, distance(first, last) - <a href=
- "#classboost_1_1circular__buffer__space__optimized_170eec72a6e8d088b58e26ac7e2dd7c9f">reserve()</a>]]</code>
- elements will be overwritten at the beginning of the <code>circular_buffer_space_optimized</code>.<br>
- (See <i>Example</i> for the explanation.)<br>
- <br>
- The amount of allocated memory in the internal buffer may be predictively increased.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>pos</code>
- </dt>
- <dd>
- An iterator specifying the position where the range will be inserted.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>first</code>
- </dt>
- <dd>
- The beginning of the range to be inserted.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>last</code>
- </dt>
- <dd>
- The end of the range to be inserted.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- An allocation error if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
- used).
- </dd>
- <dd>
- Whatever <code>T::T(const T&)</code> throws.
- </dd>
- <dd>
- Whatever <code>T::operator = (const T&)</code> throws.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- Basic.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Invalidates all iterators pointing to the <code>circular_buffer_space_optimized</code> (except
- iterators equal to <code><a href=
- "circular_buffer.html#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a></code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Linear (in <code>[<a href=
- "circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> +
- std::distance(first, last)]</code>; in <code>min[<a href=
- "#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a>.capacity(),
- <a href=
- "circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> +
- std::distance(first, last)]</code> if the <code>InputIterator</code> is a <a href=
- "http://www.sgi.com/tech/stl/RandomAccessIterator.html">RandomAccessIterator</a>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Example:</b>
- </dt>
- <dd>
- Consider a <code>circular_buffer_space_optimized</code> with the capacity of 6 and the size of 4. Its
- internal buffer may look like the one below.<br>
- <br>
- <code>|1|2|3|4| | |</code><br>
- <code>p ---^</code><br>
- <br>
- After inserting a range of elements at the position <code>p</code>:<br>
- <br>
- <code>int array[] = { 5, 6, 7, 8, 9 };</code><br>
- <code>insert(p, array, array + 5);</code><br>
- <br>
- actually only elements <code>6</code>, <code>7</code>, <code>8</code> and <code>9</code> from the
- specified range get inserted and elements <code>1</code> and <code>2</code> are overwritten. This is
- due to the fact the insert operation preserves the capacity. After insertion the internal buffer looks
- like this:<br>
- <br>
- <code>|6|7|8|9|3|4|</code><br>
- <br>
- For comparison if the capacity would not be preserved the internal buffer would then result in
- <code>|1|2|5|6|7|8|9|3|4|</code>.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_145877a0d46400f4894a13d25d138c130">insert(iterator,
- value_type)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_1dc2060ce1105d80429ff3f004ca0691b">insert(iterator,
- size_type, value_type)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_1cb3586429e49eeb2df2d2a09e19775de">rinsert(iterator,
- value_type)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_11eff7ec0eb603d489bd12f8c48928c9d">rinsert(iterator,
- size_type, value_type)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_1faeda7342f4717d7fb6b4589cb43b74e">rinsert(iterator,
- InputIterator, InputIterator)</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer__space__optimized_1cb3586429e49eeb2df2d2a09e19775de" name=
- "classboost_1_1circular__buffer__space__optimized_1cb3586429e49eeb2df2d2a09e19775de"></a><code><b><a href=
- "circular_buffer.html#classboost_1_1circular__buffer_11b8a33f2dc8519b8a7d344ed4408c532">iterator</a>
- rinsert(<a href=
- "circular_buffer.html#classboost_1_1circular__buffer_11b8a33f2dc8519b8a7d344ed4408c532">iterator</a> pos,
- <a href=
- "circular_buffer.html#classboost_1_1circular__buffer_1a8397191092f5bacee991b623ca4b910">const_reference</a>
- item = value_type());</b></code><br>
- <br>
- Insert an element before the specified position.
- <dl>
- <dt>
- <b>Precondition:</b>
- </dt>
- <dd>
- <code>pos</code> is a valid iterator pointing to the <code>circular_buffer_space_optimized</code> or
- its end.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- The <code>item</code> will be inserted before the position <code>pos</code>.<br>
- If the <code>circular_buffer_space_optimized</code> is full, the last element will be overwritten. If
- the <code>circular_buffer_space_optimized</code> is full and the <code>pos</code> points to
- <code><a href=
- "circular_buffer.html#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a></code>,
- then the <code>item</code> will not be inserted. If the capacity is <code>0</code>, nothing will be
- inserted.<br>
- <br>
- The amount of allocated memory in the internal buffer may be predictively increased.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>pos</code>
- </dt>
- <dd>
- An iterator specifying the position before which the <code>item</code> will be inserted.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>item</code>
- </dt>
- <dd>
- The element to be inserted.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Returns:</b>
- </dt>
- <dd>
- Iterator to the inserted element or <code><a href=
- "circular_buffer.html#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a></code>
- if the <code>item</code> is not inserted. (See the <i>Effect</i>.)
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- An allocation error if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
- used).
- </dd>
- <dd>
- Whatever <code>T::T(const T&)</code> throws.
- </dd>
- <dd>
- Whatever <code>T::operator = (const T&)</code> throws.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- Basic.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Invalidates all iterators pointing to the <code>circular_buffer_space_optimized</code> (except
- iterators equal to <code><a href=
- "circular_buffer.html#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a></code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Linear (in the size of the <code>circular_buffer_space_optimized</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_11eff7ec0eb603d489bd12f8c48928c9d">rinsert(iterator,
- size_type, value_type)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_1faeda7342f4717d7fb6b4589cb43b74e">rinsert(iterator,
- InputIterator, InputIterator)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_145877a0d46400f4894a13d25d138c130">insert(iterator,
- value_type)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_1dc2060ce1105d80429ff3f004ca0691b">insert(iterator,
- size_type, value_type)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_19eec983bc010f2e8415618455dd81da0">insert(iterator,
- InputIterator, InputIterator)</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer__space__optimized_11eff7ec0eb603d489bd12f8c48928c9d" name=
- "classboost_1_1circular__buffer__space__optimized_11eff7ec0eb603d489bd12f8c48928c9d"></a><code><b>void
- rinsert(<a href=
- "circular_buffer.html#classboost_1_1circular__buffer_11b8a33f2dc8519b8a7d344ed4408c532">iterator</a> pos,
- <a href=
- "circular_buffer.html#classboost_1_1circular__buffer_19ba12c0142a21a7d960877c22fa3ea00">size_type</a> n,
- <a href=
- "circular_buffer.html#classboost_1_1circular__buffer_1a8397191092f5bacee991b623ca4b910">const_reference</a>
- item);</b></code><br>
- <br>
- Insert <code>n</code> copies of the <code>item</code> before the specified position.
- <dl>
- <dt>
- <b>Precondition:</b>
- </dt>
- <dd>
- <code>pos</code> is a valid iterator pointing to the <code>circular_buffer_space_optimized</code> or
- its end.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- The number of <code>min[n, (<a href=
- "circular_buffer.html#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a> -
- pos) + <a href=
- "#classboost_1_1circular__buffer__space__optimized_170eec72a6e8d088b58e26ac7e2dd7c9f">reserve()</a>]</code>
- elements will be inserted before the position <code>pos</code>.<br>
- The number of <code>min[<a href=
- "circular_buffer.html#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a> -
- pos, max[0, n - <a href=
- "#classboost_1_1circular__buffer__space__optimized_170eec72a6e8d088b58e26ac7e2dd7c9f">reserve()</a>]]</code>
- elements will be overwritten at the end of the <code>circular_buffer_space_optimized</code>.<br>
- (See <i>Example</i> for the explanation.)<br>
- <br>
- The amount of allocated memory in the internal buffer may be predictively increased.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>pos</code>
- </dt>
- <dd>
- An iterator specifying the position where the <code>item</code>s will be inserted.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>n</code>
- </dt>
- <dd>
- The number of <code>item</code>s the to be inserted.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>item</code>
- </dt>
- <dd>
- The element whose copies will be inserted.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- An allocation error if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
- used).
- </dd>
- <dd>
- Whatever <code>T::T(const T&)</code> throws.
- </dd>
- <dd>
- Whatever <code>T::operator = (const T&)</code> throws.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- Basic.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Invalidates all iterators pointing to the <code>circular_buffer_space_optimized</code> (except
- iterators equal to <code><a href=
- "circular_buffer.html#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a></code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Linear (in <code>min[<a href=
- "#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a>.capacity(),
- <a href=
- "circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> +
- n]</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Example:</b>
- </dt>
- <dd>
- Consider a <code>circular_buffer_space_optimized</code> with the capacity of 6 and the size of 4. Its
- internal buffer may look like the one below.<br>
- <br>
- <code>|1|2|3|4| | |</code><br>
- <code>p ---^</code><br>
- <br>
- After inserting 5 elements before the position <code>p</code>:<br>
- <br>
- <code>rinsert(p, (size_t)5, 0);</code><br>
- <br>
- actually only 4 elements get inserted and elements <code>3</code> and <code>4</code> are overwritten.
- This is due to the fact the rinsert operation preserves the capacity. After insertion the internal
- buffer looks like this:<br>
- <br>
- <code>|1|2|0|0|0|0|</code><br>
- <br>
- For comparison if the capacity would not be preserved the internal buffer would then result in
- <code>|1|2|0|0|0|0|0|3|4|</code>.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_1cb3586429e49eeb2df2d2a09e19775de">rinsert(iterator,
- value_type)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_1faeda7342f4717d7fb6b4589cb43b74e">rinsert(iterator,
- InputIterator, InputIterator)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_145877a0d46400f4894a13d25d138c130">insert(iterator,
- value_type)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_1dc2060ce1105d80429ff3f004ca0691b">insert(iterator,
- size_type, value_type)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_19eec983bc010f2e8415618455dd81da0">insert(iterator,
- InputIterator, InputIterator)</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer__space__optimized_1faeda7342f4717d7fb6b4589cb43b74e" name=
- "classboost_1_1circular__buffer__space__optimized_1faeda7342f4717d7fb6b4589cb43b74e"></a> <code><b>template
- <class InputIterator><br>
- void rinsert(<a href=
- "circular_buffer.html#classboost_1_1circular__buffer_11b8a33f2dc8519b8a7d344ed4408c532">iterator</a> pos,
- InputIterator first, InputIterator last);</b></code><br>
- <br>
- Insert the range <code>[first, last)</code> before the specified position.
- <dl>
- <dt>
- <b>Precondition:</b>
- </dt>
- <dd>
- <code>pos</code> is a valid iterator pointing to the <code>circular_buffer_space_optimized</code> or
- its end.<br>
- Valid range <code>[first, last)</code> where <code>first</code> and <code>last</code> meet the
- requirements of an InputIterator.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- Elements from the range <code>[first, last - max[0, distance(first, last) - (<a href=
- "circular_buffer.html#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a> -
- pos) - <a href=
- "#classboost_1_1circular__buffer__space__optimized_170eec72a6e8d088b58e26ac7e2dd7c9f">reserve()</a>])</code>
- will be inserted before the position <code>pos</code>.<br>
- The number of <code>min[<a href=
- "circular_buffer.html#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a> -
- pos, max[0, distance(first, last) - <a href=
- "#classboost_1_1circular__buffer__space__optimized_170eec72a6e8d088b58e26ac7e2dd7c9f">reserve()</a>]]</code>
- elements will be overwritten at the end of the <code><a href=
- "circular_buffer.html#classboost_1_1circular__buffer">circular_buffer</a></code>.<br>
- (See <i>Example</i> for the explanation.)<br>
- <br>
- The amount of allocated memory in the internal buffer may be predictively increased.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>pos</code>
- </dt>
- <dd>
- An iterator specifying the position where the range will be inserted.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>first</code>
- </dt>
- <dd>
- The beginning of the range to be inserted.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>last</code>
- </dt>
- <dd>
- The end of the range to be inserted.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- An allocation error if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
- used).
- </dd>
- <dd>
- Whatever <code>T::T(const T&)</code> throws.
- </dd>
- <dd>
- Whatever <code>T::operator = (const T&)</code> throws.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- Basic.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Invalidates all iterators pointing to the <code>circular_buffer_space_optimized</code> (except
- iterators equal to <code><a href=
- "circular_buffer.html#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a></code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Linear (in <code>[<a href=
- "circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> +
- std::distance(first, last)]</code>; in <code>min[<a href=
- "#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a>.capacity(),
- <a href=
- "circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> +
- std::distance(first, last)]</code> if the <code>InputIterator</code> is a <a href=
- "http://www.sgi.com/tech/stl/RandomAccessIterator.html">RandomAccessIterator</a>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Example:</b>
- </dt>
- <dd>
- Consider a <code>circular_buffer_space_optimized</code> with the capacity of 6 and the size of 4. Its
- internal buffer may look like the one below.<br>
- <br>
- <code>|1|2|3|4| | |</code><br>
- <code>p ---^</code><br>
- <br>
- After inserting a range of elements before the position <code>p</code>:<br>
- <br>
- <code>int array[] = { 5, 6, 7, 8, 9 };</code><br>
- <code>insert(p, array, array + 5);</code><br>
- <br>
- actually only elements <code>5</code>, <code>6</code>, <code>7</code> and <code>8</code> from the
- specified range get inserted and elements <code>3</code> and <code>4</code> are overwritten. This is
- due to the fact the rinsert operation preserves the capacity. After insertion the internal buffer looks
- like this:<br>
- <br>
- <code>|1|2|5|6|7|8|</code><br>
- <br>
- For comparison if the capacity would not be preserved the internal buffer would then result in
- <code>|1|2|5|6|7|8|9|3|4|</code>.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_1cb3586429e49eeb2df2d2a09e19775de">rinsert(iterator,
- value_type)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_11eff7ec0eb603d489bd12f8c48928c9d">rinsert(iterator,
- size_type, value_type)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_145877a0d46400f4894a13d25d138c130">insert(iterator,
- value_type)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_1dc2060ce1105d80429ff3f004ca0691b">insert(iterator,
- size_type, value_type)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_19eec983bc010f2e8415618455dd81da0">insert(iterator,
- InputIterator, InputIterator)</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer__space__optimized_136feadef225bd8a10962a92c4ffcdfd3" name=
- "classboost_1_1circular__buffer__space__optimized_136feadef225bd8a10962a92c4ffcdfd3"></a><code><b><a href=
- "circular_buffer.html#classboost_1_1circular__buffer_11b8a33f2dc8519b8a7d344ed4408c532">iterator</a>
- erase(<a href=
- "circular_buffer.html#classboost_1_1circular__buffer_11b8a33f2dc8519b8a7d344ed4408c532">iterator</a>
- pos);</b></code><br>
- <br>
- Remove an element at the specified position.
- <dl>
- <dt>
- <b>Precondition:</b>
- </dt>
- <dd>
- <code>pos</code> is a valid iterator pointing to the <code>circular_buffer_space_optimized</code> (but
- not an <code><a href=
- "circular_buffer.html#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a></code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- The element at the position <code>pos</code> is removed.<br>
- <br>
- The amount of allocated memory in the internal buffer may be predictively decreased.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>pos</code>
- </dt>
- <dd>
- An iterator pointing at the element to be removed.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Returns:</b>
- </dt>
- <dd>
- Iterator to the first element remaining beyond the removed element or <code><a href=
- "circular_buffer.html#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a></code>
- if no such element exists.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- An allocation error if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
- used).
- </dd>
- <dd>
- Whatever <code>T::operator = (const T&)</code> throws.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- Basic.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Invalidates all iterators pointing to the <code>circular_buffer_space_optimized</code> (except
- iterators equal to <code><a href=
- "circular_buffer.html#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a></code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Linear (in the size of the <code>circular_buffer_space_optimized</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_19e9a4e0dfca27329da78e014d97201ca">erase(iterator,
- iterator)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_16e96800422211d02621526c894b71fa1">rerase(iterator)</a></code>,
- <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_154fd4c2a67c7d6de6cbf6c8255729e98">rerase(iterator,
- iterator)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_12aa1dd29bd9509b5482ca2666c61deab">clear()</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer__space__optimized_19e9a4e0dfca27329da78e014d97201ca" name=
- "classboost_1_1circular__buffer__space__optimized_19e9a4e0dfca27329da78e014d97201ca"></a><code><b><a href=
- "circular_buffer.html#classboost_1_1circular__buffer_11b8a33f2dc8519b8a7d344ed4408c532">iterator</a>
- erase(<a href=
- "circular_buffer.html#classboost_1_1circular__buffer_11b8a33f2dc8519b8a7d344ed4408c532">iterator</a> first,
- <a href=
- "circular_buffer.html#classboost_1_1circular__buffer_11b8a33f2dc8519b8a7d344ed4408c532">iterator</a>
- last);</b></code><br>
- <br>
- Erase the range <code>[first, last)</code>.
- <dl>
- <dt>
- <b>Precondition:</b>
- </dt>
- <dd>
- Valid range <code>[first, last)</code>.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- The elements from the range <code>[first, last)</code> are removed. (If <code>first == last</code>
- nothing is removed.)<br>
- <br>
- The amount of allocated memory in the internal buffer may be predictively decreased.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>first</code>
- </dt>
- <dd>
- The beginning of the range to be removed.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>last</code>
- </dt>
- <dd>
- The end of the range to be removed.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Returns:</b>
- </dt>
- <dd>
- Iterator to the first element remaining beyond the removed elements or <code><a href=
- "circular_buffer.html#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a></code>
- if no such element exists.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- An allocation error if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
- used).
- </dd>
- <dd>
- Whatever <code>T::operator = (const T&)</code> throws.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- Basic.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Invalidates all iterators pointing to the <code>circular_buffer_space_optimized</code> (except
- iterators equal to <code><a href=
- "circular_buffer.html#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a></code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Linear (in the size of the <code>circular_buffer_space_optimized</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_136feadef225bd8a10962a92c4ffcdfd3">erase(iterator)</a></code>,
- <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_16e96800422211d02621526c894b71fa1">rerase(iterator)</a></code>,
- <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_154fd4c2a67c7d6de6cbf6c8255729e98">rerase(iterator,
- iterator)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_12aa1dd29bd9509b5482ca2666c61deab">clear()</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer__space__optimized_16e96800422211d02621526c894b71fa1" name=
- "classboost_1_1circular__buffer__space__optimized_16e96800422211d02621526c894b71fa1"></a><code><b><a href=
- "circular_buffer.html#classboost_1_1circular__buffer_11b8a33f2dc8519b8a7d344ed4408c532">iterator</a>
- rerase(<a href=
- "circular_buffer.html#classboost_1_1circular__buffer_11b8a33f2dc8519b8a7d344ed4408c532">iterator</a>
- pos);</b></code><br>
- <br>
- Remove an element at the specified position.
- <dl>
- <dt>
- <b>Precondition:</b>
- </dt>
- <dd>
- <code>pos</code> is a valid iterator pointing to the <code>circular_buffer_space_optimized</code> (but
- not an <code><a href=
- "circular_buffer.html#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a></code>).<br>
-
- <br>
- The amount of allocated memory in the internal buffer may be predictively decreased.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- The element at the position <code>pos</code> is removed.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>pos</code>
- </dt>
- <dd>
- An iterator pointing at the element to be removed.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Returns:</b>
- </dt>
- <dd>
- Iterator to the first element remaining in front of the removed element or <code><a href=
- "circular_buffer.html#classboost_1_1circular__buffer_158d1ede2e85f5d46eda8db3f0c4efef0">begin()</a></code>
- if no such element exists.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- An allocation error if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
- used).
- </dd>
- <dd>
- Whatever <code>T::operator = (const T&)</code> throws.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- Basic.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Invalidates all iterators pointing to the <code>circular_buffer_space_optimized</code> (except
- iterators equal to <code><a href=
- "circular_buffer.html#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a></code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Linear (in the size of the <code>circular_buffer_space_optimized</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Note:</b>
- </dt>
- <dd>
- Basically there is no difference between <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_136feadef225bd8a10962a92c4ffcdfd3">erase(iterator)</a></code>
- and this method. It is implemented only for consistency with the base <code><a href=
- "circular_buffer.html">circular_buffer</a></code>.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_136feadef225bd8a10962a92c4ffcdfd3">erase(iterator)</a></code>,
- <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_19e9a4e0dfca27329da78e014d97201ca">erase(iterator,
- iterator)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_154fd4c2a67c7d6de6cbf6c8255729e98">rerase(iterator,
- iterator)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_12aa1dd29bd9509b5482ca2666c61deab">clear()</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer__space__optimized_154fd4c2a67c7d6de6cbf6c8255729e98" name=
- "classboost_1_1circular__buffer__space__optimized_154fd4c2a67c7d6de6cbf6c8255729e98"></a><code><b><a href=
- "circular_buffer.html#classboost_1_1circular__buffer_11b8a33f2dc8519b8a7d344ed4408c532">iterator</a>
- rerase(<a href=
- "circular_buffer.html#classboost_1_1circular__buffer_11b8a33f2dc8519b8a7d344ed4408c532">iterator</a> first,
- <a href=
- "circular_buffer.html#classboost_1_1circular__buffer_11b8a33f2dc8519b8a7d344ed4408c532">iterator</a>
- last);</b></code><br>
- <br>
- Erase the range <code>[first, last)</code>.
- <dl>
- <dt>
- <b>Precondition:</b>
- </dt>
- <dd>
- Valid range <code>[first, last)</code>.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- The elements from the range <code>[first, last)</code> are removed. (If <code>first == last</code>
- nothing is removed.)<br>
- <br>
- The amount of allocated memory in the internal buffer may be predictively decreased.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Parameter(s):</b>
- </dt>
- <dd>
- <dl compact>
- <dt>
- <code>first</code>
- </dt>
- <dd>
- The beginning of the range to be removed.
- </dd>
- </dl>
- </dd>
- <dd>
- <dl compact>
- <dt>
- <code>last</code>
- </dt>
- <dd>
- The end of the range to be removed.
- </dd>
- </dl>
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Returns:</b>
- </dt>
- <dd>
- Iterator to the first element remaining in front of the removed elements or <code><a href=
- "circular_buffer.html#classboost_1_1circular__buffer_158d1ede2e85f5d46eda8db3f0c4efef0">begin()</a></code>
- if no such element exists.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- An allocation error if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
- used).
- </dd>
- <dd>
- Whatever <code>T::operator = (const T&)</code> throws.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- Basic.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Invalidates all iterators pointing to the <code>circular_buffer_space_optimized</code> (except
- iterators equal to <code><a href=
- "circular_buffer.html#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a></code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Linear (in the size of the <code>circular_buffer_space_optimized</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Note:</b>
- </dt>
- <dd>
- Basically there is no difference between <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_19e9a4e0dfca27329da78e014d97201ca">erase(iterator,
- iterator)</a></code> and this method. It is implemented only for consistency with the base
- <code>circular_buffer</code>.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_136feadef225bd8a10962a92c4ffcdfd3">erase(iterator)</a></code>,
- <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_19e9a4e0dfca27329da78e014d97201ca">erase(iterator,
- iterator)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_16e96800422211d02621526c894b71fa1">rerase(iterator)</a></code>,
- <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_12aa1dd29bd9509b5482ca2666c61deab">clear()</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- <tr>
- <td>
- <a id="classboost_1_1circular__buffer__space__optimized_12aa1dd29bd9509b5482ca2666c61deab" name=
- "classboost_1_1circular__buffer__space__optimized_12aa1dd29bd9509b5482ca2666c61deab"></a><code><b>void
- clear();</b></code><br>
- <br>
- Remove all stored elements from the space optimized circular buffer.
- <dl>
- <dt>
- <b>Effect:</b>
- </dt>
- <dd>
- <code><a href=
- "circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> ==
- 0</code><br>
- <br>
- The amount of allocated memory in the internal buffer may be predictively decreased.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Throws:</b>
- </dt>
- <dd>
- An allocation error if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
- used).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Exception Safety:</b>
- </dt>
- <dd>
- Basic.
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Iterator Invalidation:</b>
- </dt>
- <dd>
- Invalidates all iterators pointing to the <code>circular_buffer_space_optimized</code> (except
- iterators equal to <code><a href=
- "circular_buffer.html#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a></code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>Complexity:</b>
- </dt>
- <dd>
- Linear (in the size of the <code>circular_buffer_space_optimized</code>).
- </dd>
- </dl>
- <dl>
- <dt>
- <b>See Also:</b>
- </dt>
- <dd>
- <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_16839c3ea656ff0f800e38096748fe8ac">~circular_buffer_space_optimized()</a></code>,
- <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_136feadef225bd8a10962a92c4ffcdfd3">erase(iterator)</a></code>,
- <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_19e9a4e0dfca27329da78e014d97201ca">erase(iterator,
- iterator)</a></code>, <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_16e96800422211d02621526c894b71fa1">rerase(iterator)</a></code>,
- <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_154fd4c2a67c7d6de6cbf6c8255729e98">rerase(iterator,
- iterator)</a></code>
- </dd>
- </dl>
- </td>
- </tr>
- </table>
- </div>
- <h2>
- <a name="see" id="see">See also</a>
- </h2>
- <p>
- <code>boost::circular_buffer, <a href=
- "http://www.sgi.com/tech/stl/Vector.html">std::vector</a></code>
- </p>
- <h2>
- <a name="ack" id="ack">Acknowledgements</a>
- </h2>
- <p>
- The idea of the space optimized circular buffer has been introduced by Pavel Vozenilek.
- </p>
- <h2>
- <a name="relnotes" id="relnotes">Release Notes</a>
- </h2>
- <dl>
- <dd>
- <h3>
- Boost 1.37
- </h3>
- </dd>
- <dd>
- <ul>
- <li>Added new methods <code>is_linearized()</code> and <code>rotate(const_iterator)</code>.
- </li>
- </ul>
- </dd>
- <dd>
- <h3>
- Boost 1.36
- </h3>
- </dd>
- <dd>
- <ul>
- <li>Changed behaviour of the <code>circular_buffer_space_optimized(const allocator_type&)</code>
- constructor. Since this version the constructor sets the capacity to zero.
- </li>
- </ul>
- </dd>
- <dd>
- <h3>
- Boost 1.35
- </h3>
- </dd>
- <dd>
- <ul>
- <li>Initial release.
- </li>
- </ul>
- </dd>
- </dl>
- <hr size="1">
- <p>
- <small>Copyright © 2003-2008 Jan Gaspar</small>
- </p>
- <p>
- <small>Use, modification, and distribution is subject to the Boost Software License, Version 1.0.<br>
- (See accompanying file <code>LICENSE_1_0.txt</code> or copy at <a href=
- "http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt>)</small>
- </p>
- </body>
-</html>
Deleted: branches/release/libs/circular_buffer/doc/space_optimized.png
==============================================================================
Binary file. No diff available.
Deleted: branches/release/libs/circular_buffer/doc/space_optimized.xslt
==============================================================================
--- branches/release/libs/circular_buffer/doc/space_optimized.xslt 2013-08-29 04:39:09 EDT (Thu, 29 Aug 2013) (r85509)
+++ /dev/null 00:00:00 1970 (deleted)
@@ -1,106 +0,0 @@
-<?xml version='1.0' encoding='iso-8859-1'?>
-<!--
-XSL transformation from the XML files generated by Doxygen into XHTML source
-code documentation of the circular_buffer_space_optimized.
-
-Copyright (c) 2003-2008 Jan Gaspar
-
-Use, modification, and distribution is subject to the Boost Software
-License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-http://www.boost.org/LICENSE_1_0.txt)
--->
-
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
-
- <xsl:import href="doxygen2html.xslt"/>
-
- <xsl:output method="xml" version="1.0" encoding="iso-8859-1" indent="yes" media-type="text/xml"/>
-
- <xsl:variable name="link-prefix" select="'circular_buffer.html'"/>
- <xsl:variable name="circular_buffer-ref" select="//compound[name='boost::circular_buffer' and @kind='class']/@refid"/>
- <xsl:variable name="circular_buffer-file" select="concat($xmldir, '/', $circular_buffer-ref, '.xml')"/>
- <xsl:variable name="circular_buffer-reimplemented" select="document($circular_buffer-file)/doxygen/compounddef[@id = $circular_buffer-ref and @kind = 'class']//reimplementedby"/>
- <xsl:variable name="standalone-functions" select="document(concat($xmldir, '/namespaceboost.xml'))/doxygen/compounddef/sectiondef[@kind='func']"/>
-
- <xsl:template name="reference">
- <xsl:variable name="refid" select="$circular_buffer-reimplemented[@refid=current()/@refid and text()!='capacity_type']/../@id"/>
- <xsl:value-of select="concat(substring(concat($link-prefix, '#', $refid), 1 div (string-length($refid) > 0)), substring(concat('#', @refid), 1 div (string-length($refid) = 0)))"/>
- </xsl:template>
-
- <xsl:template name="template-parameters">
- <xsl:apply-templates select="templateparamlist/param" mode="synopsis">
- <xsl:with-param name="link-prefix" select="$link-prefix"/>
- </xsl:apply-templates>
- </xsl:template>
-
- <xsl:template name="public-types">
- <xsl:for-each select="sectiondef[@kind='public-type']/memberdef">
- <xsl:if test="string-length(normalize-space(briefdescription)) > 0">
- <xsl:choose>
- <xsl:when test="document($circular_buffer-file)/doxygen/compounddef[@id = $circular_buffer-ref and @kind = 'class']/sectiondef[@kind='public-type']/memberdef[name=current()/name]/briefdescription = briefdescription">
- <xsl:apply-templates select="document($circular_buffer-file)/doxygen/compounddef[@id = $circular_buffer-ref and @kind = 'class']/sectiondef[@kind='public-type']/memberdef[name=current()/name]" mode="synopsis">
- <xsl:with-param name="link-prefix" select="$link-prefix"/>
- </xsl:apply-templates>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates select="." mode="synopsis"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:if>
- </xsl:for-each>
- </xsl:template>
-
- <xsl:template name="constructors">
- <xsl:for-each select="sectiondef[@kind='public-func']/memberdef[type = '']">
- <xsl:variable name="briefdescription" select="normalize-space(briefdescription)"/>
- <xsl:if test="string-length($briefdescription) > 0">
- <xsl:apply-templates select="." mode="synopsis"/>
- </xsl:if>
- </xsl:for-each>
- </xsl:template>
-
- <xsl:template name="member-functions">
- <xsl:variable name="current" select="sectiondef[@kind='public-func']/memberdef[type != '']"/>
- <xsl:for-each select="document($circular_buffer-file)/doxygen/compounddef[@id = $circular_buffer-ref and @kind = 'class']/sectiondef[@kind='public-func']/memberdef[type != '']">
- <xsl:if test="count($current[name=current()/name and string-length(normalize-space(briefdescription)) > 0]) = 0">
- <xsl:apply-templates select="." mode="synopsis">
- <xsl:with-param name="link-prefix" select="$link-prefix"/>
- </xsl:apply-templates>
- </xsl:if>
- </xsl:for-each>
- <xsl:for-each select="$current[string-length(normalize-space(briefdescription)) > 0 and normalize-space(briefdescription) != 'no-comment']">
- <xsl:apply-templates select="." mode="synopsis"/>
- </xsl:for-each>
- </xsl:template>
-
- <xsl:template name="standalone-functions">
- <xsl:for-each select="$standalone-functions/memberdef[contains(argsstring, 'circular_buffer_space_optimized<')]">
- <xsl:apply-templates select="." mode="synopsis">
- <xsl:with-param name="indent" select="''"/>
- <xsl:with-param name="link-prefix" select="$link-prefix"/>
- <xsl:with-param name="link" select="$standalone-functions/memberdef[contains(argsstring, 'circular_buffer<') and name=current()/name]/@id"/>
- </xsl:apply-templates>
- </xsl:for-each>
- </xsl:template>
-
- <xsl:template name="template-parameters-details"/>
-
- <xsl:template name="public-types-details">
- <xsl:apply-templates select="sectiondef[@kind='public-type']/memberdef[not(contains(type, 'circular_buffer<'))]" mode="description"/>
- </xsl:template>
-
- <xsl:template name="constructors-details">
- <xsl:for-each select="sectiondef[@kind='public-func']/memberdef[type = '' and string-length(normalize-space(briefdescription)) > 0]">
- <xsl:apply-templates select="." mode="description"/>
- </xsl:for-each>
- </xsl:template>
-
- <xsl:template name="member-functions-details">
- <xsl:for-each select="sectiondef[@kind='public-func']/memberdef[type != '' and string-length(normalize-space(briefdescription)) > 0 and normalize-space(briefdescription) != 'no-comment']">
- <xsl:apply-templates select="." mode="description"/>
- </xsl:for-each>
- </xsl:template>
-
- <xsl:template name="standalone-functions-details"/>
-
-</xsl:stylesheet>
Deleted: branches/release/libs/circular_buffer/doc/update_srcdoc.sh
==============================================================================
--- branches/release/libs/circular_buffer/doc/update_srcdoc.sh 2013-08-29 04:39:09 EDT (Thu, 29 Aug 2013) (r85509)
+++ /dev/null 00:00:00 1970 (deleted)
@@ -1,54 +0,0 @@
-#!/bin/sh
-################################################################################
-# Shell script which updates the Circular Buffer library documentation with #
-# the latest source code documentation (which is in the source files). #
-# #
-# Copyright (c) 2003-2008 Jan Gaspar #
-# #
-# Use, modification, and distribution is subject to the Boost Software #
-# License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at #
-# http://www.boost.org/LICENSE_1_0.txt) #
-################################################################################
-
-CONTAINER=$1
-DOCFILE="$CONTAINER.html"
-XSLT="$CONTAINER.xslt"
-XHTML="$CONTAINER.xhtml"
-SPECIALIZATION=${CONTAINER#circular_buffer_}
-
-if [ ${#SPECIALIZATION} -gt 0 ]; then
- DOCFILE=${DOCFILE#circular_buffer_}
- XSLT=${XSLT#circular_buffer_}
- XHTML=${XHTML#circular_buffer_}
-fi
-
-if [ -f $DOCFILE ]; then
-
- echo Starting Doxygen ...
- doxygen
-
- echo Converting Doxygen generated source code documentation into XHTML ...
- xsltproc --stringparam container $CONTAINER --stringparam xmldir srcdoc -o srcdoc/srcdoc.xhtml $XSLT srcdoc/index.xml
-
- echo Preprocessing $DOCFILE ...
- sed 's/<a\s*id="[^"]*"/<a /g' $DOCFILE | sed 's/<a\s*\(name="[^"]*"\)\s*\(id="[^"]*"\)/<a \1/g' > srcdoc/$DOCFILE
-
- echo Converting preprocessed $DOCFILE into XHTML ...
- xsltproc --html -o srcdoc/$XHTML html2xhtml.xslt srcdoc/$DOCFILE
-
- echo Generating $DOCFILE with updated source code documentation ...
- xsltproc --stringparam srcdoc srcdoc/srcdoc.xhtml -o $DOCFILE update_srcdoc.xslt srcdoc/$XHTML
-
- echo Correcting and pretty-printing $DOCFILE with HTML Tidy ...
- tidy -ashtml -config Tidy.conf $DOCFILE
-
- echo Removing temporary directory ...
- rm -rf srcdoc
-
- echo Done.
-
-else
-
- echo Usage: update_srcdoc.sh container
-
-fi
Deleted: branches/release/libs/circular_buffer/doc/update_srcdoc.xslt
==============================================================================
--- branches/release/libs/circular_buffer/doc/update_srcdoc.xslt 2013-08-29 04:39:09 EDT (Thu, 29 Aug 2013) (r85509)
+++ /dev/null 00:00:00 1970 (deleted)
@@ -1,25 +0,0 @@
-<?xml version='1.0' encoding='iso-8859-1'?>
-<!--
-Helper XSL transformation updating source code documentation sections
-in the specified HTML file.
-
-Copyright (c) 2003-2008 Jan Gaspar
-
-Use, modification, and distribution is subject to the Boost Software
-License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-http://www.boost.org/LICENSE_1_0.txt)
--->
-
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
-
- <xsl:import href="copy.xslt"/>
-
- <xsl:output method="html" version="1.0" encoding="iso-8859-1" indent="yes" omit-xml-declaration="yes" media-type="text/html"/>
-
- <xsl:param name="srcdoc"/>
-
- <xsl:template match="div[contains(@id, 'srcdoc')]">
- <xsl:copy-of select="document($srcdoc)//body/div[@id=current()/@id]"/>
- </xsl:template>
-
-</xsl:stylesheet>
Copied: branches/release/libs/circular_buffer/example/bounded_buffer_comparison.cpp (from r84771, trunk/libs/circular_buffer/example/bounded_buffer_comparison.cpp)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/release/libs/circular_buffer/example/bounded_buffer_comparison.cpp 2013-08-29 04:39:09 EDT (Thu, 29 Aug 2013) (r85510, copy of r84771, trunk/libs/circular_buffer/example/bounded_buffer_comparison.cpp)
@@ -0,0 +1,318 @@
+// Comparison of bounded buffers based on different containers.
+
+// Copyright (c) 2003-2008 Jan Gaspar
+// Copyright 2013 Paul A. Bristow. Added some Quickbook snippet markers.
+
+// Use, modification, and distribution is subject to the Boost Software
+// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#define BOOST_CB_DISABLE_DEBUG
+
+#include <boost/circular_buffer.hpp>
+#include <boost/thread/mutex.hpp>
+#include <boost/thread/condition.hpp>
+#include <boost/thread/thread.hpp>
+#include <boost/call_traits.hpp>
+#include <boost/progress.hpp>
+#include <boost/bind.hpp>
+#include <deque>
+#include <list>
+#include <string>
+#include <iostream>
+
+const unsigned long QUEUE_SIZE = 1000L;
+const unsigned long TOTAL_ELEMENTS = QUEUE_SIZE * 1000L;
+
+template <class T>
+class bounded_buffer {
+public:
+
+ typedef boost::circular_buffer<T> container_type;
+ typedef typename container_type::size_type size_type;
+ typedef typename container_type::value_type value_type;
+ typedef typename boost::call_traits<value_type>::param_type param_type;
+
+ explicit bounded_buffer(size_type capacity) : m_unread(0), m_container(capacity) {}
+
+ void push_front(param_type item) {
+ boost::mutex::scoped_lock lock(m_mutex);
+ m_not_full.wait(lock, boost::bind(&bounded_buffer<value_type>::is_not_full, this));
+ m_container.push_front(item);
+ ++m_unread;
+ lock.unlock();
+ m_not_empty.notify_one();
+ }
+
+ void pop_back(value_type* pItem) {
+ boost::mutex::scoped_lock lock(m_mutex);
+ m_not_empty.wait(lock, boost::bind(&bounded_buffer<value_type>::is_not_empty, this));
+ *pItem = m_container[--m_unread];
+ lock.unlock();
+ m_not_full.notify_one();
+ }
+
+private:
+ bounded_buffer(const bounded_buffer&); // Disabled copy constructor
+ bounded_buffer& operator = (const bounded_buffer&); // Disabled assign operator
+
+ bool is_not_empty() const { return m_unread > 0; }
+ bool is_not_full() const { return m_unread < m_container.capacity(); }
+
+ size_type m_unread;
+ container_type m_container;
+ boost::mutex m_mutex;
+ boost::condition m_not_empty;
+ boost::condition m_not_full;
+};
+
+template <class T>
+class bounded_buffer_space_optimized {
+public:
+
+ typedef boost::circular_buffer_space_optimized<T> container_type;
+ typedef typename container_type::size_type size_type;
+ typedef typename container_type::value_type value_type;
+ typedef typename boost::call_traits<value_type>::param_type param_type;
+
+ explicit bounded_buffer_space_optimized(size_type capacity) : m_container(capacity) {}
+
+ void push_front(param_type item) {
+ boost::mutex::scoped_lock lock(m_mutex);
+ m_not_full.wait(lock, boost::bind(&bounded_buffer_space_optimized<value_type>::is_not_full, this));
+ m_container.push_front(item);
+ lock.unlock();
+ m_not_empty.notify_one();
+ }
+
+ void pop_back(value_type* pItem) {
+ boost::mutex::scoped_lock lock(m_mutex);
+ m_not_empty.wait(lock, boost::bind(&bounded_buffer_space_optimized<value_type>::is_not_empty, this));
+ *pItem = m_container.back();
+ m_container.pop_back();
+ lock.unlock();
+ m_not_full.notify_one();
+ }
+
+private:
+
+ bounded_buffer_space_optimized(const bounded_buffer_space_optimized&); // Disabled copy constructor
+ bounded_buffer_space_optimized& operator = (const bounded_buffer_space_optimized&); // Disabled assign operator
+
+ bool is_not_empty() const { return m_container.size() > 0; }
+ bool is_not_full() const { return m_container.size() < m_container.capacity(); }
+
+ container_type m_container;
+ boost::mutex m_mutex;
+ boost::condition m_not_empty;
+ boost::condition m_not_full;
+};
+
+template <class T>
+class bounded_buffer_deque_based {
+public:
+
+ typedef std::deque<T> container_type;
+ typedef typename container_type::size_type size_type;
+ typedef typename container_type::value_type value_type;
+ typedef typename boost::call_traits<value_type>::param_type param_type;
+
+ explicit bounded_buffer_deque_based(size_type capacity) : m_capacity(capacity) {}
+
+ void push_front(param_type item) {
+ boost::mutex::scoped_lock lock(m_mutex);
+ m_not_full.wait(lock, boost::bind(&bounded_buffer_deque_based<value_type>::is_not_full, this));
+ m_container.push_front(item);
+ lock.unlock();
+ m_not_empty.notify_one();
+ }
+
+ void pop_back(value_type* pItem) {
+ boost::mutex::scoped_lock lock(m_mutex);
+ m_not_empty.wait(lock, boost::bind(&bounded_buffer_deque_based<value_type>::is_not_empty, this));
+ *pItem = m_container.back();
+ m_container.pop_back();
+ lock.unlock();
+ m_not_full.notify_one();
+ }
+
+private:
+
+ bounded_buffer_deque_based(const bounded_buffer_deque_based&); // Disabled copy constructor
+ bounded_buffer_deque_based& operator = (const bounded_buffer_deque_based&); // Disabled assign operator
+
+ bool is_not_empty() const { return m_container.size() > 0; }
+ bool is_not_full() const { return m_container.size() < m_capacity; }
+
+ const size_type m_capacity;
+ container_type m_container;
+ boost::mutex m_mutex;
+ boost::condition m_not_empty;
+ boost::condition m_not_full;
+};
+
+template <class T>
+class bounded_buffer_list_based {
+public:
+
+ typedef std::list<T> container_type;
+ typedef typename container_type::size_type size_type;
+ typedef typename container_type::value_type value_type;
+ typedef typename boost::call_traits<value_type>::param_type param_type;
+
+ explicit bounded_buffer_list_based(size_type capacity) : m_capacity(capacity) {}
+
+ void push_front(param_type item) {
+ boost::mutex::scoped_lock lock(m_mutex);
+ m_not_full.wait(lock, boost::bind(&bounded_buffer_list_based<value_type>::is_not_full, this));
+ m_container.push_front(item);
+ lock.unlock();
+ m_not_empty.notify_one();
+ }
+
+ void pop_back(value_type* pItem) {
+ boost::mutex::scoped_lock lock(m_mutex);
+ m_not_empty.wait(lock, boost::bind(&bounded_buffer_list_based<value_type>::is_not_empty, this));
+ *pItem = m_container.back();
+ m_container.pop_back();
+ lock.unlock();
+ m_not_full.notify_one();
+ }
+
+private:
+
+ bounded_buffer_list_based(const bounded_buffer_list_based&); // Disabled copy constructor
+ bounded_buffer_list_based& operator = (const bounded_buffer_list_based&); // Disabled assign operator
+
+ bool is_not_empty() const { return m_container.size() > 0; }
+ bool is_not_full() const { return m_container.size() < m_capacity; }
+
+ const size_type m_capacity;
+ container_type m_container;
+ boost::mutex m_mutex;
+ boost::condition m_not_empty;
+ boost::condition m_not_full;
+};
+
+template<class Buffer>
+class Consumer {
+
+ typedef typename Buffer::value_type value_type;
+ Buffer* m_container;
+ value_type m_item;
+
+public:
+ Consumer(Buffer* buffer) : m_container(buffer) {}
+
+ void operator()() {
+ for (unsigned long i = 0L; i < TOTAL_ELEMENTS; ++i) {
+ m_container->pop_back(&m_item);
+ }
+ }
+};
+
+template<class Buffer>
+class Producer {
+
+ typedef typename Buffer::value_type value_type;
+ Buffer* m_container;
+
+public:
+ Producer(Buffer* buffer) : m_container(buffer) {}
+
+ void operator()() {
+ for (unsigned long i = 0L; i < TOTAL_ELEMENTS; ++i) {
+ m_container->push_front(value_type());
+ }
+ }
+};
+
+template<class Buffer>
+void fifo_test(Buffer* buffer) {
+
+ // Start of measurement
+ boost::progress_timer progress;
+
+ // Initialize the buffer with some values before launching producer and consumer threads.
+ for (unsigned long i = QUEUE_SIZE / 2L; i > 0; --i) {
+#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x581))
+ buffer->push_front(Buffer::value_type());
+#else
+ buffer->push_front(BOOST_DEDUCED_TYPENAME Buffer::value_type());
+#endif
+ }
+
+ Consumer<Buffer> consumer(buffer);
+ Producer<Buffer> producer(buffer);
+
+ // Start the threads.
+ boost::thread consume(consumer);
+ boost::thread produce(producer);
+
+ // Wait for completion.
+ consume.join();
+ produce.join();
+
+ // End of measurement
+}
+
+int main(int /*argc*/, char* /*argv*/[]) {
+
+ bounded_buffer<int> bb_int(QUEUE_SIZE);
+ std::cout << "bounded_buffer<int> ";
+ fifo_test(&bb_int);
+
+ bounded_buffer_space_optimized<int> bb_space_optimized_int(QUEUE_SIZE);
+ std::cout << "bounded_buffer_space_optimized<int> ";
+ fifo_test(&bb_space_optimized_int);
+
+ bounded_buffer_deque_based<int> bb_deque_based_int(QUEUE_SIZE);
+ std::cout << "bounded_buffer_deque_based<int> ";
+ fifo_test(&bb_deque_based_int);
+
+ bounded_buffer_list_based<int> bb_list_based_int(QUEUE_SIZE);
+ std::cout << "bounded_buffer_list_based<int> ";
+ fifo_test(&bb_list_based_int);
+
+ bounded_buffer<std::string> bb_string(QUEUE_SIZE);
+ std::cout << "bounded_buffer<std::string> ";
+ fifo_test(&bb_string);
+
+ bounded_buffer_space_optimized<std::string> bb_space_optimized_string(QUEUE_SIZE);
+ std::cout << "bounded_buffer_space_optimized<std::string> ";
+ fifo_test(&bb_space_optimized_string);
+
+ bounded_buffer_deque_based<std::string> bb_deque_based_string(QUEUE_SIZE);
+ std::cout << "bounded_buffer_deque_based<std::string> ";
+ fifo_test(&bb_deque_based_string);
+
+ bounded_buffer_list_based<std::string> bb_list_based_string(QUEUE_SIZE);
+ std::cout << "bounded_buffer_list_based<std::string> ";
+ fifo_test(&bb_list_based_string);
+
+ return 0;
+}
+/*
+
+//[bounded_buffer_comparison_output
+
+ Description: Autorun "J:\Cpp\Misc\Debug\bounded_buffer_comparison.exe"
+ bounded_buffer<int> 5.15 s
+
+ bounded_buffer_space_optimized<int> 5.71 s
+
+ bounded_buffer_deque_based<int> 15.57 s
+
+ bounded_buffer_list_based<int> 17.33 s
+
+ bounded_buffer<std::string> 24.49 s
+
+ bounded_buffer_space_optimized<std::string> 28.33 s
+
+ bounded_buffer_deque_based<std::string> 29.45 s
+
+ bounded_buffer_list_based<std::string> 31.29 s
+
+ //] //[bounded_buffer_comparison_output]
+
+*/
Copied: branches/release/libs/circular_buffer/example/circular_buffer_bound_example.cpp (from r84771, trunk/libs/circular_buffer/example/circular_buffer_bound_example.cpp)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/release/libs/circular_buffer/example/circular_buffer_bound_example.cpp 2013-08-29 04:39:09 EDT (Thu, 29 Aug 2013) (r85510, copy of r84771, trunk/libs/circular_buffer/example/circular_buffer_bound_example.cpp)
@@ -0,0 +1,191 @@
+// Copyright 2003-2008 Jan Gaspar.
+// Copyright 2013 Paul A. Bristow. Added some Quickbook snippet markers.
+
+// Distributed under the Boost Software License, Version 1.0.
+// (See the accompanying file LICENSE_1_0.txt
+// or a copy at <http://www.boost.org/LICENSE_1_0.txt>.)
+
+//[circular_buffer_bound_example_1
+/*`
+This example shows how the `circular_buffer` can be utilized
+as an underlying container of the bounded buffer.
+*/
+
+#include <boost/circular_buffer.hpp>
+#include <boost/thread/mutex.hpp>
+#include <boost/thread/condition.hpp>
+#include <boost/thread/thread.hpp>
+#include <boost/call_traits.hpp>
+#include <boost/bind.hpp>
+
+#include <boost/timer/timer.hpp> // for auto_cpu_timer
+
+template <class T>
+class bounded_buffer
+{
+public:
+
+ typedef boost::circular_buffer<T> container_type;
+ typedef typename container_type::size_type size_type;
+ typedef typename container_type::value_type value_type;
+ typedef typename boost::call_traits<value_type>::param_type param_type;
+
+ explicit bounded_buffer(size_type capacity) : m_unread(0), m_container(capacity) {}
+
+ void push_front(typename boost::call_traits<value_type>::param_type item)
+ { // `param_type` represents the "best" way to pass a parameter of type `value_type` to a method.
+
+ boost::mutex::scoped_lock lock(m_mutex);
+ m_not_full.wait(lock, boost::bind(&bounded_buffer<value_type>::is_not_full, this));
+ m_container.push_front(item);
+ ++m_unread;
+ lock.unlock();
+ m_not_empty.notify_one();
+ }
+
+ void pop_back(value_type* pItem) {
+ boost::mutex::scoped_lock lock(m_mutex);
+ m_not_empty.wait(lock, boost::bind(&bounded_buffer<value_type>::is_not_empty, this));
+ *pItem = m_container[--m_unread];
+ lock.unlock();
+ m_not_full.notify_one();
+ }
+
+private:
+ bounded_buffer(const bounded_buffer&); // Disabled copy constructor.
+ bounded_buffer& operator = (const bounded_buffer&); // Disabled assign operator.
+
+ bool is_not_empty() const { return m_unread > 0; }
+ bool is_not_full() const { return m_unread < m_container.capacity(); }
+
+ size_type m_unread;
+ container_type m_container;
+ boost::mutex m_mutex;
+ boost::condition m_not_empty;
+ boost::condition m_not_full;
+}; //
+
+//] [/circular_buffer_bound_example_1]
+
+const unsigned long queue_size = 1000L;
+const unsigned long total_elements = queue_size * 1000L;
+
+//[circular_buffer_bound_example_2]
+/*`To demonstrate, create two classes to exercise the buffer.
+
+The producer class fills the buffer with elements.
+
+The consumer class consumes the buffer contents.
+
+*/
+
+template<class Buffer>
+class Producer
+{
+
+ typedef typename Buffer::value_type value_type;
+ Buffer* m_container;
+
+public:
+ Producer(Buffer* buffer) : m_container(buffer)
+ {}
+
+ void operator()()
+ {
+ for (unsigned long i = 0L; i < total_elements; ++i)
+ {
+ m_container->push_front(value_type());
+ }
+ }
+};
+
+template<class Buffer>
+class Consumer
+{
+
+ typedef typename Buffer::value_type value_type;
+ Buffer* m_container;
+ value_type m_item;
+
+public:
+ Consumer(Buffer* buffer) : m_container(buffer)
+ {}
+
+ void operator()()
+ {
+ for (unsigned long i = 0L; i < total_elements; ++i)
+ {
+ m_container->pop_back(&m_item);
+ }
+ }
+};
+
+/*`Create a first-int first-out test of the bound_buffer.
+Include a call to boost::progress_timer
+
+[@http://www.boost.org/doc/libs/1_53_0/libs/timer/doc/cpu_timers.html CPU timer]
+
+*/
+template<class Buffer>
+void fifo_test(Buffer* buffer)
+{
+ // Start of timing.
+ boost::timer::auto_cpu_timer progress;
+
+ // Initialize the buffer with some values before launching producer and consumer threads.
+ for (unsigned long i = queue_size / 2L; i > 0; --i)
+ {
+#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x581))
+ buffer->push_front(Buffer::value_type());
+#else
+ buffer->push_front(BOOST_DEDUCED_TYPENAME Buffer::value_type());
+#endif
+ }
+
+ // Construct the threads.
+ Consumer<Buffer> consumer(buffer);
+ Producer<Buffer> producer(buffer);
+
+ // Start the threads.
+ boost::thread consume(consumer);
+ boost::thread produce(producer);
+
+ // Wait for completion.
+ consume.join();
+ produce.join();
+
+ // End of timing.
+ // destructor of boost::timer::auto_cpu_timer will output the time to std::cout.
+
+}
+//] [/circular_buffer_bound_example_2]
+
+
+int main()
+{
+//[circular_buffer_bound_example_3]
+ //`Construct a bounded_buffer to hold the chosen type, here int.
+ bounded_buffer<int> bb_int(queue_size);
+ std::cout << "Testing bounded_buffer<int> ";
+
+ //`Start the fifo test.
+ fifo_test(&bb_int);
+ //` destructor of boost::timer::auto_cpu_timer will output the time to std::cout
+
+//] [/circular_buffer_bound_example_3]
+
+return 0;
+} // int main()
+
+/*
+
+//[circular_buffer_bound_output
+
+ Description: Autorun "J:\Cpp\Misc\Debug\circular_buffer_bound_example.exe"
+
+ Testing bounded_buffer<int> 15.010692s wall, 9.188459s user + 7.207246s system = 16.395705s CPU (109.2%)
+
+//] [/circular_buffer_bound_output]
+*/
+
+
Copied: branches/release/libs/circular_buffer/example/circular_buffer_example.cpp (from r84771, trunk/libs/circular_buffer/example/circular_buffer_example.cpp)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/release/libs/circular_buffer/example/circular_buffer_example.cpp 2013-08-29 04:39:09 EDT (Thu, 29 Aug 2013) (r85510, copy of r84771, trunk/libs/circular_buffer/example/circular_buffer_example.cpp)
@@ -0,0 +1,63 @@
+// Copyright 2003-2008 Jan Gaspar.
+// Copyright 2013 Paul A. Bristow. Added some Quickbook snippet markers.
+
+// Distributed under the Boost Software License, Version 1.0.
+// (See the accompanying file LICENSE_1_0.txt
+// or a copy at <http://www.boost.org/LICENSE_1_0.txt>.)
+
+//[circular_buffer_example_1
+/*`For all examples, we need this include:
+*/
+
+#include <boost/circular_buffer.hpp>
+
+//] [/circular_buffer_example_1]
+
+ int main()
+ {
+
+//[circular_buffer_example_2
+ // Create a circular buffer with a capacity for 3 integers.
+ boost::circular_buffer<int> cb(3);
+
+ // Insert threee elements into the buffer.
+ cb.push_back(1);
+ cb.push_back(2);
+ cb.push_back(3);
+
+ int a = cb[0]; // a == 1
+ int b = cb[1]; // b == 2
+ int c = cb[2]; // c == 3
+
+ // The buffer is full now, so pushing subsequent
+ // elements will overwrite the front-most elements.
+
+ cb.push_back(4); // Overwrite 1 with 4.
+ cb.push_back(5); // Overwrite 2 with 5.
+
+ // The buffer now contains 3, 4 and 5.
+ a = cb[0]; // a == 3
+ b = cb[1]; // b == 4
+ c = cb[2]; // c == 5
+
+ // Elements can be popped from either the front or the back.
+ cb.pop_back(); // 5 is removed.
+ cb.pop_front(); // 3 is removed.
+
+ // Leaving only one element with value = 4.
+ int d = cb[0]; // d == 4
+
+//] [/circular_buffer_example_2]
+ return 0;
+ }
+
+ /*
+
+ //[circular_buffer_example_output
+
+There is no output from this example.
+
+//] [/circular_buffer_example_output]
+
+ */
+
Copied: branches/release/libs/circular_buffer/example/circular_buffer_examples.bat (from r84771, trunk/libs/circular_buffer/example/circular_buffer_examples.bat)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/release/libs/circular_buffer/example/circular_buffer_examples.bat 2013-08-29 04:39:09 EDT (Thu, 29 Aug 2013) (r85510, copy of r84771, trunk/libs/circular_buffer/example/circular_buffer_examples.bat)
@@ -0,0 +1,14 @@
+echo off
+rem quickbook doxgen auto-index docs template circular_buffer_html_index.bat
+rem echo circular_buffer_html_index_%date%_%time:~0,2%_%time:~3,2%.log
+rem The DOS time format is assumed 12:34 and the : separator is not used.
+set t=%time% /T
+set tim=%t:~0,2%%t:~3,2%
+rem pick just hours and minutes.
+rem time may include leading space, like " 915", so remove space.
+set tim=%tim: =%
+rem boost-no-inspect
+rem cd \boost-trunk/circular_buffer\libs\circular_buffer\example
+bjam -a > circular_buffer_examples_%date%_%tim%.log
+if not ERRORLEVEL 0 (echo Errorlevel is %ERRORLEVEL%) else (echo OK)
+pause
Copied: branches/release/libs/circular_buffer/example/circular_buffer_iter_example.cpp (from r84771, trunk/libs/circular_buffer/example/circular_buffer_iter_example.cpp)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/release/libs/circular_buffer/example/circular_buffer_iter_example.cpp 2013-08-29 04:39:09 EDT (Thu, 29 Aug 2013) (r85510, copy of r84771, trunk/libs/circular_buffer/example/circular_buffer_iter_example.cpp)
@@ -0,0 +1,38 @@
+// Copyright 2003-2008 Jan Gaspar.
+// Copyright 2013 Paul A. Bristow. Added some Quickbook snippet markers.
+
+// Distributed under the Boost Software License, Version 1.0.
+// (See the accompanying file LICENSE_1_0.txt
+// or a copy at <http://www.boost.org/LICENSE_1_0.txt>.)
+
+//[circular_buffer_iter_example_1
+/*`
+*/
+
+#define BOOST_CB_DISABLE_DEBUG // The Debug Support has to be disabled, otherwise the code produces a runtime error.
+
+#include <boost/circular_buffer.hpp>
+#include <boost/assert.hpp>
+#include <assert.h>
+
+int main(int /*argc*/, char* /*argv*/[])
+{
+
+ boost::circular_buffer<int> cb(3);
+
+ cb.push_back(1);
+ cb.push_back(2);
+ cb.push_back(3);
+
+ boost::circular_buffer<int>::iterator it = cb.begin();
+
+ assert(*it == 1);
+
+ cb.push_back(4);
+
+ assert(*it == 4); // The iterator still points to the initialized memory.
+
+ return 0;
+}
+
+ //] [/circular_buffer_iter_example_1]
Copied: branches/release/libs/circular_buffer/example/circular_buffer_sum_example.cpp (from r84771, trunk/libs/circular_buffer/example/circular_buffer_sum_example.cpp)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/release/libs/circular_buffer/example/circular_buffer_sum_example.cpp 2013-08-29 04:39:09 EDT (Thu, 29 Aug 2013) (r85510, copy of r84771, trunk/libs/circular_buffer/example/circular_buffer_sum_example.cpp)
@@ -0,0 +1,64 @@
+// Copyright 2003-2008 Jan Gaspar.
+// Copyright 2013 Paul A. Bristow. Added some Quickbook snippet markers.
+
+// Distributed under the Boost Software License, Version 1.0.
+// (See the accompanying file LICENSE_1_0.txt
+// or a copy at <http://www.boost.org/LICENSE_1_0.txt>.)
+
+//[circular_buffer_sum_example_1
+
+/*`This example shows several functions, including summing all valid values.
+*/
+
+ #include <boost/circular_buffer.hpp>
+ #include <numeric>
+ #include <assert.h>
+
+ int main(int /*argc*/, char* /*argv*/[])
+ {
+ // Create a circular buffer of capacity 3.
+ boost::circular_buffer<int> cb(3);
+ assert(cb.capacity() == 3);
+ // Check is empty.
+ assert(cb.size() == 0);
+ assert(cb.empty());
+
+ // Insert some elements into the circular buffer.
+ cb.push_back(1);
+ cb.push_back(2);
+
+ // Assertions to check push_backs have expected effect.
+ assert(cb[0] == 1);
+ assert(cb[1] == 2);
+ assert(!cb.full());
+ assert(cb.size() == 2);
+ assert(cb.capacity() == 3);
+
+ // Insert some other elements.
+ cb.push_back(3);
+ cb.push_back(4);
+
+ // Evaluate the sum of all elements.
+ int sum = std::accumulate(cb.begin(), cb.end(), 0);
+
+ // Assertions to check state.
+ assert(sum == 9);
+ assert(cb[0] == 2);
+ assert(cb[1] == 3);
+ assert(cb[2] == 4);
+ assert(*cb.begin() == 2);
+ assert(cb.front() == 2);
+ assert(cb.back() == 4);
+ assert(cb.full());
+ assert(cb.size() == 3);
+ assert(cb.capacity() == 3);
+
+ return 0;
+ }
+
+ //] [/circular_buffer_sum_example_1]
+
+
+ /*
+ There is no output from this example.
+ */
Copied: branches/release/libs/circular_buffer/example/jamfile.v2 (from r84771, trunk/libs/circular_buffer/example/jamfile.v2)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/release/libs/circular_buffer/example/jamfile.v2 2013-08-29 04:39:09 EDT (Thu, 29 Aug 2013) (r85510, copy of r84771, trunk/libs/circular_buffer/example/jamfile.v2)
@@ -0,0 +1,42 @@
+# Copyright Paul A. Bristow 2013
+
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+# jamfile.v2 to run all circular_buffer examples.
+
+# bring in the rules for testing.
+import testing ;
+
+project
+ : requirements
+ <library>/boost/system//boost_system
+ <library>/boost/thread//boost_thread
+ #<define>BOOST_ALL_NO_LIB=1
+ <threading>multi
+
+ <toolset>gcc:<cxxflags>-Wno-missing-braces
+ <toolset>darwin:<cxxflags>-Wno-missing-braces
+ <toolset>acc:<cxxflags>+W2068,2461,2236,4070
+ <toolset>intel:<cxxflags>-Qwd264,239
+ <toolset>msvc:<warnings>all
+ <toolset>msvc:<asynch-exceptions>on
+ <toolset>msvc:<define>_CRT_SECURE_NO_DEPRECATE
+ <toolset>msvc:<define>_SCL_SECURE_NO_DEPRECATE
+ <toolset>msvc:<define>_SCL_SECURE_NO_WARNINGS
+ <toolset>msvc:<define>_CRT_SECURE_NO_WARNINGS
+ <toolset>msvc:<cxxflags>/wd4996
+ <toolset>msvc:<cxxflags>/wd4512
+ <toolset>msvc:<cxxflags>/wd4610
+ <toolset>msvc:<cxxflags>/wd4510
+ <toolset>msvc:<cxxflags>/wd4127
+ <toolset>msvc:<cxxflags>/wd4701
+ <toolset>msvc:<cxxflags>/wd4127
+ <toolset>msvc:<cxxflags>/wd4305
+ ;
+
+run bounded_buffer_comparison.cpp ;
+run circular_buffer_iter_example.cpp ;
+run circular_buffer_sum_example.cpp ;
+run circular_buffer_bound_example.cpp ../../thread/build//boost_thread ../../timer/build//boost_timer ;
+
Modified: branches/release/libs/circular_buffer/index.html
==============================================================================
--- branches/release/libs/circular_buffer/index.html Thu Aug 29 02:10:38 2013 (r85509)
+++ branches/release/libs/circular_buffer/index.html 2013-08-29 04:39:09 EDT (Thu, 29 Aug 2013) (r85510)
@@ -2,16 +2,17 @@
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
- <meta http-equiv="refresh" content="0; URL=doc/circular_buffer.html">
+ <meta http-equiv="refresh" content="0; URL=../../doc/html/circular_buffer.html">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>
Redirection
</title>
</head>
<body>
- Automatic redirection failed, please go to circular_buffer.html.
+ Automatic redirection failed, please go to
+ ../../doc/html/circular_buffer.html.
<p>
- <small>Copyright © 2003-2008 Jan Gaspar</small>
+ <small>Copyright © 2003-2008 Jan Gaspar, 2013 Paul A. Bristow</small>
</p>
<p>
<small>Use, modification, and distribution is subject to the Boost Software License, Version 1.0.<br>
@@ -20,3 +21,5 @@
</p>
</body>
</html>
+
+
Modified: branches/release/libs/circular_buffer/test/base_test.cpp
==============================================================================
--- branches/release/libs/circular_buffer/test/base_test.cpp Thu Aug 29 02:10:38 2013 (r85509)
+++ branches/release/libs/circular_buffer/test/base_test.cpp 2013-08-29 04:39:09 EDT (Thu, 29 Aug 2013) (r85510)
@@ -1,6 +1,7 @@
// Test of the base circular buffer container.
// Copyright (c) 2003-2008 Jan Gaspar
+// Copyright (c) 2013 Antony Polukhin
// Use, modification, and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -738,6 +739,107 @@
#endif // #if !defined(BOOST_NO_EXCEPTIONS)
}
+
+void move_container_values_except() {
+ move_container_values_impl<noncopyable_movable_except_t>();
+}
+
+template <class T>
+void move_container_values_resetting_impl() {
+ typedef T noncopyable_movable_test_t;
+ CB_CONTAINER<noncopyable_movable_test_t> cb1(1);
+ noncopyable_movable_test_t var;
+ cb1.push_back();
+
+ cb1.push_back(boost::move(var));
+ BOOST_CHECK(!cb1.back().is_moved());
+ BOOST_CHECK(var.is_moved());
+ BOOST_CHECK(cb1.size() == 1);
+ var = boost::move(cb1.back());
+ BOOST_CHECK(cb1.back().is_moved());
+
+ cb1.push_front(boost::move(var));
+ BOOST_CHECK(!cb1.front().is_moved());
+ BOOST_CHECK(var.is_moved());
+ BOOST_CHECK(cb1.size() == 1);
+ var = boost::move(cb1.back());
+ BOOST_CHECK(cb1.back().is_moved());
+
+ cb1.push_back();
+ BOOST_CHECK(!cb1.back().is_moved());
+ BOOST_CHECK(cb1.size() == 1);
+ var = boost::move(cb1.back());
+ BOOST_CHECK(cb1.back().is_moved());
+
+ cb1.push_front();
+ BOOST_CHECK(!cb1.front().is_moved());
+ BOOST_CHECK(cb1.size() == 1);
+ var = boost::move(cb1.back());
+ BOOST_CHECK(cb1.back().is_moved());
+
+
+ cb1.insert(cb1.begin());
+ // If the circular_buffer is full and the pos points to begin(),
+ // then the item will not be inserted.
+ BOOST_CHECK(cb1.front().is_moved());
+ BOOST_CHECK(cb1.size() == 1);
+ var = boost::move(cb1.back());
+ BOOST_CHECK(cb1.back().is_moved());
+
+ cb1.insert(cb1.begin(), boost::move(var));
+ // If the circular_buffer is full and the pos points to begin(),
+ // then the item will not be inserted.
+ BOOST_CHECK(cb1.front().is_moved());
+ BOOST_CHECK(cb1.size() == 1);
+ var = boost::move(cb1.back());
+ BOOST_CHECK(cb1.back().is_moved());
+
+ cb1.rinsert(cb1.begin());
+ BOOST_CHECK(!cb1.back().is_moved());
+ BOOST_CHECK(cb1.size() == 1);
+ var = boost::move(cb1.back());
+ BOOST_CHECK(cb1.back().is_moved());
+
+ var.reinit();
+ cb1.rinsert(cb1.begin(), boost::move(var));
+ BOOST_CHECK(!cb1.back().is_moved());
+ BOOST_CHECK(cb1.size() == 1);
+ var = boost::move(cb1.back());
+ BOOST_CHECK(cb1.back().is_moved());
+
+ cb1.rinsert(cb1.end());
+ BOOST_CHECK(cb1.back().is_moved());
+ BOOST_CHECK(cb1.size() == 1);
+ var = boost::move(cb1.back());
+ BOOST_CHECK(cb1.back().is_moved());
+
+ var.reinit();
+ cb1.rinsert(cb1.end(), boost::move(var));
+ BOOST_CHECK(cb1.back().is_moved());
+ BOOST_CHECK(cb1.size() == 1);
+ var = boost::move(cb1.back());
+ BOOST_CHECK(cb1.back().is_moved());
+ cb1.push_back();
+ BOOST_CHECK(!cb1[0].is_moved());
+
+ const int val = cb1[0].value();
+ cb1.linearize();
+ BOOST_CHECK(!cb1[0].is_moved());
+ BOOST_CHECK(cb1[0].value() == val);
+
+ cb1.rotate(cb1.begin());
+ BOOST_CHECK(!cb1[0].is_moved());
+ BOOST_CHECK(cb1[0].value() == val);
+}
+
+void move_container_values_resetting_except() {
+ move_container_values_resetting_impl<noncopyable_movable_except_t>();
+}
+
+void move_container_values_resetting_noexcept() {
+ move_container_values_resetting_impl<noncopyable_movable_noexcept_t>();
+}
+
// test main
test_suite* init_unit_test_suite(int /*argc*/, char* /*argv*/[]) {
@@ -755,6 +857,9 @@
tests->add(BOOST_TEST_CASE(&iterator_comparison_test));
tests->add(BOOST_TEST_CASE(&iterator_invalidation_test));
tests->add(BOOST_TEST_CASE(&exception_safety_test));
+ tests->add(BOOST_TEST_CASE(&move_container_values_except));
+ tests->add(BOOST_TEST_CASE(&move_container_values_resetting_except));
+ tests->add(BOOST_TEST_CASE(&move_container_values_resetting_noexcept));
return tests;
}
Modified: branches/release/libs/circular_buffer/test/bounded_buffer_comparison.cpp
==============================================================================
--- branches/release/libs/circular_buffer/test/bounded_buffer_comparison.cpp Thu Aug 29 02:10:38 2013 (r85509)
+++ branches/release/libs/circular_buffer/test/bounded_buffer_comparison.cpp 2013-08-29 04:39:09 EDT (Thu, 29 Aug 2013) (r85510)
@@ -1,6 +1,7 @@
// Comparison of bounded buffers based on different containers.
// Copyright (c) 2003-2008 Jan Gaspar
+// Copyright 2013 Paul A. Bristow. Added some Quickbook snippet markers.
// Use, modification, and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -10,7 +11,7 @@
#include <boost/circular_buffer.hpp>
#include <boost/thread/mutex.hpp>
-#include <boost/thread/condition.hpp>
+#include <boost/thread/condition_variable.hpp>
#include <boost/thread/thread.hpp>
#include <boost/call_traits.hpp>
#include <boost/progress.hpp>
@@ -35,7 +36,7 @@
explicit bounded_buffer(size_type capacity) : m_unread(0), m_container(capacity) {}
void push_front(param_type item) {
- boost::mutex::scoped_lock lock(m_mutex);
+ boost::unique_lock<boost::mutex> lock(m_mutex);
m_not_full.wait(lock, boost::bind(&bounded_buffer<value_type>::is_not_full, this));
m_container.push_front(item);
++m_unread;
@@ -44,7 +45,7 @@
}
void pop_back(value_type* pItem) {
- boost::mutex::scoped_lock lock(m_mutex);
+ boost::unique_lock<boost::mutex> lock(m_mutex);
m_not_empty.wait(lock, boost::bind(&bounded_buffer<value_type>::is_not_empty, this));
*pItem = m_container[--m_unread];
lock.unlock();
@@ -61,8 +62,8 @@
size_type m_unread;
container_type m_container;
boost::mutex m_mutex;
- boost::condition m_not_empty;
- boost::condition m_not_full;
+ boost::condition_variable m_not_empty;
+ boost::condition_variable m_not_full;
};
template <class T>
@@ -77,7 +78,7 @@
explicit bounded_buffer_space_optimized(size_type capacity) : m_container(capacity) {}
void push_front(param_type item) {
- boost::mutex::scoped_lock lock(m_mutex);
+ boost::unique_lock<boost::mutex> lock(m_mutex);
m_not_full.wait(lock, boost::bind(&bounded_buffer_space_optimized<value_type>::is_not_full, this));
m_container.push_front(item);
lock.unlock();
@@ -85,7 +86,7 @@
}
void pop_back(value_type* pItem) {
- boost::mutex::scoped_lock lock(m_mutex);
+ boost::unique_lock<boost::mutex> lock(m_mutex);
m_not_empty.wait(lock, boost::bind(&bounded_buffer_space_optimized<value_type>::is_not_empty, this));
*pItem = m_container.back();
m_container.pop_back();
@@ -103,8 +104,8 @@
container_type m_container;
boost::mutex m_mutex;
- boost::condition m_not_empty;
- boost::condition m_not_full;
+ boost::condition_variable m_not_empty;
+ boost::condition_variable m_not_full;
};
template <class T>
@@ -119,7 +120,7 @@
explicit bounded_buffer_deque_based(size_type capacity) : m_capacity(capacity) {}
void push_front(param_type item) {
- boost::mutex::scoped_lock lock(m_mutex);
+ boost::unique_lock<boost::mutex> lock(m_mutex);
m_not_full.wait(lock, boost::bind(&bounded_buffer_deque_based<value_type>::is_not_full, this));
m_container.push_front(item);
lock.unlock();
@@ -127,7 +128,7 @@
}
void pop_back(value_type* pItem) {
- boost::mutex::scoped_lock lock(m_mutex);
+ boost::unique_lock<boost::mutex> lock(m_mutex);
m_not_empty.wait(lock, boost::bind(&bounded_buffer_deque_based<value_type>::is_not_empty, this));
*pItem = m_container.back();
m_container.pop_back();
@@ -146,8 +147,8 @@
const size_type m_capacity;
container_type m_container;
boost::mutex m_mutex;
- boost::condition m_not_empty;
- boost::condition m_not_full;
+ boost::condition_variable m_not_empty;
+ boost::condition_variable m_not_full;
};
template <class T>
@@ -162,7 +163,7 @@
explicit bounded_buffer_list_based(size_type capacity) : m_capacity(capacity) {}
void push_front(param_type item) {
- boost::mutex::scoped_lock lock(m_mutex);
+ boost::unique_lock<boost::mutex> lock(m_mutex);
m_not_full.wait(lock, boost::bind(&bounded_buffer_list_based<value_type>::is_not_full, this));
m_container.push_front(item);
lock.unlock();
@@ -170,7 +171,7 @@
}
void pop_back(value_type* pItem) {
- boost::mutex::scoped_lock lock(m_mutex);
+ boost::unique_lock<boost::mutex> lock(m_mutex);
m_not_empty.wait(lock, boost::bind(&bounded_buffer_list_based<value_type>::is_not_empty, this));
*pItem = m_container.back();
m_container.pop_back();
@@ -189,8 +190,8 @@
const size_type m_capacity;
container_type m_container;
boost::mutex m_mutex;
- boost::condition m_not_empty;
- boost::condition m_not_full;
+ boost::condition_variable m_not_empty;
+ boost::condition_variable m_not_full;
};
template<class Buffer>
@@ -291,3 +292,27 @@
return 0;
}
+/*
+
+//[bounded_buffer_comparison_output
+
+ Description: Autorun "J:\Cpp\Misc\Debug\bounded_buffer_comparison.exe"
+ bounded_buffer<int> 5.15 s
+
+ bounded_buffer_space_optimized<int> 5.71 s
+
+ bounded_buffer_deque_based<int> 15.57 s
+
+ bounded_buffer_list_based<int> 17.33 s
+
+ bounded_buffer<std::string> 24.49 s
+
+ bounded_buffer_space_optimized<std::string> 28.33 s
+
+ bounded_buffer_deque_based<std::string> 29.45 s
+
+ bounded_buffer_list_based<std::string> 31.29 s
+
+ //] //[bounded_buffer_comparison_output]
+
+*/
Modified: branches/release/libs/circular_buffer/test/common.ipp
==============================================================================
--- branches/release/libs/circular_buffer/test/common.ipp Thu Aug 29 02:10:38 2013 (r85509)
+++ branches/release/libs/circular_buffer/test/common.ipp 2013-08-29 04:39:09 EDT (Thu, 29 Aug 2013) (r85510)
@@ -1,11 +1,16 @@
// Common tests for the circular buffer and its adaptor.
// Copyright (c) 2003-2008 Jan Gaspar
+// Copyright (c) 2013 Antony Polukhin
// Use, modification, and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
+#include <boost/type_traits/is_nothrow_move_constructible.hpp>
+#include <boost/type_traits/is_nothrow_move_assignable.hpp>
+#include <boost/type_traits/has_nothrow_constructor.hpp>
+
void generic_test(CB_CONTAINER<MyInteger>& cb) {
vector<int> v;
@@ -1949,6 +1954,357 @@
int MyInteger::ms_exception_trigger = 0;
int InstanceCounter::ms_count = 0;
+void move_container_on_cpp11() {
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+ CB_CONTAINER<MyInteger> cb1(10);
+ cb1.push_back(1);
+ cb1.push_back(2);
+ cb1.push_back(3);
+ cb1.push_back(4);
+ cb1.push_back(5);
+ cb1.push_back(6);
+
+ // Checking move constructor
+ CB_CONTAINER<MyInteger> cb2(static_cast<CB_CONTAINER<MyInteger>&& >(cb1));
+ CB_CONTAINER<MyInteger>::iterator it2 = cb2.begin() + 1;
+
+ BOOST_CHECK(cb1.empty());
+ BOOST_CHECK(!cb2.empty());
+ BOOST_CHECK(it2[0] == 2);
+ BOOST_CHECK(it2[-1] == 1);
+ BOOST_CHECK(it2[2] == 4);
+
+ // Checking move assignment
+ cb1 = static_cast<CB_CONTAINER<MyInteger>&& >(cb2);
+ CB_CONTAINER<MyInteger>::iterator it1 = cb1.begin() + 1;
+
+ BOOST_CHECK(!cb1.empty());
+ BOOST_CHECK(cb2.empty());
+ BOOST_CHECK(it1[0] == 2);
+ BOOST_CHECK(it1[-1] == 1);
+ BOOST_CHECK(it1[2] == 4);
+#endif
+}
+
+
+struct noncopyable_movable_except_t
+ : private boost::noncopyable // required, until there will be no support for is_copy_constructible added to Boost.Move
+{
+private:
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(noncopyable_movable_except_t)
+ bool is_moved_;
+ int value_;
+public:
+ static int next_value;
+
+ explicit noncopyable_movable_except_t()
+ : is_moved_(false)
+ , value_(next_value ++)
+ {}
+
+ noncopyable_movable_except_t(BOOST_RV_REF(noncopyable_movable_except_t) x) {
+ is_moved_ = x.is_moved_;
+ value_ = x.value_;
+ x.is_moved_ = true;
+ }
+
+ noncopyable_movable_except_t& operator=(BOOST_RV_REF(noncopyable_movable_except_t) x) {
+ is_moved_ = x.is_moved_;
+ value_ = x.value_;
+ x.is_moved_ = true;
+ return *this;
+ }
+
+ bool is_moved() const {
+ return is_moved_;
+ }
+
+ int value() const {
+ return value_;
+ }
+
+ void reinit() { is_moved_ = false; value_ = next_value ++; }
+};
+
+struct noncopyable_movable_noexcept_t
+ : private boost::noncopyable // required, until there will be no support for is_copy_constructible added to Boost.Move
+{
+private:
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(noncopyable_movable_noexcept_t)
+ bool is_moved_;
+ int value_;
+public:
+ static int next_value;
+
+ explicit noncopyable_movable_noexcept_t()
+ : is_moved_(false)
+ , value_(next_value ++)
+ {}
+
+ noncopyable_movable_noexcept_t(BOOST_RV_REF(noncopyable_movable_noexcept_t) x) BOOST_NOEXCEPT {
+ is_moved_ = x.is_moved_;
+ value_ = x.value_;
+ x.is_moved_ = true;
+ }
+
+ noncopyable_movable_noexcept_t& operator=(BOOST_RV_REF(noncopyable_movable_noexcept_t) x) BOOST_NOEXCEPT {
+ is_moved_ = x.is_moved_;
+ value_ = x.value_;
+ x.is_moved_ = true;
+ return *this;
+ }
+
+ bool is_moved() const {
+ return is_moved_;
+ }
+
+ int value() const {
+ return value_;
+ }
+
+ void reinit() { is_moved_ = false; value_ = next_value ++; }
+};
+
+#ifdef BOOST_NO_CXX11_NOEXCEPT
+namespace boost {
+ template <>
+ struct is_nothrow_move_constructible<noncopyable_movable_noexcept_t>
+ : boost::true_type
+ {};
+}
+#endif
+
+int noncopyable_movable_noexcept_t::next_value = 1;
+int noncopyable_movable_except_t::next_value = 1;
+
+template <class T>
+void move_container_values_impl() {
+ typedef T noncopyable_movable_test_t;
+ noncopyable_movable_test_t::next_value = 1;
+
+ CB_CONTAINER<noncopyable_movable_test_t> cb1(40);
+ noncopyable_movable_test_t var;
+ cb1.push_back(boost::move(var));
+ BOOST_CHECK(!cb1.back().is_moved());
+ BOOST_CHECK(cb1.back().value() == 1);
+ BOOST_CHECK(var.is_moved());
+ BOOST_CHECK(cb1.size() == 1);
+
+ var.reinit();
+ cb1.push_front(boost::move(var));
+ BOOST_CHECK(!cb1.front().is_moved());
+ BOOST_CHECK(cb1.front().value() == 2);
+ BOOST_CHECK(var.is_moved());
+ BOOST_CHECK(cb1.size() == 2);
+
+ cb1.push_back();
+ BOOST_CHECK(!cb1.back().is_moved());
+ BOOST_CHECK(cb1.back().value() == 3);
+ BOOST_CHECK(cb1.size() == 3);
+
+ cb1.push_front();
+ BOOST_CHECK(!cb1.front().is_moved());
+ BOOST_CHECK(cb1.front().value() == 4);
+ BOOST_CHECK(cb1.size() == 4);
+
+ cb1.insert(cb1.begin());
+ BOOST_CHECK(!cb1.front().is_moved());
+ BOOST_CHECK(cb1.front().value() == 5);
+ BOOST_CHECK(cb1.size() == 5);
+
+ var.reinit();
+ cb1.insert(cb1.begin(), boost::move(var));
+ BOOST_CHECK(!cb1.front().is_moved());
+ BOOST_CHECK(cb1.front().value() == 6);
+ BOOST_CHECK(cb1.size() == 6);
+
+ cb1.rinsert(cb1.begin());
+ BOOST_CHECK(!cb1.front().is_moved());
+ BOOST_CHECK(cb1.front().value() == 7);
+ BOOST_CHECK(cb1.size() == 7);
+
+ var.reinit();
+ cb1.rinsert(cb1.begin(), boost::move(var));
+ BOOST_CHECK(!cb1.front().is_moved());
+ BOOST_CHECK(cb1.front().value() == 8);
+ BOOST_CHECK(cb1.size() == 8);
+
+
+ BOOST_CHECK(cb1[0].value() == 8);
+ BOOST_CHECK(cb1[1].value() == 7);
+ BOOST_CHECK(cb1[2].value() == 6);
+ BOOST_CHECK(cb1[3].value() == 5);
+ BOOST_CHECK(cb1[4].value() == 4);
+ BOOST_CHECK(cb1[5].value() == 2);
+ BOOST_CHECK(cb1[6].value() == 1);
+ BOOST_CHECK(cb1[7].value() == 3);
+ cb1.rotate(cb1.begin() + 2);
+ BOOST_CHECK(cb1[0].value() == 6);
+ BOOST_CHECK(cb1[1].value() == 5);
+ BOOST_CHECK(cb1[2].value() == 4);
+ BOOST_CHECK(cb1[3].value() == 2);
+ BOOST_CHECK(cb1[4].value() == 1);
+ BOOST_CHECK(cb1[5].value() == 3);
+ BOOST_CHECK(cb1[6].value() == 8);
+ BOOST_CHECK(cb1[7].value() == 7);
+
+ BOOST_CHECK(!cb1[0].is_moved());
+ BOOST_CHECK(!cb1[1].is_moved());
+ BOOST_CHECK(!cb1[2].is_moved());
+ BOOST_CHECK(!cb1[3].is_moved());
+ BOOST_CHECK(!cb1[4].is_moved());
+ BOOST_CHECK(!cb1[5].is_moved());
+ BOOST_CHECK(!cb1[6].is_moved());
+ BOOST_CHECK(!cb1[7].is_moved());
+
+ cb1.linearize();
+ BOOST_CHECK(!cb1[0].is_moved());
+ BOOST_CHECK(!cb1[1].is_moved());
+ BOOST_CHECK(!cb1[2].is_moved());
+ BOOST_CHECK(!cb1[3].is_moved());
+ BOOST_CHECK(!cb1[4].is_moved());
+ BOOST_CHECK(!cb1[5].is_moved());
+ BOOST_CHECK(!cb1[6].is_moved());
+ BOOST_CHECK(!cb1[7].is_moved());
+ BOOST_CHECK(cb1[0].value() == 6);
+ BOOST_CHECK(cb1[1].value() == 5);
+ BOOST_CHECK(cb1[2].value() == 4);
+ BOOST_CHECK(cb1[3].value() == 2);
+ BOOST_CHECK(cb1[4].value() == 1);
+ BOOST_CHECK(cb1[5].value() == 3);
+ BOOST_CHECK(cb1[6].value() == 8);
+ BOOST_CHECK(cb1[7].value() == 7);
+
+ cb1.erase(cb1.begin());
+ BOOST_CHECK(!cb1[0].is_moved());
+ BOOST_CHECK(!cb1[1].is_moved());
+ BOOST_CHECK(!cb1[2].is_moved());
+ BOOST_CHECK(!cb1[3].is_moved());
+ BOOST_CHECK(!cb1[4].is_moved());
+ BOOST_CHECK(!cb1[5].is_moved());
+ BOOST_CHECK(!cb1[6].is_moved());
+ BOOST_CHECK(cb1[0].value() == 5);
+ BOOST_CHECK(cb1[1].value() == 4);
+ BOOST_CHECK(cb1[2].value() == 2);
+ BOOST_CHECK(cb1[3].value() == 1);
+ BOOST_CHECK(cb1[4].value() == 3);
+ BOOST_CHECK(cb1[5].value() == 8);
+ BOOST_CHECK(cb1[6].value() == 7);
+
+ cb1.rerase(cb1.begin());
+ BOOST_CHECK(!cb1[0].is_moved());
+ BOOST_CHECK(!cb1[1].is_moved());
+ BOOST_CHECK(!cb1[2].is_moved());
+ BOOST_CHECK(!cb1[3].is_moved());
+ BOOST_CHECK(!cb1[4].is_moved());
+ BOOST_CHECK(!cb1[5].is_moved());
+ BOOST_CHECK(cb1[0].value() == 4);
+ BOOST_CHECK(cb1[1].value() == 2);
+ BOOST_CHECK(cb1[2].value() == 1);
+ BOOST_CHECK(cb1[3].value() == 3);
+ BOOST_CHECK(cb1[4].value() == 8);
+ BOOST_CHECK(cb1[5].value() == 7);
+
+ cb1.erase(cb1.begin(), cb1.begin() + 1);
+ BOOST_CHECK(!cb1[0].is_moved());
+ BOOST_CHECK(!cb1[1].is_moved());
+ BOOST_CHECK(!cb1[2].is_moved());
+ BOOST_CHECK(!cb1[3].is_moved());
+ BOOST_CHECK(!cb1[4].is_moved());
+ BOOST_CHECK(cb1[0].value() == 2);
+ BOOST_CHECK(cb1[1].value() == 1);
+ BOOST_CHECK(cb1[2].value() == 3);
+ BOOST_CHECK(cb1[3].value() == 8);
+ BOOST_CHECK(cb1[4].value() == 7);
+
+ cb1.rerase(cb1.begin(), cb1.begin() + 1);
+ BOOST_CHECK(!cb1[0].is_moved());
+ BOOST_CHECK(!cb1[1].is_moved());
+ BOOST_CHECK(!cb1[2].is_moved());
+ BOOST_CHECK(!cb1[3].is_moved());
+ BOOST_CHECK(cb1[0].value() == 1);
+ BOOST_CHECK(cb1[1].value() == 3);
+ BOOST_CHECK(cb1[2].value() == 8);
+ BOOST_CHECK(cb1[3].value() == 7);
+}
+
+void move_container_values_noexcept() {
+ move_container_values_impl<noncopyable_movable_noexcept_t>();
+
+ typedef noncopyable_movable_noexcept_t noncopyable_movable_test_t;
+ noncopyable_movable_test_t::next_value = 1;
+ CB_CONTAINER<noncopyable_movable_test_t> cb1(40);
+ cb1.push_back();
+ cb1.push_back();
+ cb1.push_back();
+ cb1.push_back();
+ cb1.push_back();
+ cb1.push_back();
+ cb1.push_back();
+ cb1.push_back();
+
+ cb1.set_capacity(100);
+ BOOST_CHECK(!cb1[0].is_moved());
+ BOOST_CHECK(!cb1[1].is_moved());
+ BOOST_CHECK(!cb1[2].is_moved());
+ BOOST_CHECK(!cb1[3].is_moved());
+ BOOST_CHECK(!cb1[4].is_moved());
+ BOOST_CHECK(!cb1[5].is_moved());
+ BOOST_CHECK(!cb1[6].is_moved());
+ BOOST_CHECK(!cb1[7].is_moved());
+ BOOST_CHECK(cb1[0].value() == 1);
+ BOOST_CHECK(cb1[1].value() == 2);
+ BOOST_CHECK(cb1[2].value() == 3);
+ BOOST_CHECK(cb1[3].value() == 4);
+ BOOST_CHECK(cb1[4].value() == 5);
+ BOOST_CHECK(cb1[5].value() == 6);
+ BOOST_CHECK(cb1[6].value() == 7);
+ BOOST_CHECK(cb1[7].value() == 8);
+
+ cb1.rset_capacity(101);
+ BOOST_CHECK(!cb1[0].is_moved());
+ BOOST_CHECK(!cb1[1].is_moved());
+ BOOST_CHECK(!cb1[2].is_moved());
+ BOOST_CHECK(!cb1[3].is_moved());
+ BOOST_CHECK(!cb1[4].is_moved());
+ BOOST_CHECK(!cb1[5].is_moved());
+ BOOST_CHECK(!cb1[6].is_moved());
+ BOOST_CHECK(!cb1[7].is_moved());
+ BOOST_CHECK(cb1[0].value() == 1);
+ BOOST_CHECK(cb1[1].value() == 2);
+ BOOST_CHECK(cb1[2].value() == 3);
+ BOOST_CHECK(cb1[3].value() == 4);
+ BOOST_CHECK(cb1[4].value() == 5);
+ BOOST_CHECK(cb1[5].value() == 6);
+ BOOST_CHECK(cb1[6].value() == 7);
+ BOOST_CHECK(cb1[7].value() == 8);
+
+ cb1.set_capacity(2);
+ BOOST_CHECK(!cb1[0].is_moved());
+ BOOST_CHECK(!cb1[1].is_moved());
+ BOOST_CHECK(cb1[0].value() == 1);
+ BOOST_CHECK(cb1[1].value() == 2);
+
+ cb1.rset_capacity(1);
+ BOOST_CHECK(!cb1[0].is_moved());
+ BOOST_CHECK(cb1[0].value() == 2);
+}
+
+void check_containers_exception_specifications() {
+#ifndef BOOST_NO_CXX11_NOEXCEPT
+#ifndef BOOST_CLANG
+ // Clang has an error in __has_nothrow_constructor implementation:
+ // http://llvm.org/bugs/show_bug.cgi?id=16627
+ BOOST_CHECK(boost::has_nothrow_constructor<CB_CONTAINER<int> >::value);
+#endif
+
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+ BOOST_CHECK(boost::is_nothrow_move_assignable<CB_CONTAINER<int> >::value);
+ BOOST_CHECK(boost::is_nothrow_move_constructible<CB_CONTAINER<int> >::value);
+#endif
+#endif // BOOST_NO_CXX11_NOEXCEPT
+}
+
// add common tests into a test suite
void add_common_tests(test_suite* tests) {
tests->add(BOOST_TEST_CASE(&basic_test));
@@ -1994,4 +2350,8 @@
tests->add(BOOST_TEST_CASE(&element_destruction_test));
tests->add(BOOST_TEST_CASE(&const_methods_test));
tests->add(BOOST_TEST_CASE(&rotate_test));
+ tests->add(BOOST_TEST_CASE(&move_container_on_cpp11));
+ tests->add(BOOST_TEST_CASE(&move_container_values_noexcept));
+ tests->add(BOOST_TEST_CASE(&check_containers_exception_specifications));
}
+
Modified: branches/release/libs/circular_buffer/test/test.hpp
==============================================================================
--- branches/release/libs/circular_buffer/test/test.hpp Thu Aug 29 02:10:38 2013 (r85509)
+++ branches/release/libs/circular_buffer/test/test.hpp 2013-08-29 04:39:09 EDT (Thu, 29 Aug 2013) (r85510)
@@ -16,7 +16,7 @@
#define BOOST_CB_TEST
#include <boost/circular_buffer.hpp>
-#include <boost/test/included/unit_test_framework.hpp>
+#include <boost/test/included/unit_test.hpp>
#include <boost/iterator.hpp>
#include <iterator>
#include <numeric>
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk