Boost logo

Boost-Commit :

From: jano_gaspar_at_[hidden]
Date: 2007-05-18 07:04:34


Author: jano_gaspar
Date: 2007-05-18 07:04:33 EDT (Fri, 18 May 2007)
New Revision: 4112
URL: http://svn.boost.org/trac/boost/changeset/4112

Log:
circular_buffer: updated documentation

Text files modified:
   sandbox/boost/circular_buffer/base.hpp | 66 +
   sandbox/boost/circular_buffer/space_optimized.hpp | 455 ++++++++++----
   sandbox/libs/circular_buffer/doc/TODO | 15
   sandbox/libs/circular_buffer/doc/circular_buffer.html | 90 ++
   sandbox/libs/circular_buffer/doc/circular_buffer_space_optimized.html | 1232 +++++++++++++++++++++++++++++++++------
   sandbox/libs/circular_buffer/test/common.ipp | 10
   6 files changed, 1456 insertions(+), 412 deletions(-)

Modified: sandbox/boost/circular_buffer/base.hpp
==============================================================================
--- sandbox/boost/circular_buffer/base.hpp (original)
+++ sandbox/boost/circular_buffer/base.hpp 2007-05-18 07:04:33 EDT (Fri, 18 May 2007)
@@ -770,7 +770,7 @@
              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.
         \par Complexity
- Linear (in the size/new capacity of the <code>circular_buffer</code>).
+ Linear (in <code>min[size(), new_capacity]</code>).
         \sa <code>rset_capacity()</code>, <code>resize()</code>
     */
     void set_capacity(capacity_type new_capacity) {
@@ -840,7 +840,7 @@
              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.
         \par Complexity
- Linear (in the size/new capacity of the <code>circular_buffer</code>).
+ Linear (in <code>min[size(), new_capacity]</code>).
         \sa <code>set_capacity()</code>, <code>rresize()</code>
     */
     void rset_capacity(capacity_type new_capacity) {
@@ -1048,7 +1048,9 @@
                 used).
         \throws Whatever <code>T::T(const T&)</code> throws.
         \par Complexity
- Linear (in the <code>capacity</code>/<code>std::distance(first, last)</code>).
+ Linear (in <code>std::distance(first, last)</code>; in
+ <code>min[capacity, std::distance(first, last)]</code> if the <code>InputIterator</code> is a
+ RandomAccessIterator).
     */
     template <class InputIterator>
     circular_buffer(capacity_type capacity, InputIterator first, InputIterator last,
@@ -1229,7 +1231,9 @@
              Invalidates all iterators pointing to the <code>circular_buffer</code> (except iterators equal to
              <code>end()</code>).
         \par Complexity
- Linear (in the <code>std::distance(first, last)</code>).
+ Linear (in <code>std::distance(first, last)</code>; in
+ <code>min[capacity, std::distance(first, last)]</code> if the <code>InputIterator</code> is a
+ RandomAccessIterator).
         \sa <code>operator=</code>, <code>\link assign(size_type, param_value_type)
             assign(size_type, const_reference)\endlink</code>,
             <code>\link assign(capacity_type, size_type, param_value_type)
@@ -1243,8 +1247,8 @@
 
     //! Swap the contents of two <code>circular_buffer</code>s.
     /*!
- \post <code>this</code> contains elements of <code>cb</code> and vice versa; capacity of <code>this</code>
- equals to capacity of <code>cb</code> and vice versa.
+ \post <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.
         \param cb The <code>circular_buffer</code> whose content will be swapped.
         \throws Nothing.
         \par Exception Safety
@@ -1397,10 +1401,10 @@
              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). It also invalidates iterators pointing to the
- overwritten element.
+ 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 the size of the <code>circular_buffer</code>).
+ 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>,
@@ -1432,10 +1436,10 @@
              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 at the insertion point (including <code>pos</code>) and
- iterators behind the insertion point (towards the end). It also invalidates iterators pointing to the
- overwritten elements.
+ iterators behind the insertion point (towards the end; except iterators equal to <code>end()</code>). It
+ also invalidates iterators pointing to the overwritten elements.
         \par Complexity
- Linear (in the size of the <code>circular_buffer</code>).
+ Linear (in <code>min[capacity(), std::distance(pos, end()) + n]</code>).
         \par Example
              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>
@@ -1484,10 +1488,13 @@
              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 at the insertion point (including <code>pos</code>) and
- iterators behind the insertion point (towards the end). It also invalidates iterators pointing to the
- overwritten elements.
+ iterators behind the insertion point (towards the end; except iterators equal to <code>end()</code>). It
+ also invalidates iterators pointing to the overwritten elements.
         \par Complexity
- Linear (in the size of the <code>circular_buffer</code>).
+ Linear (in <code>[std::distance(pos, end()) + std::distance(first, last)]</code>; in
+ <code>min[capacity(), std::distance(pos, end()) + std::distance(first, last)]</code> if the
+ <code>InputIterator</code> is a
+ RandomAccessIterator).
         \par Example
              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>
@@ -1531,7 +1538,7 @@
              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 the size of the <code>circular_buffer</code>).
+ 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>,
@@ -1604,7 +1611,7 @@
              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.
         \par Complexity
- Linear (in the size of the <code>circular_buffer</code>).
+ Linear (in <code>min[capacity(), std::distance(begin(), pos) + n]</code>).
         \par Example
              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>
@@ -1648,7 +1655,10 @@
              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.
         \par Complexity
- Linear (in the size of the <code>circular_buffer</code>).
+ Linear (in <code>[std::distance(begin(), pos) + std::distance(first, last)]</code>; in
+ <code>min[capacity(), std::distance(begin(), pos) + std::distance(first, last)]</code> if the
+ <code>InputIterator</code> is a
+ RandomAccessIterator).
         \par Example
              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>
@@ -1657,7 +1667,7 @@
              <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 insert operation preserves the capacity. After insertion the internal buffer looks like
+ 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>.
         \sa <code>\link rinsert(iterator, param_value_type) rinsert(iterator, value_type)\endlink</code>,
@@ -1688,9 +1698,9 @@
              Basic; no-throw if the operation in the <i>Throws</i> section does not throw anything.
         \par Iterator Invalidation
              Invalidates iterators pointing to the erased element and iterators pointing to the elements behind
- the erased element (towards the end).
+ the erased element (towards the end; except iterators equal to <code>end()</code>).
         \par Complexity
- Linear (in the size of the <code>circular_buffer</code>).
+ Linear (in <code>std::distance(pos, end())</code>).
         \sa <code>erase(iterator, iterator)</code>, <code>rerase(iterator)</code>,
             <code>rerase(iterator, iterator)</code>, <code>clear()</code>
     */
@@ -1725,9 +1735,9 @@
              Basic; no-throw if the operation in the <i>Throws</i> section does not throw anything.
         \par Iterator Invalidation
              Invalidates iterators pointing to the erased elements and iterators pointing to the elements behind
- the erased range (towards the end).
+ the erased range (towards the end; except iterators equal to <code>end()</code>).
         \par Complexity
- Linear (in the size of the <code>circular_buffer</code>).
+ Linear (in <code>std::distance(first, end())</code>).
         \sa <code>erase(iterator)</code>, <code>rerase(iterator)</code>, <code>rerase(iterator, iterator)</code>,
             <code>clear()</code>
     */
@@ -1763,7 +1773,7 @@
              Invalidates iterators pointing to the erased element and iterators pointing to the elements in front of
              the erased element (towards the beginning).
         \par Complexity
- Linear (in the size of the <code>circular_buffer</code>).
+ Linear (in <code>std::distance(begin(), pos)</code>).
         \sa <code>erase(iterator)</code>, <code>erase(iterator, iterator)</code>,
             <code>rerase(iterator, iterator)</code>, <code>clear()</code>
     */
@@ -1787,7 +1797,8 @@
     //! Erase the range <code>[first, last)</code>.
     /*!
         \pre Valid range <code>[first, last)</code>.
- \post The elements from the range <code>[first, last)</code> are removed.
+ \post The elements from the range <code>[first, last)</code> are removed. (If <code>first == last</code>
+ nothing is removed.)
         \param first The beginning of the range to be removed.
         \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
@@ -1799,7 +1810,7 @@
              Invalidates iterators pointing to the erased elements and iterators pointing to the elements in front of
              the erased range (towards the beginning).
         \par Complexity
- Linear (in the size of the <code>circular_buffer</code>).
+ Linear (in <code>std::distance(begin(), last)</code>).
         \sa <code>erase(iterator)</code>, <code>erase(iterator, iterator)</code>, <code>rerase(iterator)</code>,
             <code>clear()</code>
     */
@@ -1834,7 +1845,8 @@
         \par Exception Safety
              No-throw.
         \par Iterator Invalidation
- Invalidates all iterators pointing to the <code>circular_buffer</code>.
+ Invalidates all iterators pointing to the <code>circular_buffer</code> (except iterators equal to
+ <code>end()</code>).
         \par Complexity
              Linear (in the size of the <code>circular_buffer</code>).
         \sa <code>~circular_buffer()</code>, <code>erase(iterator)</code>, <code>erase(iterator, iterator)</code>,

Modified: sandbox/boost/circular_buffer/space_optimized.hpp
==============================================================================
--- sandbox/boost/circular_buffer/space_optimized.hpp (original)
+++ sandbox/boost/circular_buffer/space_optimized.hpp 2007-05-18 07:04:33 EDT (Fri, 18 May 2007)
@@ -13,6 +13,8 @@
     #pragma once
 #endif
 
+#include <boost/type_traits/is_same.hpp>
+
 namespace boost {
 
 /*!
@@ -126,11 +128,11 @@
              Constant (in the size of the <code>circular_buffer_space_optimized</code>).
         \sa <code>empty()</code>
     */
- bool full() const { return m_capacity_ctrl.capacity() == size(); }
+ bool full() const { 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.
- \return <code>capacity() - size()</code>
+ \return <code>capacity().%capacity() - size()</code>
         \throws Nothing.
         \par Exception Safety
              No-throw.
@@ -140,7 +142,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.capacity() - size(); }
+ size_type reserve() const { return m_capacity_ctrl - size(); }
 
     //! Get the capacity of the <code>circular_buffer_space_optimized</code>.
     /*!
@@ -175,8 +177,8 @@
               than the desired new capacity then number of <code>[size() - 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 than the new capacity the allocated memory (in the internal buffer) may be accommodated as necessary
- but it will never drop below <code>capacity_ctrl.min_capacity()</code>.
+ 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
                 used).
@@ -187,7 +189,7 @@
              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/new capacity of the <code>circular_buffer_space_optimized</code>).
+ Linear (in <code>min[size(), capacity_ctrl.%capacity()]</code>).
         \note 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>
@@ -198,12 +200,9 @@
     */
     void set_capacity(const capacity_type& capacity_ctrl) {
         m_capacity_ctrl = capacity_ctrl;
- if (capacity_ctrl.capacity() < circular_buffer<T, Alloc>::capacity())
- circular_buffer<T, Alloc>::set_capacity(capacity_ctrl.capacity());
- set_min_capacity(capacity_ctrl.min_capacity());
-#if BOOST_CB_ENABLE_DEBUG
- invalidate_iterators_except(end());
-#endif
+ if (capacity_ctrl < size())
+ circular_buffer<T, Alloc>::erase(end() - (size() - capacity_ctrl), end());
+ adjust_min_capacity();
     }
 
     //! Change the size of the <code>circular_buffer_space_optimized</code>.
@@ -215,7 +214,8 @@
               <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>[size() - new_size]</code> <b>last</b> elements will be
- removed. (The capacity will remain unchanged.)
+ removed. (The capacity will remain unchanged.)<br><br>
+ The amount of allocated memory in the internal buffer may be accommodated as necessary.
         \param new_size The new size.
         \param item 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>.)
@@ -233,15 +233,12 @@
     */
     void resize(size_type new_size, param_value_type item = value_type()) {
         if (new_size > size()) {
- if (new_size > capacity())
+ if (new_size > m_capacity_ctrl)
                 m_capacity_ctrl.m_capacity = new_size;
             insert(end(), new_size - size(), item);
         } else {
             erase(end() - (size() - new_size), end());
         }
-#if BOOST_CB_ENABLE_DEBUG
- invalidate_iterators_except(end());
-#endif
     }
 
     /*! \brief Change the capacity (and the minimal guaranteed amount of allocated memory) of the
@@ -252,8 +249,8 @@
               <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 than the new capacity the allocated memory (in the internal buffer) may be accommodated as necessary
- but it will never drop below <code>capacity_ctrl.min_capacity()</code>.
+ 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
                 used).
@@ -264,17 +261,14 @@
              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/new capacity of the <code>circular_buffer_space_optimized</code>).
+ Linear (in <code>min[size(), capacity_ctrl.%capacity()]</code>).
         \sa <code>set_capacity()</code>, <code>rresize()</code>
     */
     void rset_capacity(const capacity_type& capacity_ctrl) {
         m_capacity_ctrl = capacity_ctrl;
- if (capacity_ctrl.capacity() < circular_buffer<T, Alloc>::capacity())
- circular_buffer<T, Alloc>::rset_capacity(capacity_ctrl.capacity());
- set_min_capacity(capacity_ctrl.min_capacity());
-#if BOOST_CB_ENABLE_DEBUG
- invalidate_iterators_except(end());
-#endif
+ if (capacity_ctrl < size())
+ circular_buffer<T, Alloc>::rerase(begin(), begin() + (size() - capacity_ctrl));
+ adjust_min_capacity();
     }
 
     //! Change the size of the <code>circular_buffer_space_optimized</code>.
@@ -286,7 +280,8 @@
               <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>[size() - new_size]</code> <b>first</b> elements will be
- removed. (The capacity will remain unchanged.)
+ removed. (The capacity will remain unchanged.)<br><br>
+ The amount of allocated memory in the internal buffer may be accommodated as necessary.
         \param new_size The new size.
         \param item 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>.)
@@ -304,21 +299,18 @@
     */
     void rresize(size_type new_size, param_value_type item = value_type()) {
         if (new_size > size()) {
- if (new_size > capacity())
+ if (new_size > m_capacity_ctrl)
                 m_capacity_ctrl.m_capacity = new_size;
             rinsert(begin(), new_size - size(), item);
         } else {
             rerase(begin(), end() - new_size);
         }
-#if BOOST_CB_ENABLE_DEBUG
- invalidate_iterators_except(end());
-#endif
     }
 
     //! Create an empty space optimized circular buffer with a maximum capacity.
     /*!
         \post <code>capacity().%capacity() == max_size() \&\& capacity().min_capacity() == 0 \&\& size() == 0</code>
- <br><br>There is no memory allocated in the internal buffer after execution of this constructor.
+ <br><br>There is no memory allocated in the internal buffer.
         \param alloc The allocator.
         \throws Nothing.
         \par Complexity
@@ -332,8 +324,7 @@
     //! Create an empty space optimized circular buffer with the specified capacity.
     /*!
         \post <code>capacity() == capacity_ctrl \&\& size() == 0</code><br><br>
- Allocates the minimal guaranteed amount of allocated memory specified by the
- <code>capacity_ctrl.min_capacity()</code>.
+ The amount of allocated memory in the internal buffer is <code>capacity_ctrl.min_capacity()</code>.
         \param capacity_ctrl 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.
@@ -352,7 +343,8 @@
     /*! \brief Create a full space optimized circular buffer with the specified capacity filled with
                <code>capacity_ctrl.%capacity()</code> copies of <code>item</code>.
         \post <code>capacity() == capacity_ctrl \&\& full() \&\& (*this)[0] == item \&\& (*this)[1] == item \&\& ...
- \&\& (*this) [capacity_ctrl.%capacity() - 1] == item </code>
+ \&\& (*this) [capacity_ctrl.%capacity() - 1] == item </code><br><br>
+ The amount of allocated memory in the internal buffer is <code>capacity_ctrl.capacity()</code>.
         \param capacity_ctrl 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.
@@ -376,7 +368,8 @@
         \pre <code>capacity_ctrl.%capacity() >= n</code>
         \post <code>capacity() == capacity_ctrl \&\& size() == n \&\& (*this)[0] == item \&\& (*this)[1] == item
               \&\& ... \&\& (*this)[n - 1] == item</code><br><br>
- Allocates at least as much memory as specified by the <code>capacity_ctrl.min_capacity()</code>.
+ The amount of allocated memory in the internal buffer is
+ <code>max[n, capacity_ctrl.min_capacity()]</code>.
         \param capacity_ctrl 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.
@@ -420,7 +413,7 @@
         init_capacity(capacity_ctrl, first, last, is_integral<InputIterator>()),
         first, last)
     , m_capacity_ctrl(capacity_ctrl) {
- check_high_capacity(is_integral<InputIterator>());
+ reduce_capacity(is_same< BOOST_DEDUCED_TYPENAME BOOST_ITERATOR_CATEGORY<InputIterator>::type, std::input_iterator_tag >());
     }
     /*! \endcond */
 
@@ -430,7 +423,7 @@
     /*!
         Creates a copy of the specified <code>circular_buffer_space_optimized</code>.
         \post <code>*this == cb</code><br><br>
- Allocates the exact amount of memory to store the content of <code>cb</code>.
+ The amount of allocated memory in the internal buffer is <code>cb.size()</code>.
         \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).
@@ -449,7 +442,8 @@
              <a href="http://www.sgi.com/tech/stl/InputIterator.html">InputIterator</a>.
         \post <code>capacity().%capacity() == std::distance(first, last) \&\& capacity().min_capacity() == 0 \&\&
               full() \&\& (*this)[0]== *first \&\& (*this)[1] == *(first + 1) \&\& ... \&\&
- (*this)[std::distance(first, last) - 1] == *(last - 1)</code>
+ (*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>.
         \param first The beginning of the range to be copied.
         \param last The end of the range to be copied.
         \param alloc The allocator.
@@ -475,10 +469,11 @@
         \post <code>capacity() == capacity_ctrl \&\& size() \<= std::distance(first, last) \&\& (*this)[0]==
               *(last - capacity_ctrl.%capacity()) \&\& (*this)[1] == *(last - capacity_ctrl.%capacity() + 1) \&\& ...
               \&\& (*this)[capacity_ctrl.%capacity() - 1] == *(last - 1)</code><br><br>
- Allocates at least as much memory as specified by the <code>capacity_ctrl.min_capacity()</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.
+ <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>.
         \param capacity_ctrl 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.
@@ -489,7 +484,9 @@
                 used).
         \throws Whatever <code>T::T(const T&)</code> throws.
         \par Complexity
- Linear (in the <code>capacity_ctrl.%capacity()</code>/<code>std::distance(first, last)</code>).
+ 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 RandomAccessIterator).
     */
     template <class InputIterator>
     circular_buffer_space_optimized(
@@ -501,13 +498,13 @@
         init_capacity(capacity_ctrl, first, last, is_integral<InputIterator>()),
         first, last, alloc)
     , m_capacity_ctrl(capacity_ctrl) {
- check_high_capacity(is_integral<InputIterator>());
+ reduce_capacity(is_same< BOOST_DEDUCED_TYPENAME BOOST_ITERATOR_CATEGORY<InputIterator>::type, std::input_iterator_tag >());
     }
 
 #endif // #if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
 
 #if defined(BOOST_CB_NEVER_DEFINED)
-// This section will never be compiled - the default destructor and assignment operator will be generated instead.
+// This section will never be compiled - the default destructor will be generated instead.
 // Declared only for documentation purpose.
 
     //! The destructor.
@@ -523,11 +520,14 @@
     */
     ~circular_buffer_space_optimized();
 
+#endif // #if defined(BOOST_CB_NEVER_DEFINED)
+
     //! The assign operator.
     /*!
         Makes this <code>circular_buffer_space_optimized</code> to become a copy of the specified
         <code>circular_buffer_space_optimized</code>.
- \post <code>*this == cb</code>
+ \post <code>*this == cb</code><br><br>
+ The amount of allocated memory in the internal buffer is <code>cb.size()</code>.
         \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).
@@ -545,16 +545,21 @@
             <code>assign(InputIterator, InputIterator)</code>,
             <code>assign(capacity_type, InputIterator, InputIterator)</code>
     */
- circular_buffer_space_optimized<T, Alloc>& operator = (const circular_buffer_space_optimized<T, Alloc>& cb);
-
-#endif // #if defined(BOOST_CB_NEVER_DEFINED)
+ circular_buffer_space_optimized<T, Alloc>& operator = (const circular_buffer_space_optimized<T, Alloc>& cb) {
+ if (this == &cb)
+ return *this;
+ circular_buffer<T, Alloc>::assign(cb.begin(), cb.end());
+ m_capacity_ctrl = cb.m_capacity_ctrl;
+ return *this;
+ }
 
     //! 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
         <code>n</code> copies of the <code>item</code>.
         \post <code>capacity().%capacity() == n \&\& capacity().min_capacity() == 0 \&\& size() == n \&\& (*this)[0] ==
- item \&\& (*this)[1] == item \&\& ... \&\& (*this) [n - 1] == item</code>
+ item \&\& (*this)[1] == item \&\& ... \&\& (*this) [n - 1] == item</code><br><br>
+ The amount of allocated memory in the internal buffer is <code>n</code>.
         \param n The number of elements the <code>circular_buffer_space_optimized</code> will be filled with.
         \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
@@ -619,7 +624,8 @@
              <a href="http://www.sgi.com/tech/stl/InputIterator.html">InputIterator</a>.
         \post <code>capacity().%capacity() == std::distance(first, last) \&\& capacity().min_capacity() == 0 \&\&
               size() == std::distance(first, last) \&\& (*this)[0]== *first \&\& (*this)[1] == *(first + 1) \&\& ...
- \&\& (*this)[std::distance(first, last) - 1] == *(last - 1)</code>
+ \&\& (*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>.
         \param first The beginning of the range to be copied.
         \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
@@ -658,7 +664,7 @@
              (*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 will be
+ 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>.
         \param capacity_ctrl The new capacity controller.
         \param first The beginning of the range to be copied.
@@ -672,7 +678,9 @@
              Invalidates all iterators pointing to the <code>circular_buffer_space_optimized</code> (except iterators
              equal to <code>end()</code>).
         \par Complexity
- Linear (in the <code>std::distance(first, last)</code>).
+ 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 RandomAccessIterator).
         \sa <code>operator=</code>, <code>\link assign(size_type, param_value_type)
             assign(size_type, const_reference)\endlink</code>,
             <code>\link assign(capacity_type, size_type, param_value_type)
@@ -682,14 +690,14 @@
     template <class InputIterator>
     void assign(capacity_type capacity_ctrl, InputIterator first, InputIterator last) {
        m_capacity_ctrl = capacity_ctrl;
- circular_buffer<T, Alloc>::assign(capacity(), first, last);
- check_high_capacity();
+ circular_buffer<T, Alloc>::assign(capacity_ctrl, first, last);
     }
 
     //! Swap the contents of two space optimized circular buffers.
     /*!
- \post <code>this</code> contains elements of <code>cb</code> and vice versa; capacity of <code>this</code>
- equals to capacity of <code>cb</code> and vice versa.
+ \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
+ allocated memory of <code>cb</code> and vice versa.
         \param cb The <code>circular_buffer_space_optimized</code> whose content will be swapped.
         \throws Nothing.
         \par Exception Safety
@@ -714,7 +722,7 @@
         \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>
- Will predictively increase the allocated memory if necessary.
+ 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).
@@ -731,9 +739,6 @@
     void push_back(param_value_type item = value_type()) {
         check_low_capacity();
         circular_buffer<T, Alloc>::push_back(item);
-#if BOOST_CB_ENABLE_DEBUG
- invalidate_iterators_except(end());
-#endif
     }
 
     //! Insert a new element at the beginning of the space optimized circular buffer.
@@ -741,7 +746,7 @@
         \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>
- Will predictively increase the allocated memory if necessary.
+ 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).
@@ -758,16 +763,13 @@
     void push_front(param_value_type item = value_type()) {
         check_low_capacity();
         circular_buffer<T, Alloc>::push_front(item);
-#if BOOST_CB_ENABLE_DEBUG
- invalidate_iterators_except(end());
-#endif
     }
 
     //! Remove the last element from the space optimized circular buffer.
     /*!
         \pre <code>!empty()</code>
         \post The last element is removed from the <code>circular_buffer_space_optimized</code>.<br><br>
- Will predictively decrease the allocated memory if necessary.
+ The amount of allocated memory in the internal buffer may be predictively decreased.
         \throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
                 used).
         \par Exception Safety
@@ -782,16 +784,13 @@
     void pop_back() {
         circular_buffer<T, Alloc>::pop_back();
         check_high_capacity();
-#if BOOST_CB_ENABLE_DEBUG
- invalidate_iterators_except(end());
-#endif
     }
 
     //! Remove the first element from the space optimized circular buffer.
     /*!
         \pre <code>!empty()</code>
         \post The first element is removed from the <code>circular_buffer_space_optimized</code>.<br><br>
- Will predictively decrease the allocated memory if necessary.
+ The amount of allocated memory in the internal buffer may be predictively decreased.
         \throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
                 used).
         \par Exception Safety
@@ -806,9 +805,6 @@
     void pop_front() {
         circular_buffer<T, Alloc>::pop_front();
         check_high_capacity();
-#if BOOST_CB_ENABLE_DEBUG
- invalidate_iterators_except(end());
-#endif
     }
 
     //! Insert an element at the specified position.
@@ -820,7 +816,7 @@
               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>
- Will predictively increase the allocated memory if necessary.
+ 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
@@ -847,9 +843,6 @@
     iterator insert(iterator pos, param_value_type item = value_type()) {
         size_type index = pos - begin();
         check_low_capacity();
-#if BOOST_CB_ENABLE_DEBUG
- invalidate_iterators_except(end());
-#endif
         return circular_buffer<T, Alloc>::insert(begin() + index, item);
     }
 
@@ -861,7 +854,7 @@
               <code>pos</code>.<br>The number of <code>min[pos - begin(), max[0, n - reserve()]]</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>
- Will predictively increase the allocated memory if necessary.
+ 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>s will be inserted.
         \param n The number of <code>item</code>s the to be inserted.
         \param item The element whose copies will be inserted.
@@ -875,7 +868,7 @@
              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>).
+ Linear (in <code>min[capacity().%capacity(), size() + n]</code>).
         \par Example
              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>
@@ -896,12 +889,60 @@
     void insert(iterator pos, size_type n, param_value_type item) {
         size_type index = pos - begin();
         check_low_capacity(n);
-#if BOOST_CB_ENABLE_DEBUG
- invalidate_iterators_except(end());
-#endif
         circular_buffer<T, Alloc>::insert(begin() + index, n, item);
     }
 
+ //! Insert the range <code>[first, last)</code> at the specified position.
+ /*!
+ \pre <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.
+ \post Elements from the range
+ <code>[first + max[0, distance(first, last) - (pos - begin()) - reserve()], last)</code> will be
+ inserted at the position <code>pos</code>.<br>The number of <code>min[pos - begin(), max[0,
+ distance(first, last) - reserve()]]</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.
+ \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 "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.
+ \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 <code>[size() + std::distance(first, last)]</code>; in
+ <code>min[capacity().%capacity(), size() + std::distance(first, last)]</code> if the
+ <code>InputIterator</code> is a
+ RandomAccessIterator).
+ \par Example
+ 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>.
+ \sa <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>\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>
+ */
+ template <class InputIterator>
+ void insert(iterator pos, InputIterator first, InputIterator last) {
+ 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_space_optimized</code> or its
@@ -911,7 +952,7 @@
               <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>
- Will predictively increase the allocated memory if necessary.
+ 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
@@ -935,31 +976,51 @@
             insert(iterator, size_type, value_type)\endlink</code>,
             <code>insert(iterator, InputIterator, InputIterator)</code>
     */
- template <class InputIterator>
- void insert(iterator pos, InputIterator first, InputIterator last) {
- insert(pos, first, last, is_integral<InputIterator>());
-#if BOOST_CB_ENABLE_DEBUG
- invalidate_iterators_except(end());
-#endif
- }
-
- //! See the circular_buffer source documentation.
- /*!
- \warning The rules for iterator invalidation differ from the original
- circular_buffer. See the <a href="../circular_buffer_adaptor.html#invalidation">
- documentation</a>.
- */
     iterator rinsert(iterator pos, param_value_type item = value_type()) {
         size_type index = pos - begin();
         check_low_capacity();
         return circular_buffer<T, Alloc>::rinsert(begin() + index, item);
     }
 
- //! See the circular_buffer source documentation.
+ //! Insert <code>n</code> copies of the <code>item</code> before the specified position.
     /*!
- \warning The rules for iterator invalidation differ from the original
- circular_buffer. See the <a href="../circular_buffer_adaptor.html#invalidation">
- documentation</a>.
+ \pre <code>pos</code> is a valid iterator pointing to the <code>circular_buffer_space_optimized</code> or its
+ end.
+ \post The number of <code>min[n, (end() - pos) + reserve()]</code> elements will be inserted before the
+ position <code>pos</code>.<br>The number of <code>min[end() - pos, max[0, n - reserve()]]</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.
+ \param pos An iterator specifying the position where the <code>item</code>s will be inserted.
+ \param n The number of <code>item</code>s the to be inserted.
+ \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.
+ \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 <code>min[capacity().%capacity(), size() + n]</code>).
+ \par Example
+ 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>.
+ \sa <code>\link rinsert(iterator, param_value_type) rinsert(iterator, 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>
     */
     void rinsert(iterator pos, size_type n, param_value_type item) {
         size_type index = pos - begin();
@@ -967,22 +1028,79 @@
         circular_buffer<T, Alloc>::rinsert(begin() + index, n, item);
     }
 
- //! See the circular_buffer source documentation.
+ //! Insert the range <code>[first, last)</code> before the specified position.
     /*!
- \warning The rules for iterator invalidation differ from the original
- circular_buffer. See the <a href="../circular_buffer_adaptor.html#invalidation">
- documentation</a>.
+ \pre <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.
+ \post Elements from the range
+ <code>[first, last - max[0, distance(first, last) - (end() - pos) - reserve()])</code> will be inserted
+ before the position <code>pos</code>.<br>The number of <code>min[end() - pos, max[0,
+ distance(first, last) - reserve()]]</code> elements will be overwritten at the end of the
+ <code>circular_buffer</code>.<br>(See <i>Example</i> for the explanation.)<br><br>
+ The amount of allocated memory in the internal buffer may be predictively increased.
+ \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 "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.
+ \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 <code>[size() + std::distance(first, last)]</code>; in
+ <code>min[capacity().%capacity(), size() + std::distance(first, last)]</code> if the
+ <code>InputIterator</code> is a
+ RandomAccessIterator).
+ \par Example
+ 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>.
+ \sa <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>\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>
     */
     template <class InputIterator>
     void rinsert(iterator pos, InputIterator first, InputIterator last) {
         rinsert(pos, first, last, is_integral<InputIterator>());
     }
 
- //! See the circular_buffer source documentation.
+ //! Remove an element at the specified position.
     /*!
- \warning The rules for iterator invalidation differ from the original
- circular_buffer. See the <a href="../circular_buffer_adaptor.html#invalidation">
- documentation</a>.
+ \pre <code>pos</code> is a valid iterator pointing to the <code>circular_buffer_space_optimized</code> (but not
+ an <code>end()</code>).
+ \post 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.
+ \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 "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.
+ \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>erase(iterator, iterator)</code>, <code>rerase(iterator)</code>,
+ <code>rerase(iterator, iterator)</code>, <code>clear()</code>
     */
     iterator erase(iterator pos) {
         iterator it = circular_buffer<T, Alloc>::erase(pos);
@@ -991,11 +1109,28 @@
         return begin() + index;
     }
 
- //! See the circular_buffer source documentation.
+ //! Erase the range <code>[first, last)</code>.
     /*!
- \warning The rules for iterator invalidation differ from the original
- circular_buffer. See the <a href="../circular_buffer_adaptor.html#invalidation">
- documentation</a>.
+ \pre Valid range <code>[first, last)</code>.
+ \post 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.
+ \param first The beginning of the range to be removed.
+ \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 "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.
+ \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>erase(iterator)</code>, <code>rerase(iterator)</code>, <code>rerase(iterator, iterator)</code>,
+ <code>clear()</code>
     */
     iterator erase(iterator first, iterator last) {
         iterator it = circular_buffer<T, Alloc>::erase(first, last);
@@ -1004,11 +1139,27 @@
         return begin() + index;
     }
 
- //! See the circular_buffer source documentation.
+ //! Remove an element at the specified position.
     /*!
- \warning The rules for iterator invalidation differ from the original
- circular_buffer. See the <a href="../circular_buffer_adaptor.html#invalidation">
- documentation</a>.
+ \pre <code>pos</code> is a valid iterator pointing to the <code>circular_buffer_space_optimized</code> (but not
+ an <code>end()</code>).<br><br>
+ The amount of allocated memory in the internal buffer may be predictively decreased.
+ \post The element at the position <code>pos</code> is removed.
+ \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 "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.
+ \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>erase(iterator)</code>, <code>erase(iterator, iterator)</code>,
+ <code>rerase(iterator, iterator)</code>, <code>clear()</code>
     */
     iterator rerase(iterator pos) {
         iterator it = circular_buffer<T, Alloc>::rerase(pos);
@@ -1017,11 +1168,28 @@
         return begin() + index;
     }
 
- //! See the circular_buffer source documentation.
+ //! Erase the range <code>[first, last)</code>.
     /*!
- \warning The rules for iterator invalidation differ from the original
- circular_buffer. See the <a href="../circular_buffer_adaptor.html#invalidation">
- documentation</a>.
+ \pre Valid range <code>[first, last)</code>.
+ \post 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.
+ \param first The beginning of the range to be removed.
+ \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 "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.
+ \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>erase(iterator)</code>, <code>erase(iterator, iterator)</code>, <code>rerase(iterator)</code>,
+ <code>clear()</code>
     */
     iterator rerase(iterator first, iterator last) {
         iterator it = circular_buffer<T, Alloc>::rerase(first, last);
@@ -1031,15 +1199,18 @@
     }
 
     //! Remove all stored elements from the space optimized circular buffer.
- /*! TODO
- \post <code>size() == 0</code>
- \throws Nothing.
+ /*!
+ \post <code>size() == 0</code><br><br>
+ The amount of allocated memory in the internal buffer may be predictively decreased.
+ \throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is
+ used).
         \par Exception Safety
- No-throw.
+ Basic.
         \par Iterator Invalidation
- Invalidates all iterators pointing to the <code>circular_buffer_space_optimized</code>.
+ 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</code>).
+ Linear (in the size of the <code>circular_buffer_space_optimized</code>).
         \sa <code>~circular_buffer_space_optimized()</code>, <code>erase(iterator)</code>,
             <code>erase(iterator, iterator)</code>, <code>rerase(iterator)</code>,
             <code>rerase(iterator, iterator)</code>
@@ -1049,10 +1220,10 @@
 private:
 // Helper methods
 
- //! Change the minimal guaranteed amount of allocated memory.
- void set_min_capacity(size_type new_min_capacity) {
- if (new_min_capacity > circular_buffer<T, Alloc>::capacity())
- circular_buffer<T, Alloc>::set_capacity(new_min_capacity);
+ //! Adjust the amount of allocated memory.
+ void adjust_min_capacity() {
+ if (m_capacity_ctrl.min_capacity() > circular_buffer<T, Alloc>::capacity())
+ circular_buffer<T, Alloc>::set_capacity(m_capacity_ctrl.min_capacity());
         else
             check_high_capacity();
     }
@@ -1061,8 +1232,8 @@
     size_type ensure_reserve(size_type new_capacity, size_type size) const {
         if (size + new_capacity / 5 >= new_capacity)
             new_capacity *= 2; // ensure at least 20% reserve
- if (new_capacity > capacity())
- return capacity();
+ if (new_capacity > m_capacity_ctrl)
+ return m_capacity_ctrl;
         return new_capacity;
     }
 
@@ -1080,6 +1251,9 @@
             circular_buffer<T, Alloc>::set_capacity(
                 ensure_reserve(new_capacity, new_size));
         }
+#if BOOST_CB_ENABLE_DEBUG
+ invalidate_iterators_except(end());
+#endif
     }
 
     //! Check for high capacity.
@@ -1097,16 +1271,19 @@
         }
         circular_buffer<T, Alloc>::set_capacity(
             ensure_reserve(new_capacity, size()));
+#if BOOST_CB_ENABLE_DEBUG
+ invalidate_iterators_except(end());
+#endif
     }
 
- //! Specialized method for checking of the high capacity.
- void check_high_capacity(const true_type&) {}
-
- //! Specialized method for checking of the high capacity.
- void check_high_capacity(const false_type&) {
- check_high_capacity();
+ //! Specialized method for reducing the capacity.
+ void reduce_capacity(const true_type&) {
+ circular_buffer<T, Alloc>::set_capacity(std::max(m_capacity_ctrl.m_min_capacity, size()));
     }
 
+ //! Specialized method for reducing the capacity.
+ void reduce_capacity(const false_type&) {}
+
     //! Determine the initial capacity.
     static size_type init_capacity(const capacity_type& capacity_ctrl, size_type n) {
         BOOST_CB_ASSERT(capacity_ctrl.m_capacity >= n); // check for capacity lower than n
@@ -1136,7 +1313,7 @@
     template <class ForwardIterator>
     static size_type init_capacity(const capacity_type& capacity_ctrl, ForwardIterator first, ForwardIterator last, const std::forward_iterator_tag&) {
         BOOST_CB_ASSERT(std::distance(first, last) >= 0); // check for wrong range
- return std::min(capacity_ctrl.m_capacity, std::max(capacity_ctrl.m_min_capacity, static_cast<size_type>(std::distance(first, last))));
+ return std::max(capacity_ctrl.m_min_capacity, std::min(capacity_ctrl.m_capacity, static_cast<size_type>(std::distance(first, last))));
     }
 
     //! Specialized insert method.

Modified: sandbox/libs/circular_buffer/doc/TODO
==============================================================================
--- sandbox/libs/circular_buffer/doc/TODO (original)
+++ sandbox/libs/circular_buffer/doc/TODO 2007-05-18 07:04:33 EDT (Fri, 18 May 2007)
@@ -212,18 +212,3 @@
 
 t56 DONE
      Synopsis - do not sort methods.
-
--------------------------------------------------------------------------------
-
-Some routine tasks:
-
-r01 check for memory leaks
-
-r02 check for test coverage (doesn't have to be 100% but it would be good
- if every line is hit at least once)
-
-r03 update version number/date
-
-r04 format source files
-
-r05 spellcheck

Modified: sandbox/libs/circular_buffer/doc/circular_buffer.html
==============================================================================
--- sandbox/libs/circular_buffer/doc/circular_buffer.html (original)
+++ sandbox/libs/circular_buffer/doc/circular_buffer.html 2007-05-18 07:04:33 EDT (Fri, 18 May 2007)
@@ -1474,7 +1474,9 @@
                 <b>Complexity:</b>
               </dt>
               <dd>
- Linear (in the <code>capacity</code>/<code>std::distance(first, last)</code>).
+ 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>
@@ -3607,7 +3609,8 @@
                 <b>Complexity:</b>
               </dt>
               <dd>
- Linear (in the size/new capacity of the <code>circular_buffer</code>).
+ Linear (in <code>min[<a href=
+ "#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a>, new_capacity]</code>).
               </dd>
             </dl>
             <dl>
@@ -3803,7 +3806,8 @@
                 <b>Complexity:</b>
               </dt>
               <dd>
- Linear (in the size/new capacity of the <code>circular_buffer</code>).
+ Linear (in <code>min[<a href=
+ "#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a>, new_capacity]</code>).
               </dd>
             </dl>
             <dl>
@@ -4459,7 +4463,9 @@
                 <b>Complexity:</b>
               </dt>
               <dd>
- Linear (in the <code>std::distance(first, last)</code>).
+ 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>
@@ -4490,8 +4496,8 @@
                 <b>Effect:</b>
               </dt>
               <dd>
- <code>this</code> contains elements of <code>cb</code> and vice versa; capacity of <code>this</code>
- equals to capacity of <code>cb</code> and vice versa.
+ <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>
@@ -4949,8 +4955,9 @@
               </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). It also invalidates iterators pointing to the
- overwritten element.
+ 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>
@@ -4958,7 +4965,8 @@
                 <b>Complexity:</b>
               </dt>
               <dd>
- Linear (in the size of the <code>circular_buffer</code>).
+ Linear (in <code>std::distance(pos, <a href=
+ "#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a>)</code>).
               </dd>
             </dl>
             <dl>
@@ -5074,8 +5082,9 @@
               </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). It also invalidates iterators pointing to the
- overwritten elements.
+ 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>
@@ -5083,7 +5092,9 @@
                 <b>Complexity:</b>
               </dt>
               <dd>
- Linear (in the size of the <code>circular_buffer</code>).
+ Linear (in <code>min[<a href=
+ "#classboost_1_1circular__buffer_15ebab2b2538d733790b5752582728e77">capacity()</a>, std::distance(pos,
+ end()) + n]</code>).
               </dd>
             </dl>
             <dl>
@@ -5226,8 +5237,9 @@
               </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). It also invalidates iterators pointing to the
- overwritten elements.
+ 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>
@@ -5235,7 +5247,13 @@
                 <b>Complexity:</b>
               </dt>
               <dd>
- Linear (in the size of the <code>circular_buffer</code>).
+ 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>
@@ -5382,7 +5400,8 @@
                 <b>Complexity:</b>
               </dt>
               <dd>
- Linear (in the size of the <code>circular_buffer</code>).
+ Linear (in <code>std::distance(<a href=
+ "#classboost_1_1circular__buffer_158d1ede2e85f5d46eda8db3f0c4efef0">begin()</a>, pos)</code>).
               </dd>
             </dl>
             <dl>
@@ -5506,7 +5525,10 @@
                 <b>Complexity:</b>
               </dt>
               <dd>
- Linear (in the size of the <code>circular_buffer</code>).
+ Linear (in <code>min[<a href=
+ "#classboost_1_1circular__buffer_15ebab2b2538d733790b5752582728e77">capacity()</a>,
+ std::distance(begin(),
+ pos) + n]</code>).
               </dd>
             </dl>
             <dl>
@@ -5657,7 +5679,13 @@
                 <b>Complexity:</b>
               </dt>
               <dd>
- Linear (in the size of the <code>circular_buffer</code>).
+ 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>
@@ -5678,7 +5706,7 @@
                 <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 insert operation preserves the capacity. After insertion the internal buffer looks
+ 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>
@@ -5778,7 +5806,8 @@
               </dt>
               <dd>
                 Invalidates iterators pointing to the erased element and iterators pointing to the elements behind the
- erased element (towards the end).
+ erased element (towards the end; except iterators equal to <code><a href=
+ "#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a></code>).
               </dd>
             </dl>
             <dl>
@@ -5786,7 +5815,8 @@
                 <b>Complexity:</b>
               </dt>
               <dd>
- Linear (in the size of the <code>circular_buffer</code>).
+ Linear (in <code>std::distance(pos, <a href=
+ "#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a>)</code>).
               </dd>
             </dl>
             <dl>
@@ -5887,7 +5917,8 @@
               </dt>
               <dd>
                 Invalidates iterators pointing to the erased elements and iterators pointing to the elements behind the
- erased range (towards the end).
+ erased range (towards the end; except iterators equal to <code><a href=
+ "#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a></code>).
               </dd>
             </dl>
             <dl>
@@ -5895,7 +5926,8 @@
                 <b>Complexity:</b>
               </dt>
               <dd>
- Linear (in the size of the <code>circular_buffer</code>).
+ Linear (in <code>std::distance(first, <a href=
+ "#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a>)</code>).
               </dd>
             </dl>
             <dl>
@@ -5994,7 +6026,8 @@
                 <b>Complexity:</b>
               </dt>
               <dd>
- Linear (in the size of the <code>circular_buffer</code>).
+ Linear (in <code>std::distance(<a href=
+ "#classboost_1_1circular__buffer_158d1ede2e85f5d46eda8db3f0c4efef0">begin()</a>, pos)</code>).
               </dd>
             </dl>
             <dl>
@@ -6035,7 +6068,8 @@
                 <b>Effect:</b>
               </dt>
               <dd>
- The elements from the range <code>[first, last)</code> are removed.
+ The elements from the range <code>[first, last)</code> are removed. (If <code>first == last</code>
+ nothing is removed.)
               </dd>
             </dl>
             <dl>
@@ -6103,7 +6137,8 @@
                 <b>Complexity:</b>
               </dt>
               <dd>
- Linear (in the size of the <code>circular_buffer</code>).
+ Linear (in <code>std::distance(<a href=
+ "#classboost_1_1circular__buffer_158d1ede2e85f5d46eda8db3f0c4efef0">begin()</a>, last)</code>).
               </dd>
             </dl>
             <dl>
@@ -6158,7 +6193,8 @@
                 <b>Iterator Invalidation:</b>
               </dt>
               <dd>
- Invalidates all iterators pointing to the <code>circular_buffer</code>.
+ Invalidates all iterators pointing to the <code>circular_buffer</code> (except iterators equal to
+ <code>end()</code>).
               </dd>
             </dl>
             <dl>

Modified: sandbox/libs/circular_buffer/doc/circular_buffer_space_optimized.html
==============================================================================
--- sandbox/libs/circular_buffer/doc/circular_buffer_space_optimized.html (original)
+++ sandbox/libs/circular_buffer/doc/circular_buffer_space_optimized.html 2007-05-18 07:04:33 EDT (Fri, 18 May 2007)
@@ -383,7 +383,7 @@
                 "circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> ==
                 0</code><br>
                 <br>
- There is no memory allocated in the internal buffer after execution of this constructor.
+ There is no memory allocated in the internal buffer.
               </dd>
             </dl>
             <dl>
@@ -441,8 +441,7 @@
                 "circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> ==
                 0</code><br>
                 <br>
- Allocates the minimal guaranteed amount of allocated memory specified by the
- <code>capacity_ctrl.min_capacity()</code>.
+ The amount of allocated memory in the internal buffer is <code>capacity_ctrl.min_capacity()</code>.
               </dd>
             </dl>
             <dl>
@@ -512,7 +511,9 @@
                 capacity_ctrl &amp;&amp; <a href=
                 "#classboost_1_1circular__buffer__space__optimized_142f4a13c50904a4ac0bf746c88451954">full()</a>
                 &amp;&amp; (*this)[0] == item &amp;&amp; (*this)[1] == item &amp;&amp; ... &amp;&amp; (*this)
- [capacity_ctrl.capacity() - 1] == item</code>
+ [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>
@@ -607,7 +608,8 @@
                 &amp;&amp; (*this)[0] == item &amp;&amp; (*this)[1] == item &amp;&amp; ... &amp;&amp; (*this)[n - 1] ==
                 item</code><br>
                 <br>
- Allocates at least as much memory as specified by the <code>capacity_ctrl.min_capacity()</code>.
+ The amount of allocated memory in the internal buffer is <code>max[n,
+ capacity_ctrl.min_capacity()]</code>.
               </dd>
             </dl>
             <dl>
@@ -696,7 +698,7 @@
               <dd>
                 <code>*this == cb</code><br>
                 <br>
- Allocates the exact amount of memory to store the content of <code>cb</code>.
+ The amount of allocated memory in the internal buffer is <code>cb.size()</code>.
               </dd>
             </dl>
             <dl>
@@ -768,7 +770,9 @@
                 == 0 &amp;&amp; <a href=
                 "#classboost_1_1circular__buffer__space__optimized_142f4a13c50904a4ac0bf746c88451954">full()</a>
                 &amp;&amp; (*this)[0]== *first &amp;&amp; (*this)[1] == *(first + 1) &amp;&amp; ... &amp;&amp;
- (*this)[std::distance(first, last) - 1] == *(last - 1)</code>
+ (*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>
@@ -864,11 +868,12 @@
                 (*this)[1] == *(last - capacity_ctrl.capacity() + 1) &amp;&amp; ... &amp;&amp;
                 (*this)[capacity_ctrl.capacity() - 1] == *(last - 1)</code><br>
                 <br>
- Allocates at least as much memory as specified by the <code>capacity_ctrl.min_capacity()</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.
+ 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>
@@ -934,7 +939,9 @@
                 <b>Complexity:</b>
               </dt>
               <dd>
- Linear (in the <code>capacity_ctrl.capacity()</code>/<code>std::distance(first, last)</code>).
+ 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>
@@ -1072,8 +1079,8 @@
               </dt>
               <dd>
                 <code><a href=
- "#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a> -
- <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>
@@ -1219,7 +1226,7 @@
                 <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 than the new capacity the allocated memory (in the internal buffer) may be accommodated as
+ 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>
@@ -1273,7 +1280,9 @@
                 <b>Complexity:</b>
               </dt>
               <dd>
- Linear (in the size/new capacity of the <code>circular_buffer_space_optimized</code>).
+ Linear (in <code>min[<a href=
+ "circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a>,
+ capacity_ctrl.capacity()]</code>).
               </dd>
             </dl>
             <dl>
@@ -1334,7 +1343,9 @@
                 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.)
+ 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>
@@ -1442,7 +1453,7 @@
                 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 than the new capacity the allocated memory (in the internal buffer) may be accommodated as
+ 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>
@@ -1496,7 +1507,9 @@
                 <b>Complexity:</b>
               </dt>
               <dd>
- Linear (in the size/new capacity of the <code>circular_buffer_space_optimized</code>).
+ Linear (in <code>min[<a href=
+ "circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a>,
+ capacity_ctrl.capacity()]</code>).
               </dd>
             </dl>
             <dl>
@@ -1542,7 +1555,9 @@
                 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.)
+ 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>
@@ -1638,7 +1653,9 @@
                 <b>Effect:</b>
               </dt>
               <dd>
- <code>*this == cb</code>
+ <code>*this == cb</code><br>
+ <br>
+ The amount of allocated memory in the internal buffer is <code>cb.size()</code>.
               </dd>
             </dl>
             <dl>
@@ -1739,7 +1756,9 @@
                 == 0 &amp;&amp; <a href=
                 "circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> == n
                 &amp;&amp; (*this)[0] == item &amp;&amp; (*this)[1] == item &amp;&amp; ... &amp;&amp; (*this) [n - 1]
- == item</code>
+ == item</code><br>
+ <br>
+ The amount of allocated memory in the internal buffer is <code>n</code>.
               </dd>
             </dl>
             <dl>
@@ -1989,7 +2008,9 @@
                 == 0 &amp;&amp; <a href=
                 "circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> ==
                 std::distance(first, last) &amp;&amp; (*this)[0]== *first &amp;&amp; (*this)[1] == *(first + 1)
- &amp;&amp; ... &amp;&amp; (*this)[std::distance(first, last) - 1] == *(last - 1)</code>
+ &amp;&amp; ... &amp;&amp; (*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>
@@ -2114,7 +2135,7 @@
                 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 will be <code>max[std::distance(first, last),
+ The amount of allocated memory in the internal buffer is <code>max[std::distance(first, last),
                 capacity_ctrl.min_capacity()]</code>.
               </dd>
             </dl>
@@ -2188,7 +2209,9 @@
                 <b>Complexity:</b>
               </dt>
               <dd>
- Linear (in the <code>std::distance(first, last)</code>).
+ 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>
@@ -2221,8 +2244,9 @@
                 <b>Effect:</b>
               </dt>
               <dd>
- <code>this</code> contains elements of <code>cb</code> and vice versa; capacity of <code>this</code>
- equals to capacity of <code>cb</code> and vice versa.
+ <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>
@@ -2309,7 +2333,7 @@
                 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>
- Will predictively increase the allocated memory if necessary.
+ The amount of allocated memory in the internal buffer may be predictively increased.
               </dd>
             </dl>
             <dl>
@@ -2402,7 +2426,7 @@
                 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>
- Will predictively increase the allocated memory if necessary.
+ The amount of allocated memory in the internal buffer may be predictively increased.
               </dd>
             </dl>
             <dl>
@@ -2495,7 +2519,7 @@
               <dd>
                 The last element is removed from the <code>circular_buffer_space_optimized</code>.<br>
                 <br>
- Will predictively decrease the allocated memory if necessary.
+ The amount of allocated memory in the internal buffer may be predictively decreased.
               </dd>
             </dl>
             <dl>
@@ -2570,7 +2594,7 @@
               <dd>
                 The first element is removed from the <code>circular_buffer_space_optimized</code>.<br>
                 <br>
- Will predictively decrease the allocated memory if necessary.
+ The amount of allocated memory in the internal buffer may be predictively decreased.
               </dd>
             </dl>
             <dl>
@@ -2657,7 +2681,7 @@
                 then the <code>item</code> will not be inserted. If the capacity is <code>0</code>, nothing will be
                 inserted.<br>
                 <br>
- Will predictively increase the allocated memory if necessary.
+ The amount of allocated memory in the internal buffer may be predictively increased.
               </dd>
             </dl>
             <dl>
@@ -2795,7 +2819,7 @@
                 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>
- Will predictively increase the allocated memory if necessary.
+ The amount of allocated memory in the internal buffer may be predictively increased.
               </dd>
             </dl>
             <dl>
@@ -2871,7 +2895,11 @@
                 <b>Complexity:</b>
               </dt>
               <dd>
- Linear (in the size of the <code>circular_buffer_space_optimized</code>).
+ 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>
@@ -2928,14 +2956,16 @@
             "circular_buffer.html#classboost_1_1circular__buffer_11b8a33f2dc8519b8a7d344ed4408c532">iterator</a> pos,
             InputIterator first, InputIterator last);</b></code><br>
             <br>
- Insert an element before the specified position.
+ 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.
+ 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>
@@ -2943,15 +2973,19 @@
                 <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>
+ 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>
- Will predictively increase the allocated memory if necessary.
+ The amount of allocated memory in the internal buffer may be predictively increased.
               </dd>
             </dl>
             <dl>
@@ -2964,29 +2998,29 @@
                     <code>pos</code>
                   </dt>
                   <dd>
- An iterator specifying the position before which the <code>item</code> will be inserted.
+ An iterator specifying the position where the range will be inserted.
                   </dd>
                 </dl>
               </dd>
               <dd>
                 <dl compact>
                   <dt>
- <code>item</code>
+ <code>first</code>
                   </dt>
                   <dd>
- The element to be inserted.
+ The beginning of the range 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>.)
+ <dl compact>
+ <dt>
+ <code>last</code>
+ </dt>
+ <dd>
+ The end of the range to be inserted.
+ </dd>
+ </dl>
               </dd>
             </dl>
             <dl>
@@ -3027,7 +3061,41 @@
                 <b>Complexity:</b>
               </dt>
               <dd>
- Linear (in the size of the <code>circular_buffer_space_optimized</code>).
+ 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>
@@ -3036,15 +3104,15 @@
               </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,
+ "#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>
@@ -3061,207 +3129,974 @@
             "circular_buffer.html#classboost_1_1circular__buffer_1a8397191092f5bacee991b623ca4b910">const_reference</a>
             item = value_type());</b></code><br>
             <br>
- See the circular_buffer source
- documentation.
+ Insert an element before the specified position.
             <dl>
               <dt>
- <b>Warning:</b>
+ <b>Precondition:</b>
               </dt>
               <dd>
- The rules for iterator invalidation differ from the original <a href=
- "circular_buffer.html#classboost_1_1circular__buffer">circular_buffer</a>. See the <a href=
- "../circular_buffer_adaptor.html#invalidation">documentation</a>.
+ <code>pos</code> is a valid iterator pointing to the <code>circular_buffer_space_optimized</code> or
+ its end.
               </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>
- See the circular_buffer source
- documentation.
             <dl>
               <dt>
- <b>Warning:</b>
+ <b>Effect:</b>
               </dt>
               <dd>
- The rules for iterator invalidation differ from the original <a href=
- "circular_buffer.html#classboost_1_1circular__buffer">circular_buffer</a>. See the <a href=
- "../circular_buffer_adaptor.html#invalidation">documentation</a>.
+ 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>
- </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
- &lt;class InputIterator&gt;<br>
- void rinsert(<a href=
- "circular_buffer.html#classboost_1_1circular__buffer_11b8a33f2dc8519b8a7d344ed4408c532">iterator</a> pos,
- InputIterator first, InputIterator last);</b></code><br>
- <br>
- See the circular_buffer source
- documentation.
             <dl>
               <dt>
- <b>Warning:</b>
+ <b>Parameter(s):</b>
               </dt>
               <dd>
- The rules for iterator invalidation differ from the original <a href=
- "circular_buffer.html#classboost_1_1circular__buffer">circular_buffer</a>. See the <a href=
- "../circular_buffer_adaptor.html#invalidation">documentation</a>.
+ <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>
- </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>
- See the circular_buffer source
- documentation.
             <dl>
               <dt>
- <b>Warning:</b>
+ <b>Returns:</b>
               </dt>
               <dd>
- The rules for iterator invalidation differ from the original <a href=
- "circular_buffer.html#classboost_1_1circular__buffer">circular_buffer</a>. See the <a href=
- "../circular_buffer_adaptor.html#invalidation">documentation</a>.
+ 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>
- </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>
- See the circular_buffer source
- documentation.
             <dl>
               <dt>
- <b>Warning:</b>
+ <b>Throws:</b>
               </dt>
               <dd>
- The rules for iterator invalidation differ from the original <a href=
- "circular_buffer.html#classboost_1_1circular__buffer">circular_buffer</a>. See the <a href=
- "../circular_buffer_adaptor.html#invalidation">documentation</a>.
+ 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&amp;)</code> throws.
+ </dd>
+ <dd>
+ Whatever <code>T::operator = (const T&amp;)</code> throws.
               </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>
- See the circular_buffer source
- documentation.
             <dl>
               <dt>
- <b>Warning:</b>
+ <b>Exception Safety:</b>
               </dt>
               <dd>
- The rules for iterator invalidation differ from the original <a href=
- "circular_buffer.html#classboost_1_1circular__buffer">circular_buffer</a>. See the <a href=
- "../circular_buffer_adaptor.html#invalidation">documentation</a>.
+ Basic.
               </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>
- See the circular_buffer source
- documentation.
             <dl>
               <dt>
- <b>Warning:</b>
+ <b>Iterator Invalidation:</b>
               </dt>
               <dd>
- The rules for iterator invalidation differ from the original <a href=
- "circular_buffer.html#classboost_1_1circular__buffer">circular_buffer</a>. See the <a href=
- "../circular_buffer_adaptor.html#invalidation">documentation</a>.
+ 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>
- </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.
- <p>
- TODO
- </p>
             <dl>
               <dt>
- <b>Effect:</b>
+ <b>Complexity:</b>
               </dt>
               <dd>
- <code><a href=
- "circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> ==
- 0</code>
+ Linear (in the size of the <code>circular_buffer_space_optimized</code>).
               </dd>
             </dl>
             <dl>
               <dt>
- <b>Throws:</b>
+ <b>See Also:</b>
               </dt>
               <dd>
- Nothing.
+ <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>Exception Safety:</b>
+ <b>Precondition:</b>
               </dt>
               <dd>
- No-throw.
+ <code>pos</code> is a valid iterator pointing to the <code>circular_buffer_space_optimized</code> or
+ its end.
               </dd>
             </dl>
             <dl>
               <dt>
- <b>Iterator Invalidation:</b>
+ <b>Effect:</b>
               </dt>
               <dd>
- Invalidates all iterators pointing to the <code>circular_buffer_space_optimized</code>.
+ 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&amp;)</code> throws.
+ </dd>
+ <dd>
+ Whatever <code>T::operator = (const T&amp;)</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
+ &lt;class InputIterator&gt;<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&amp;)</code> throws.
+ </dd>
+ <dd>
+ Whatever <code>T::operator = (const T&amp;)</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&amp;)</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&amp;)</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&amp;)</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_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&amp;)</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_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>
@@ -3269,8 +4104,7 @@
                 <b>Complexity:</b>
               </dt>
               <dd>
- Linear (in the size of the <code><a href=
- "circular_buffer.html#classboost_1_1circular__buffer">circular_buffer</a></code>).
+ Linear (in the size of the <code>circular_buffer_space_optimized</code>).
               </dd>
             </dl>
             <dl>

Modified: sandbox/libs/circular_buffer/test/common.ipp
==============================================================================
--- sandbox/libs/circular_buffer/test/common.ipp (original)
+++ sandbox/libs/circular_buffer/test/common.ipp 2007-05-18 07:04:33 EDT (Fri, 18 May 2007)
@@ -153,7 +153,7 @@
     alloc_ref.max_size();
     alloc.max_size();
 
- generic_test(cb1);
+ generic_test(cb1);
 }
 
 void begin_and_end_test() {
@@ -162,10 +162,10 @@
     v.push_back(11);
     v.push_back(12);
     v.push_back(13);
-
+
     CB_CONTAINER<MyInteger> cb1(10, v.begin(), v.end());
     const CB_CONTAINER<MyInteger> cb2(10, v.begin(), v.end());
-
+
     CB_CONTAINER<MyInteger> cb3(10);
     cb3.push_back(1);
     cb3.push_back(2);
@@ -195,10 +195,10 @@
     v.push_back(11);
     v.push_back(12);
     v.push_back(13);
-
+
     CB_CONTAINER<MyInteger> cb1(10, v.begin(), v.end());
     const CB_CONTAINER<MyInteger> cb2(10, v.begin(), v.end());
-
+
     CB_CONTAINER<MyInteger> cb3(3);
     cb3.push_back(1);
     cb3.push_back(2);


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