Boost logo

Boost-Commit :

From: jano_gaspar_at_[hidden]
Date: 2008-07-23 16:40:50


Author: jano_gaspar
Date: 2008-07-23 16:40:46 EDT (Wed, 23 Jul 2008)
New Revision: 47738
URL: http://svn.boost.org/trac/boost/changeset/47738

Log:
circular_buffer: major update; added rotate method, bugfix #1987
Text files modified:
   trunk/boost/circular_buffer.hpp | 12
   trunk/boost/circular_buffer/base.hpp | 77 ++++++++
   trunk/boost/circular_buffer/debug.hpp | 2
   trunk/boost/circular_buffer/details.hpp | 68 +------
   trunk/boost/circular_buffer/space_optimized.hpp | 4
   trunk/boost/circular_buffer_fwd.hpp | 2
   trunk/libs/circular_buffer/doc/Doxyfile | 2
   trunk/libs/circular_buffer/doc/HOWTO-srcdoc | 2
   trunk/libs/circular_buffer/doc/Tidy.conf | 2
   trunk/libs/circular_buffer/doc/circular_buffer.html | 347 ++++++++++++++++++++++++++++++++++++---
   trunk/libs/circular_buffer/doc/circular_buffer.xslt | 2
   trunk/libs/circular_buffer/doc/copy.xslt | 2
   trunk/libs/circular_buffer/doc/doxygen2html.xslt | 2
   trunk/libs/circular_buffer/doc/html2xhtml.xslt | 2
   trunk/libs/circular_buffer/doc/space_optimized.html | 36 ++++
   trunk/libs/circular_buffer/doc/space_optimized.xslt | 2
   trunk/libs/circular_buffer/doc/update_srcdoc.sh | 2
   trunk/libs/circular_buffer/doc/update_srcdoc.xslt | 2
   trunk/libs/circular_buffer/index.html | 2
   trunk/libs/circular_buffer/test/Jamfile.v2 | 2
   trunk/libs/circular_buffer/test/base_test.cpp | 59 ++++++
   trunk/libs/circular_buffer/test/bounded_buffer_comparison.cpp | 2
   trunk/libs/circular_buffer/test/common.ipp | 136 +++++++++++++++
   trunk/libs/circular_buffer/test/soft_iterator_invalidation.cpp | 2
   trunk/libs/circular_buffer/test/space_optimized_test.cpp | 2
   trunk/libs/circular_buffer/test/test.hpp | 2
   26 files changed, 661 insertions(+), 114 deletions(-)

Modified: trunk/boost/circular_buffer.hpp
==============================================================================
--- trunk/boost/circular_buffer.hpp (original)
+++ trunk/boost/circular_buffer.hpp 2008-07-23 16:40:46 EDT (Wed, 23 Jul 2008)
@@ -1,6 +1,6 @@
 // Circular buffer library header file.
 
-// Copyright (c) 2003-2007 Jan Gaspar
+// Copyright (c) 2003-2008 Jan Gaspar
 
 // Use, modification, and distribution is subject to the Boost Software
 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -15,7 +15,7 @@
     #pragma once
 #endif
 
-#include "circular_buffer_fwd.hpp"
+#include <boost/circular_buffer_fwd.hpp>
 #include <boost/detail/workaround.hpp>
 
 // BOOST_CB_ENABLE_DEBUG: Debug support control.
@@ -60,10 +60,10 @@
     #define BOOST_CB_ASSERT_TEMPLATED_ITERATOR_CONSTRUCTORS ((void)0);
 #endif
 
-#include "circular_buffer/debug.hpp"
-#include "circular_buffer/details.hpp"
-#include "circular_buffer/base.hpp"
-#include "circular_buffer/space_optimized.hpp"
+#include <boost/circular_buffer/debug.hpp>
+#include <boost/circular_buffer/details.hpp>
+#include <boost/circular_buffer/base.hpp>
+#include <boost/circular_buffer/space_optimized.hpp>
 
 #undef BOOST_CB_ASSERT_TEMPLATED_ITERATOR_CONSTRUCTORS
 #undef BOOST_CB_IS_CONVERTIBLE

Modified: trunk/boost/circular_buffer/base.hpp
==============================================================================
--- trunk/boost/circular_buffer/base.hpp (original)
+++ trunk/boost/circular_buffer/base.hpp 2008-07-23 16:40:46 EDT (Wed, 23 Jul 2008)
@@ -1,6 +1,6 @@
 // Implementation of the base circular buffer.
 
-// Copyright (c) 2003-2007 Jan Gaspar
+// Copyright (c) 2003-2008 Jan Gaspar
 
 // Use, modification, and distribution is subject to the Boost Software
 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -619,7 +619,7 @@
         \warning In general invoking any method which modifies the internal state of the <code>circular_buffer</code>
                  may delinearize the internal buffer and invalidate the returned pointer.
         \sa <code>array_one()</code> and <code>array_two()</code> for the other option how to pass data into a legacy
- C API.
+ C API; <code>is_linearized()</code>, <code>rotate(const_iterator)</code>
     */
     pointer linearize() {
         if (empty())
@@ -667,6 +667,73 @@
         return m_buff;
     }
 
+ //! Is the <code>circular_buffer</code> linearized?
+ /*!
+ \return <code>true</code> if the internal buffer is linearized into a continuous array (i.e. the
+ <code>circular_buffer</code> meets a condition
+ <code>\&(*this)[0] \< \&(*this)[1] \< ... \< \&(*this)[size() - 1]</code>);
+ <code>false</code> otherwise.
+ \throws Nothing.
+ \par Exception Safety
+ No-throw.
+ \par Iterator Invalidation
+ Does not invalidate any iterators.
+ \par Complexity
+ Constant (in the size of the <code>circular_buffer</code>).
+ \sa <code>linearize()</code>, <code>array_one()</code>, <code>array_two()</code>
+ */
+ bool is_linearized() const { return m_first < m_last || m_last == m_buff; }
+
+ //! Rotate elements in the <code>circular_buffer</code>.
+ /*!
+ A more effective implementation of
+ <code>std::rotate</code>.
+ \pre <code>new_begin</code> is a valid iterator pointing to the <code>circular_buffer</code> <b>except</b> its
+ end.
+ \post Before calling the method suppose:<br><br>
+ <code>m == std::distance(new_begin, end())</code><br><code>n == std::distance(begin(), new_begin)</code>
+ <br><code>val_0 == *new_begin, val_1 == *(new_begin + 1), ... val_m == *(new_begin + m)</code><br>
+ <code>val_r1 == *(new_begin - 1), val_r2 == *(new_begin - 2), ... val_rn == *(new_begin - n)</code><br>
+ <br>then after call to the method:<br><br>
+ <code>val_0 == (*this)[0] \&\& val_1 == (*this)[1] \&\& ... \&\& val_m == (*this)[m - 1] \&\& val_r1 ==
+ (*this)[m + n - 1] \&\& val_r2 == (*this)[m + n - 2] \&\& ... \&\& val_rn == (*this)[m]</code>
+ \param new_begin The new beginning.
+ \throws Whatever <code>T::T(const T&)</code> throws.
+ \throws Whatever <code>T::operator = (const T&)</code> throws.
+ \par Exception Safety
+ Basic; no-throw if the <code>circular_buffer</code> is full or <code>new_begin</code> points to
+ <code>begin()</code> or if the operations in the <i>Throws</i> section do not throw anything.
+ \par Iterator Invalidation
+ If <code>m \< n</code> invalidates iterators pointing to the last <code>m</code> elements
+ (<b>including</b> <code>new_begin</code>, but not iterators equal to <code>end()</code>) else invalidates
+ iterators pointing to the first <code>n</code> elements; does not invalidate any iterators if the
+ <code>circular_buffer</code> is full.
+ \par Complexity
+ Linear (in <code>std::min(m, n)</code>); constant if the <code>circular_buffer</code> is full.
+ \sa <code>std::rotate</code>
+ */
+ void rotate(const_iterator new_begin) {
+ BOOST_CB_ASSERT(new_begin.is_valid(this)); // check for uninitialized or invalidated iterator
+ BOOST_CB_ASSERT(new_begin.m_it != 0); // check for iterator pointing to end()
+ if (full()) {
+ m_first = m_last = const_cast<pointer>(new_begin.m_it);
+ } else {
+ difference_type m = end() - new_begin;
+ difference_type n = new_begin - begin();
+ if (m < n) {
+ for (; m > 0; --m) {
+ push_front(back());
+ pop_back();
+ }
+ } else {
+ for (; n > 0; --n) {
+ push_back(front());
+ pop_front();
+ }
+ }
+ }
+ }
+
 // Size and capacity
 
     //! Get the number of elements currently stored in the <code>circular_buffer</code>.
@@ -921,6 +988,10 @@
                  <code>\link push_back() push_back(const_reference)\endlink</code> or
                  <code>\link insert(iterator, param_value_type) insert(iterator, value_type)\endlink</code>) nothing
                  will be inserted and the size (as well as capacity) remains zero.
+ \note You can explicitly set the capacity by calling the <code>set_capacity(capacity_type)</code> method or you
+ can use the other constructor with the capacity specified.
+ \sa <code>circular_buffer(capacity_type, const allocator_type& alloc)</code>,
+ <code>set_capacity(capacity_type)</code>
     */
     explicit circular_buffer(const allocator_type& alloc = allocator_type())
     : m_buff(0), m_end(0), m_first(0), m_last(0), m_size(0), m_alloc(alloc) {}
@@ -1305,6 +1376,7 @@
               <code>0</code>, nothing will be inserted.
         \param item The element to be inserted.
         \throws Whatever <code>T::T(const T&)</code> throws.
+ \throws Whatever <code>T::operator = (const T&)</code> throws.
         \par Exception Safety
              Basic; no-throw if the operation in the <i>Throws</i> section does not throw anything.
         \par Iterator Invalidation
@@ -1335,6 +1407,7 @@
               <code>0</code>, nothing will be inserted.
         \param item The element to be inserted.
         \throws Whatever <code>T::T(const T&)</code> throws.
+ \throws Whatever <code>T::operator = (const T&)</code> throws.
         \par Exception Safety
              Basic; no-throw if the operation in the <i>Throws</i> section does not throw anything.
         \par Iterator Invalidation

Modified: trunk/boost/circular_buffer/debug.hpp
==============================================================================
--- trunk/boost/circular_buffer/debug.hpp (original)
+++ trunk/boost/circular_buffer/debug.hpp 2008-07-23 16:40:46 EDT (Wed, 23 Jul 2008)
@@ -1,6 +1,6 @@
 // Debug support for the circular buffer library.
 
-// Copyright (c) 2003-2007 Jan Gaspar
+// Copyright (c) 2003-2008 Jan Gaspar
 
 // Use, modification, and distribution is subject to the Boost Software
 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at

Modified: trunk/boost/circular_buffer/details.hpp
==============================================================================
--- trunk/boost/circular_buffer/details.hpp (original)
+++ trunk/boost/circular_buffer/details.hpp 2008-07-23 16:40:46 EDT (Wed, 23 Jul 2008)
@@ -1,6 +1,6 @@
 // Helper classes and functions for the circular buffer.
 
-// Copyright (c) 2003-2007 Jan Gaspar
+// Copyright (c) 2003-2008 Jan Gaspar
 
 // Use, modification, and distribution is subject to the Boost Software
 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -67,16 +67,6 @@
 };
 
 /*!
- \struct helper_pointer
- \brief Helper pointer used in the iterator.
-*/
-template <class Traits>
-struct helper_pointer {
- bool m_end;
- typename Traits::pointer m_it;
-};
-
-/*!
     \struct iterator_wrapper
     \brief Helper iterator dereference wrapper.
 */
@@ -288,16 +278,11 @@
     pointer operator -> () const { return &(operator*()); }
 
     //! Difference operator.
- difference_type operator - (const iterator& it) const {
+ template <class Traits0>
+ difference_type operator - (const iterator<Buff, Traits0>& it) const {
         BOOST_CB_ASSERT(is_valid(m_buff)); // check for uninitialized or invalidated iterator
         BOOST_CB_ASSERT(it.is_valid(m_buff)); // check for uninitialized or invalidated iterator
- helper_pointer<Traits> lhs = create_helper_pointer(*this);
- helper_pointer<Traits> rhs = create_helper_pointer(it);
- if (less(rhs, lhs) && lhs.m_it <= rhs.m_it)
- return (lhs.m_it - rhs.m_it) + static_cast<difference_type>(m_buff->capacity());
- if (less(lhs, rhs) && lhs.m_it >= rhs.m_it)
- return (lhs.m_it - rhs.m_it) - static_cast<difference_type>(m_buff->capacity());
- return lhs.m_it - rhs.m_it;
+ return linearize_pointer(*this) - linearize_pointer(it);
     }
 
     //! Increment operator (prefix).
@@ -355,7 +340,7 @@
     iterator& operator -= (difference_type n) {
         BOOST_CB_ASSERT(is_valid(m_buff)); // check for uninitialized or invalidated iterator
         if (n > 0) {
- BOOST_CB_ASSERT(m_buff->begin() - *this <= -n); // check for too large n
+ BOOST_CB_ASSERT(*this - m_buff->begin() >= n); // check for too large n
             m_it = m_buff->sub(m_it == 0 ? m_buff->m_last : m_it, n);
         } else if (n < 0) {
             *this += -n;
@@ -392,12 +377,12 @@
     bool operator < (const iterator<Buff, Traits0>& it) const {
         BOOST_CB_ASSERT(is_valid(m_buff)); // check for uninitialized or invalidated iterator
         BOOST_CB_ASSERT(it.is_valid(m_buff)); // check for uninitialized or invalidated iterator
- return less(create_helper_pointer(*this), create_helper_pointer(it));
+ return linearize_pointer(*this) < linearize_pointer(it);
     }
 
     //! Greater.
     template <class Traits0>
- bool operator > (const iterator<Buff, Traits0>& it) const { return it < *this; }
+ bool operator > (const iterator<Buff, Traits0>& it) const { return it < *this; }
 
     //! Less or equal.
     template <class Traits0>
@@ -410,41 +395,12 @@
 private:
 // Helpers
 
- //! Create helper pointer.
+ //! Get a pointer which would point to the same element as the iterator in case the circular buffer is linearized.
     template <class Traits0>
- helper_pointer<Traits0> create_helper_pointer(const iterator<Buff, Traits0>& it) const {
- helper_pointer<Traits0> helper;
- helper.m_end = (it.m_it == 0);
- helper.m_it = helper.m_end ? m_buff->m_last : it.m_it;
- return helper;
- }
-
- //! Less.
- template <class InternalIterator0, class InternalIterator1>
- bool less(const InternalIterator0& lhs, const InternalIterator1& rhs) const {
- difference_type ldiff = lhs.m_it - m_buff->m_first;
- difference_type rdiff = rhs.m_it - m_buff->m_first;
- if (ldiff < 0) {
- if (rdiff < 0)
- return lhs.m_it < rhs.m_it;
- else if (rdiff == 0)
- return rhs.m_end;
- } else if (ldiff == 0) {
- if (rdiff < 0)
- return !lhs.m_end;
- else if (rdiff == 0)
- return !lhs.m_end && rhs.m_end;
- else
- return !lhs.m_end;
- } else { // ldiff > 0
- if (rdiff < 0)
- return true;
- else if (rdiff == 0)
- return rhs.m_end;
- else
- return lhs.m_it < rhs.m_it;
- }
- return false;
+ typename Traits0::pointer linearize_pointer(const iterator<Buff, Traits0>& it) const {
+ return it.m_it == 0 ? m_buff->m_buff + m_buff->size() :
+ (it.m_it < m_buff->m_first ? it.m_it + (m_buff->m_end - m_buff->m_first)
+ : m_buff->m_buff + (it.m_it - m_buff->m_first));
     }
 };
 

Modified: trunk/boost/circular_buffer/space_optimized.hpp
==============================================================================
--- trunk/boost/circular_buffer/space_optimized.hpp (original)
+++ trunk/boost/circular_buffer/space_optimized.hpp 2008-07-23 16:40:46 EDT (Wed, 23 Jul 2008)
@@ -1,6 +1,6 @@
 // Implementation of the circular buffer adaptor.
 
-// Copyright (c) 2003-2007 Jan Gaspar
+// Copyright (c) 2003-2008 Jan Gaspar
 
 // Use, modification, and distribution is subject to the Boost Software
 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -90,6 +90,8 @@
     using circular_buffer<T, Alloc>::array_one;
     using circular_buffer<T, Alloc>::array_two;
     using circular_buffer<T, Alloc>::linearize;
+ using circular_buffer<T, Alloc>::is_linearized;
+ using circular_buffer<T, Alloc>::rotate;
     using circular_buffer<T, Alloc>::size;
     using circular_buffer<T, Alloc>::max_size;
     using circular_buffer<T, Alloc>::empty;

Modified: trunk/boost/circular_buffer_fwd.hpp
==============================================================================
--- trunk/boost/circular_buffer_fwd.hpp (original)
+++ trunk/boost/circular_buffer_fwd.hpp 2008-07-23 16:40:46 EDT (Wed, 23 Jul 2008)
@@ -1,6 +1,6 @@
 // Forward declaration of the circular buffer and its adaptor.
 
-// Copyright (c) 2003-2007 Jan Gaspar
+// Copyright (c) 2003-2008 Jan Gaspar
 
 // Use, modification, and distribution is subject to the Boost Software
 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at

Modified: trunk/libs/circular_buffer/doc/Doxyfile
==============================================================================
--- trunk/libs/circular_buffer/doc/Doxyfile (original)
+++ trunk/libs/circular_buffer/doc/Doxyfile 2008-07-23 16:40:46 EDT (Wed, 23 Jul 2008)
@@ -1,6 +1,6 @@
 # Doxygen configuration file.
 #
-# Copyright (c) 2003-2007 Jan Gaspar
+# Copyright (c) 2003-2008 Jan Gaspar
 #
 # Distributed under the Boost Software License, Version 1.0. (See
 # accompanying file LICENSE_1_0.txt or copy at

Modified: trunk/libs/circular_buffer/doc/HOWTO-srcdoc
==============================================================================
--- trunk/libs/circular_buffer/doc/HOWTO-srcdoc (original)
+++ trunk/libs/circular_buffer/doc/HOWTO-srcdoc 2008-07-23 16:40:46 EDT (Wed, 23 Jul 2008)
@@ -2,7 +2,7 @@
 # HOW-TO documentation about generating/updating source code documentation for #
 # the Circular Buffer library. #
 # #
-# Copyright (c) 2007 Jan Gaspar #
+# Copyright (c) 2003-2008 Jan Gaspar #
 # #
 # Use, modification, and distribution is subject to the Boost Software #
 # License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at #

Modified: trunk/libs/circular_buffer/doc/Tidy.conf
==============================================================================
--- trunk/libs/circular_buffer/doc/Tidy.conf (original)
+++ trunk/libs/circular_buffer/doc/Tidy.conf 2008-07-23 16:40:46 EDT (Wed, 23 Jul 2008)
@@ -1,6 +1,6 @@
 # HTML Tidy configuration file.
 #
-# Copyright (c) 2003-2007 Jan Gaspar
+# Copyright (c) 2003-2008 Jan Gaspar
 #
 # Distributed under the Boost Software License, Version 1.0. (See
 # accompanying file LICENSE_1_0.txt or copy at

Modified: trunk/libs/circular_buffer/doc/circular_buffer.html
==============================================================================
--- trunk/libs/circular_buffer/doc/circular_buffer.html (original)
+++ trunk/libs/circular_buffer/doc/circular_buffer.html 2008-07-23 16:40:46 EDT (Wed, 23 Jul 2008)
@@ -26,29 +26,82 @@
     </table>
     <h2>
       Contents
- </h2>Description<br>
- Introductory Example<br>
- Synopsis<br>
- Rationale<br>
- - Thread-Safety<br>
- - Overwrite Operation<br>
- - Writing to a Full Buffer<br>
- - Reading/Removing from an Empty Buffer<br>
- - Iterator Invalidation<br>
- Caveats<br>
- Debug Support<br>
- More Examples<br>
- Header Files<br>
- Modelled Concepts<br>
- Template Parameters<br>
- Public Types<br>
- Constructors and Destructor<br>
- Public Member Functions<br>
- Standalone Functions<br>
- Notes<br>
- See also<br>
- Acknowledgements<br>
- Release Notes
+ </h2>
+ <dl>
+ <dt>
+ Description
+ </dt>
+ <dt>
+ Introductory Example
+ </dt>
+ <dt>
+ Synopsis
+ </dt>
+ <dt>
+ Rationale
+ </dt>
+ <dd>
+ <ul>
+ <li>
+ Thread-Safety
+ </li>
+ <li>
+ Overwrite Operation
+ </li>
+ <li>
+ Writing to a Full Buffer
+ </li>
+ <li>
+ Reading/Removing from an Empty Buffer
+ </li>
+ <li>
+ Iterator Invalidation
+ </li>
+ </ul>
+ </dd>
+ <dt>
+ Caveats
+ </dt>
+ <dt>
+ Debug Support
+ </dt>
+ <dt>
+ More Examples
+ </dt>
+ <dt>
+ Header Files
+ </dt>
+ <dt>
+ Modelled Concepts
+ </dt>
+ <dt>
+ Template Parameters
+ </dt>
+ <dt>
+ Public Types
+ </dt>
+ <dt>
+ Constructors and Destructor
+ </dt>
+ <dt>
+ Public Member Functions
+ </dt>
+ <dt>
+ Standalone Functions
+ </dt>
+ <dt>
+ Notes
+ </dt>
+ <dt>
+ See also
+ </dt>
+ <dt>
+ Acknowledgements
+ </dt>
+ <dt>
+ Release Notes
+ </dt>
+ </dl>
     <table id="table_figure" align="right" border="0">
       <tr>
         <td>
@@ -228,6 +281,9 @@
    const_array_range array_one() const;
    const_array_range array_two() const;
    pointer linearize();
+ bool is_linearized() const;
+ void <a href=
+"#classboost_1_1circular__buffer_1c591bb9e271b10b5240afcff3bd2c619">rotate</a>(const_iterator new_begin);
    size_type size() const;
    size_type max_size() const;
    bool empty() const;
@@ -589,9 +645,9 @@
 </pre>
     <p>
       The <code>circular_buffer</code> has a capacity of three <code>int</code>. Therefore, the size of the buffer will
- not exceed three. The <code>accumulate</code> algorithm
- evaluates the sum of the stored elements. The semantics of the <code>circular_buffer</code> can be inferred from
- the assertions.
+ not exceed three. The <code>std::accumulate</code>
+ algorithm evaluates the sum of the stored elements. The semantics of the <code>circular_buffer</code> can be
+ inferred from the assertions.
     </p>
     <h4>
       <a name="boundedbuffer" id="boundedbuffer">Bounded Buffer Example</a>
@@ -997,6 +1053,27 @@
                 value_type)</a></code>) nothing will be inserted and the size (as well as capacity) remains zero.
               </dd>
             </dl>
+ <dl>
+ <dt>
+ <b>Note:</b>
+ </dt>
+ <dd>
+ You can explicitly set the capacity by calling the <code><a href=
+ "#classboost_1_1circular__buffer_161714204ef5172d156e2c7eccd04998f">set_capacity(capacity_type)</a></code>
+ method or you can use the other constructor with the capacity specified.
+ </dd>
+ </dl>
+ <dl>
+ <dt>
+ <b>See Also:</b>
+ </dt>
+ <dd>
+ <code><a href=
+ "#classboost_1_1circular__buffer_1862a64cbc6a49376ecbb8321c3b44974">circular_buffer(capacity_type,
+ const allocator_type&amp; alloc)</a></code>, <code><a href=
+ "#classboost_1_1circular__buffer_161714204ef5172d156e2c7eccd04998f">set_capacity(capacity_type)</a></code>
+ </dd>
+ </dl>
           </td>
         </tr>
         <tr>
@@ -3175,7 +3252,183 @@
                 "#classboost_1_1circular__buffer_1957cccdcb0c4ef7d80a34a990065818d">array_one()</a></code> and
                 <code><a href=
                 "#classboost_1_1circular__buffer_1f5081a54afbc2dfc1a7fb20329df7d5b">array_two()</a></code> for the
- other option how to pass data into a legacy C API.
+ other option how to pass data into a legacy C API; <code><a href=
+ "#classboost_1_1circular__buffer_120f64448dc0723cc68c1096f6b00bc0a">is_linearized()</a></code>,
+ <code><a href=
+ "#classboost_1_1circular__buffer_1c591bb9e271b10b5240afcff3bd2c619">rotate(const_iterator)</a></code>
+ </dd>
+ </dl>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <a id="classboost_1_1circular__buffer_120f64448dc0723cc68c1096f6b00bc0a" name=
+ "classboost_1_1circular__buffer_120f64448dc0723cc68c1096f6b00bc0a"></a><code><b>bool is_linearized()
+ const;</b></code><br>
+ <br>
+ Is the <code>circular_buffer</code> linearized?
+ <dl>
+ <dt>
+ <b>Returns:</b>
+ </dt>
+ <dd>
+ <code>true</code> if the internal buffer is linearized into a continuous array (i.e. the
+ <code>circular_buffer</code> meets a condition <code>&amp;(*this)[0] &lt; &amp;(*this)[1] &lt; ... &lt;
+ &amp;(*this)[size() -
+ 1]</code>); <code>false</code> otherwise.
+ </dd>
+ </dl>
+ <dl>
+ <dt>
+ <b>Throws:</b>
+ </dt>
+ <dd>
+ Nothing.
+ </dd>
+ </dl>
+ <dl>
+ <dt>
+ <b>Exception Safety:</b>
+ </dt>
+ <dd>
+ No-throw.
+ </dd>
+ </dl>
+ <dl>
+ <dt>
+ <b>Iterator Invalidation:</b>
+ </dt>
+ <dd>
+ Does not invalidate any iterators.
+ </dd>
+ </dl>
+ <dl>
+ <dt>
+ <b>Complexity:</b>
+ </dt>
+ <dd>
+ Constant (in the size of the <code>circular_buffer</code>).
+ </dd>
+ </dl>
+ <dl>
+ <dt>
+ <b>See Also:</b>
+ </dt>
+ <dd>
+ <code><a href=
+ "#classboost_1_1circular__buffer_1ea728bf57f91aa8946eddf76ce816a4e">linearize()</a></code>,
+ <code><a href=
+ "#classboost_1_1circular__buffer_1957cccdcb0c4ef7d80a34a990065818d">array_one()</a></code>,
+ <code><a href=
+ "#classboost_1_1circular__buffer_1f5081a54afbc2dfc1a7fb20329df7d5b">array_two()</a></code>
+ </dd>
+ </dl>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <a id="classboost_1_1circular__buffer_1c591bb9e271b10b5240afcff3bd2c619" name=
+ "classboost_1_1circular__buffer_1c591bb9e271b10b5240afcff3bd2c619"></a><code><b>void rotate(<a href=
+ "#classboost_1_1circular__buffer_15cab6d46f03c40d1e52d41843319ddb9">const_iterator</a>
+ new_begin);</b></code><br>
+ <br>
+ Rotate elements in the <code>circular_buffer</code>.
+ <p>
+ A more effective implementation of <code><a href=
+ "http://www.sgi.com/tech/stl/rotate.html">std::rotate</a></code>.
+ </p>
+ <dl>
+ <dt>
+ <b>Precondition:</b>
+ </dt>
+ <dd>
+ <code>new_begin</code> is a valid iterator pointing to the <code>circular_buffer</code> <b>except</b>
+ its end.
+ </dd>
+ </dl>
+ <dl>
+ <dt>
+ <b>Effect:</b>
+ </dt>
+ <dd>
+ Before calling the method suppose:<br>
+ <br>
+ <code>m == std::distance(new_begin, <a href=
+ "#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a>)</code><br>
+ <code>n == std::distance(<a href=
+ "#classboost_1_1circular__buffer_158d1ede2e85f5d46eda8db3f0c4efef0">begin()</a>, new_begin)</code><br>
+ <code>val_0 == *new_begin, val_1 == *(new_begin + 1), ... val_m == *(new_begin + m)</code><br>
+ <code>val_r1 == *(new_begin - 1), val_r2 == *(new_begin - 2), ... val_rn == *(new_begin - n)</code><br>
+ <br>
+ then after call to the method:<br>
+ <br>
+ <code>val_0 == (*this)[0] &amp;&amp; val_1 == (*this)[1] &amp;&amp; ... &amp;&amp; val_m == (*this)[m -
+ 1] &amp;&amp; val_r1 == (*this)[m + n - 1] &amp;&amp; val_r2 == (*this)[m + n - 2] &amp;&amp; ...
+ &amp;&amp; val_rn == (*this)[m]</code>
+ </dd>
+ </dl>
+ <dl>
+ <dt>
+ <b>Parameter(s):</b>
+ </dt>
+ <dd>
+ <dl compact>
+ <dt>
+ <code>new_begin</code>
+ </dt>
+ <dd>
+ The new beginning.
+ </dd>
+ </dl>
+ </dd>
+ </dl>
+ <dl>
+ <dt>
+ <b>Throws:</b>
+ </dt>
+ <dd>
+ Whatever <code>T::T(const T&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; no-throw if the <code>circular_buffer</code> is full or <code>new_begin</code> points to
+ <code>begin()</code> or
+ if the operations in the <i>Throws</i> section do not throw anything.
+ </dd>
+ </dl>
+ <dl>
+ <dt>
+ <b>Iterator Invalidation:</b>
+ </dt>
+ <dd>
+ If <code>m &lt; n</code> invalidates iterators pointing to the last <code>m</code> elements
+ (<b>including</b> <code>new_begin</code>, but not iterators equal to <code><a href=
+ "#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end()</a></code>) else invalidates
+ iterators pointing to the first <code>n</code> elements; does not invalidate any iterators if the
+ <code>circular_buffer</code> is full.
+ </dd>
+ </dl>
+ <dl>
+ <dt>
+ <b>Complexity:</b>
+ </dt>
+ <dd>
+ Linear (in <code>std::min(m, n)</code>); constant if the <code>circular_buffer</code> is full.
+ </dd>
+ </dl>
+ <dl>
+ <dt>
+ <b>See Also:</b>
+ </dt>
+ <dd>
+ <code>std::rotate</code>
               </dd>
             </dl>
           </td>
@@ -4618,6 +4871,9 @@
               <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>
@@ -4700,6 +4956,9 @@
               <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>
@@ -6856,9 +7115,41 @@
     <h2>
       <a name="relnotes" id="relnotes">Release Notes</a>
     </h2>
+ <dl>
+ <dd>
+ <h3>
+ Boost 1.36
+ </h3>
+ </dd>
+ <dd>
+ <ul>
+ <li>Changed behaviour of the <code>circular_buffer(const allocator_type&amp;)</code> constructor. Since this
+ version the constructor does not allocate any memory and both capacity and size are set to zero.
+ </li>
+ <li>Added new methods <code>is_linearized()</code> and <code>rotate(const_iterator)</code>.
+ </li>
+ <li>Fixed bugs:<br>
+ #1987 Patch to make <code>circular_buffer.hpp</code> #includes absolute.<br>
+ #1919 Default constructed circular buffer throws <code>std::bad_alloc</code>.<br>
+ #1852 Copy constructor does not copy capacity.
+ </li>
+ </ul>
+ </dd>
+ <dd>
+ <h3>
+ Boost 1.35
+ </h3>
+ </dd>
+ <dd>
+ <ul>
+ <li>Initial release.
+ </li>
+ </ul>
+ </dd>
+ </dl>
     <hr size="1">
     <p>
- <small>Copyright © 2003-2007 Jan Gaspar</small>
+ <small>Copyright © 2003-2008 Jan Gaspar</small>
     </p>
     <p>
       <small>Use, modification, and distribution is subject to the Boost Software License, Version 1.0.<br>

Modified: trunk/libs/circular_buffer/doc/circular_buffer.xslt
==============================================================================
--- trunk/libs/circular_buffer/doc/circular_buffer.xslt (original)
+++ trunk/libs/circular_buffer/doc/circular_buffer.xslt 2008-07-23 16:40:46 EDT (Wed, 23 Jul 2008)
@@ -3,7 +3,7 @@
 XSL transformation from the XML files generated by Doxygen into XHTML source
 code documentation of the circular_buffer.
 
-Copyright (c) 2007 Jan Gaspar
+Copyright (c) 2003-2008 Jan Gaspar
 
 Use, modification, and distribution is subject to the Boost Software
 License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at

Modified: trunk/libs/circular_buffer/doc/copy.xslt
==============================================================================
--- trunk/libs/circular_buffer/doc/copy.xslt (original)
+++ trunk/libs/circular_buffer/doc/copy.xslt 2008-07-23 16:40:46 EDT (Wed, 23 Jul 2008)
@@ -2,7 +2,7 @@
 <!--
 Helper XSL transformation making plain copy of an XML tree.
 
-Copyright (c) 2007 Jan Gaspar
+Copyright (c) 2003-2008 Jan Gaspar
 
 Use, modification, and distribution is subject to the Boost Software
 License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at

Modified: trunk/libs/circular_buffer/doc/doxygen2html.xslt
==============================================================================
--- trunk/libs/circular_buffer/doc/doxygen2html.xslt (original)
+++ trunk/libs/circular_buffer/doc/doxygen2html.xslt 2008-07-23 16:40:46 EDT (Wed, 23 Jul 2008)
@@ -3,7 +3,7 @@
 Generic XSL transformation from the XML files generated by Doxygen into XHTML
 source code documentation.
 
-Copyright (c) 2007 Jan Gaspar
+Copyright (c) 2003-2008 Jan Gaspar
 
 Use, modification, and distribution is subject to the Boost Software
 License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at

Modified: trunk/libs/circular_buffer/doc/html2xhtml.xslt
==============================================================================
--- trunk/libs/circular_buffer/doc/html2xhtml.xslt (original)
+++ trunk/libs/circular_buffer/doc/html2xhtml.xslt 2008-07-23 16:40:46 EDT (Wed, 23 Jul 2008)
@@ -2,7 +2,7 @@
 <!--
 Helper XSL transformation which converts HTML into XHTML.
 
-Copyright (c) 2007 Jan Gaspar
+Copyright (c) 2003-2008 Jan Gaspar
 
 Use, modification, and distribution is subject to the Boost Software
 License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at

Modified: trunk/libs/circular_buffer/doc/space_optimized.html
==============================================================================
--- trunk/libs/circular_buffer/doc/space_optimized.html (original)
+++ trunk/libs/circular_buffer/doc/space_optimized.html 2008-07-23 16:40:46 EDT (Wed, 23 Jul 2008)
@@ -181,6 +181,10 @@
 "circular_buffer.html#classboost_1_1circular__buffer_1bb8eb0f298ad2012c55c5303e1f174d5">array_two</a>() const;
    pointer <a href=
 "circular_buffer.html#classboost_1_1circular__buffer_1ea728bf57f91aa8946eddf76ce816a4e">linearize</a>();
+ bool <a href=
+"circular_buffer.html#classboost_1_1circular__buffer_120f64448dc0723cc68c1096f6b00bc0a">is_linearized</a>() const;
+ void <a href=
+"circular_buffer.html#classboost_1_1circular__buffer_1c591bb9e271b10b5240afcff3bd2c619">rotate</a>(const_iterator new_begin);
    size_type <a href=
 "circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size</a>() const;
    size_type <a href=
@@ -4172,9 +4176,39 @@
     <p>
       The idea of the space optimized circular buffer has been introduced by Pavel Vozenilek.
     </p>
+ <h2>
+ <a name="relnotes" id="relnotes">Release Notes</a>
+ </h2>
+ <dl>
+ <dd>
+ <h3>
+ Boost 1.36
+ </h3>
+ </dd>
+ <dd>
+ <ul>
+ <li>Changed behaviour of the <code>circular_buffer_space_optimized(const allocator_type&amp;)</code>
+ constructor. Since this version the constructor sets the capacity to zero.
+ </li>
+ <li>Added new methods <code>is_linearized()</code> and <code>rotate(const_iterator)</code>.
+ </li>
+ </ul>
+ </dd>
+ <dd>
+ <h3>
+ Boost 1.35
+ </h3>
+ </dd>
+ <dd>
+ <ul>
+ <li>Initial release.
+ </li>
+ </ul>
+ </dd>
+ </dl>
     <hr size="1">
     <p>
- <small>Copyright © 2003-2007 Jan Gaspar</small>
+ <small>Copyright © 2003-2008 Jan Gaspar</small>
     </p>
     <p>
       <small>Use, modification, and distribution is subject to the Boost Software License, Version 1.0.<br>

Modified: trunk/libs/circular_buffer/doc/space_optimized.xslt
==============================================================================
--- trunk/libs/circular_buffer/doc/space_optimized.xslt (original)
+++ trunk/libs/circular_buffer/doc/space_optimized.xslt 2008-07-23 16:40:46 EDT (Wed, 23 Jul 2008)
@@ -3,7 +3,7 @@
 XSL transformation from the XML files generated by Doxygen into XHTML source
 code documentation of the circular_buffer_space_optimized.
 
-Copyright (c) 2007 Jan Gaspar
+Copyright (c) 2003-2008 Jan Gaspar
 
 Use, modification, and distribution is subject to the Boost Software
 License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at

Modified: trunk/libs/circular_buffer/doc/update_srcdoc.sh
==============================================================================
--- trunk/libs/circular_buffer/doc/update_srcdoc.sh (original)
+++ trunk/libs/circular_buffer/doc/update_srcdoc.sh 2008-07-23 16:40:46 EDT (Wed, 23 Jul 2008)
@@ -3,7 +3,7 @@
 # Shell script which updates the Circular Buffer library documentation with #
 # the latest source code documentation (which is in the source files). #
 # #
-# Copyright (c) 2007 Jan Gaspar #
+# Copyright (c) 2003-2008 Jan Gaspar #
 # #
 # Use, modification, and distribution is subject to the Boost Software #
 # License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at #

Modified: trunk/libs/circular_buffer/doc/update_srcdoc.xslt
==============================================================================
--- trunk/libs/circular_buffer/doc/update_srcdoc.xslt (original)
+++ trunk/libs/circular_buffer/doc/update_srcdoc.xslt 2008-07-23 16:40:46 EDT (Wed, 23 Jul 2008)
@@ -3,7 +3,7 @@
 Helper XSL transformation updating source code documentation sections
 in the specified HTML file.
 
-Copyright (c) 2007 Jan Gaspar
+Copyright (c) 2003-2008 Jan Gaspar
 
 Use, modification, and distribution is subject to the Boost Software
 License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at

Modified: trunk/libs/circular_buffer/index.html
==============================================================================
--- trunk/libs/circular_buffer/index.html (original)
+++ trunk/libs/circular_buffer/index.html 2008-07-23 16:40:46 EDT (Wed, 23 Jul 2008)
@@ -11,7 +11,7 @@
   <body>
     Automatic redirection failed, please go to circular_buffer.html.
     <p>
- <small>Copyright © 2003-2007 Jan Gaspar</small>
+ <small>Copyright © 2003-2008 Jan Gaspar</small>
     </p>
     <p>
       <small>Use, modification, and distribution is subject to the Boost Software License, Version 1.0.<br>

Modified: trunk/libs/circular_buffer/test/Jamfile.v2
==============================================================================
--- trunk/libs/circular_buffer/test/Jamfile.v2 (original)
+++ trunk/libs/circular_buffer/test/Jamfile.v2 2008-07-23 16:40:46 EDT (Wed, 23 Jul 2008)
@@ -1,6 +1,6 @@
 # Boost circular_buffer test Jamfile.
 #
-# Copyright (c) 2003-2007 Jan Gaspar
+# Copyright (c) 2003-2008 Jan Gaspar
 #
 # Distributed under the Boost Software License, Version 1.0. (See
 # accompanying file LICENSE_1_0.txt or copy at

Modified: trunk/libs/circular_buffer/test/base_test.cpp
==============================================================================
--- trunk/libs/circular_buffer/test/base_test.cpp (original)
+++ trunk/libs/circular_buffer/test/base_test.cpp 2008-07-23 16:40:46 EDT (Wed, 23 Jul 2008)
@@ -1,6 +1,6 @@
 // Test of the base circular buffer container.
 
-// Copyright (c) 2003-2007 Jan Gaspar
+// Copyright (c) 2003-2008 Jan Gaspar
 
 // Use, modification, and distribution is subject to the Boost Software
 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -61,6 +61,7 @@
     BOOST_CHECK(end - end == 0);
     BOOST_CHECK(begin - cb.end() == -5);
     BOOST_CHECK(it1 - cb.begin() == 2);
+ BOOST_CHECK(it1 - begin == 2);
     BOOST_CHECK(end - it1 == 3);
     BOOST_CHECK(it2 - it1 == 1);
     BOOST_CHECK(it1 - it2 == -1);
@@ -505,6 +506,62 @@
     BOOST_CHECK(!it3.is_valid(&cb13));
     BOOST_CHECK(!it4.is_valid(&cb13));
 
+ circular_buffer<MyInteger> cb14(10);
+ cb14.push_back(1);
+ cb14.push_back(2);
+ cb14.push_back(3);
+ cb14.push_back(4);
+ cb14.push_back(5);
+ cb14.push_back(6);
+ cb14.push_back(7);
+ it1 = cb14.end();
+ it2 = cb14.begin() + 2;
+ it3 = cb14.begin() + 1;
+ it4 = cb14.begin() + 5;
+ cb14.rotate(it2);
+ BOOST_CHECK(it1.is_valid(&cb14));
+ BOOST_CHECK(it2.is_valid(&cb14));
+ BOOST_CHECK(!it3.is_valid(&cb14));
+ BOOST_CHECK(it4.is_valid(&cb14));
+
+ circular_buffer<MyInteger> cb15(7);
+ cb15.push_back(1);
+ cb15.push_back(2);
+ cb15.push_back(3);
+ cb15.push_back(4);
+ cb15.push_back(5);
+ cb15.push_back(6);
+ cb15.push_back(7);
+ cb15.push_back(8);
+ cb15.push_back(9);
+ it1 = cb15.end();
+ it2 = cb15.begin() + 2;
+ it3 = cb15.begin() + 1;
+ it4 = cb15.begin() + 5;
+ cb15.rotate(it3);
+ BOOST_CHECK(it1.is_valid(&cb15));
+ BOOST_CHECK(it2.is_valid(&cb15));
+ BOOST_CHECK(it3.is_valid(&cb15));
+ BOOST_CHECK(it4.is_valid(&cb15));
+
+ circular_buffer<MyInteger> cb16(10);
+ cb16.push_back(1);
+ cb16.push_back(2);
+ cb16.push_back(3);
+ cb16.push_back(4);
+ cb16.push_back(5);
+ cb16.push_back(6);
+ cb16.push_back(7);
+ it1 = cb16.end();
+ it2 = cb16.begin() + 6;
+ it3 = cb16.begin();
+ it4 = cb16.begin() + 5;
+ cb16.rotate(it4);
+ BOOST_CHECK(it1.is_valid(&cb16));
+ BOOST_CHECK(!it2.is_valid(&cb16));
+ BOOST_CHECK(it3.is_valid(&cb16));
+ BOOST_CHECK(!it4.is_valid(&cb16));
+
 #endif // #if !defined(NDEBUG) && !defined(BOOST_CB_DISABLE_DEBUG)
 }
 

Modified: trunk/libs/circular_buffer/test/bounded_buffer_comparison.cpp
==============================================================================
--- trunk/libs/circular_buffer/test/bounded_buffer_comparison.cpp (original)
+++ trunk/libs/circular_buffer/test/bounded_buffer_comparison.cpp 2008-07-23 16:40:46 EDT (Wed, 23 Jul 2008)
@@ -1,6 +1,6 @@
 // Comparison of bounded buffers based on different containers.
 
-// Copyright (c) 2003-2007 Jan Gaspar
+// Copyright (c) 2003-2008 Jan Gaspar
 
 // Use, modification, and distribution is subject to the Boost Software
 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at

Modified: trunk/libs/circular_buffer/test/common.ipp
==============================================================================
--- trunk/libs/circular_buffer/test/common.ipp (original)
+++ trunk/libs/circular_buffer/test/common.ipp 2008-07-23 16:40:46 EDT (Wed, 23 Jul 2008)
@@ -1,6 +1,6 @@
 // Common tests for the circular buffer and its adaptor.
 
-// Copyright (c) 2003-2007 Jan Gaspar
+// Copyright (c) 2003-2008 Jan Gaspar
 
 // Use, modification, and distribution is subject to the Boost Software
 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -328,8 +328,16 @@
     cb6.push_back(5);
     cb6.push_back(6);
     cb6.pop_back();
+ CB_CONTAINER<MyInteger> cb7(6);
+ cb7.push_back(0);
+ cb7.push_back(1);
+ cb7.push_back(2);
+ cb7.push_back(3);
+ cb7.push_back(4);
 
+ BOOST_CHECK(!cb1.is_linearized());
     BOOST_CHECK(*cb1.linearize() == 4);
+ BOOST_CHECK(cb1.is_linearized());
     BOOST_CHECK(cb1.linearize() == cb1.array_one().first);
     BOOST_CHECK(&cb1[0] < &cb1[1]
         && &cb1[1] < &cb1[2]
@@ -349,7 +357,9 @@
     BOOST_CHECK(*(cb1.linearize() + 7) == 11);
     BOOST_CHECK(*(cb1.linearize() + 8) == 12);
     BOOST_CHECK(*(cb1.linearize() + 9) == 13);
+ BOOST_CHECK(!cb2.is_linearized());
     BOOST_CHECK(*cb2.linearize() == 8);
+ BOOST_CHECK(cb2.is_linearized());
     BOOST_CHECK(&cb2[0] < &cb2[1]
         && &cb2[1] < &cb2[2]
         && &cb2[2] < &cb2[3]
@@ -368,7 +378,9 @@
     BOOST_CHECK(*(cb2.linearize() + 7) == 15);
     BOOST_CHECK(*(cb2.linearize() + 8) == 16);
     BOOST_CHECK(*(cb2.linearize() + 9) == 17);
+ BOOST_CHECK(cb2.is_linearized());
     BOOST_CHECK(*cb3.linearize() == 6);
+ BOOST_CHECK(cb3.is_linearized());
     BOOST_CHECK(&cb3[0] < &cb3[1]
         && &cb3[1] < &cb3[2]
         && &cb3[2] < &cb3[3]
@@ -384,7 +396,9 @@
     BOOST_CHECK(*(cb3.linearize() + 6) == 12);
     BOOST_CHECK(*(cb3.linearize() + 7) == 13);
     BOOST_CHECK(cb4.linearize() == 0);
+ BOOST_CHECK(cb4.is_linearized());
     BOOST_CHECK(*cb5.linearize() == 10);
+ BOOST_CHECK(cb5.is_linearized());
     BOOST_CHECK(&cb5[0] < &cb5[1]
         && &cb5[1] < &cb5[2]
         && &cb5[2] < &cb5[3]
@@ -396,6 +410,7 @@
     BOOST_CHECK(*(cb5.linearize() + 4) == 14);
     BOOST_CHECK(*(cb5.linearize() + 5) == 15);
     BOOST_CHECK(*cb6.linearize() == 1);
+ BOOST_CHECK(cb6.is_linearized());
     BOOST_CHECK(&cb6[0] < &cb6[1]
         && &cb6[1] < &cb6[2]
         && &cb6[2] < &cb6[3]
@@ -404,6 +419,7 @@
     BOOST_CHECK(*(cb6.linearize() + 2) == 3);
     BOOST_CHECK(*(cb6.linearize() + 3) == 4);
     BOOST_CHECK(*(cb6.linearize() + 4) == 5);
+ BOOST_CHECK(cb7.is_linearized());
 
     generic_test(cb1);
     generic_test(cb2);
@@ -411,6 +427,7 @@
     generic_test(cb4);
     generic_test(cb5);
     generic_test(cb6);
+ generic_test(cb7);
 }
 
 void array_range_test() {
@@ -1813,6 +1830,122 @@
     BOOST_CHECK(cb.back() == 5);
 }
 
+void rotate_test() {
+
+ CB_CONTAINER<MyInteger> cb1(10);
+ cb1.push_back(1);
+ cb1.push_back(2);
+ cb1.push_back(3);
+ cb1.push_back(4);
+ cb1.push_back(5);
+ cb1.push_back(6);
+ cb1.push_back(7);
+ CB_CONTAINER<MyInteger> cb2 = cb1;
+ CB_CONTAINER<MyInteger>::iterator it1 = cb1.begin() + 2;
+ int v1_0 = *it1;
+ int v1_1 = *(it1 + 1);
+ int v1_2 = *(it1 + 2);
+ int v1_3 = *(it1 + 3);
+ int v1_4 = *(it1 + 4);
+ int v1_r1 = *(it1 - 1);
+ int v1_r2 = *(it1 - 2);
+ cb1.rotate(it1);
+ rotate(cb2.begin(), cb2.begin() + 2, cb2.end());
+
+ CB_CONTAINER<MyInteger> cb3(7);
+ cb3.push_back(1);
+ cb3.push_back(2);
+ cb3.push_back(3);
+ cb3.push_back(4);
+ cb3.push_back(5);
+ cb3.push_back(6);
+ cb3.push_back(7);
+ cb3.push_back(8);
+ cb3.push_back(9);
+ CB_CONTAINER<MyInteger> cb4 = cb3;
+ CB_CONTAINER<MyInteger>::iterator it2 = cb3.begin() + 1;
+ int v2_0 = *it2;
+ int v2_1 = *(it2 + 1);
+ int v2_2 = *(it2 + 2);
+ int v2_3 = *(it2 + 3);
+ int v2_4 = *(it2 + 4);
+ int v2_5 = *(it2 + 5);
+ int v2_r1 = *(it2 - 1);
+ cb3.rotate(it2);
+ rotate(cb4.begin(), cb4.begin() + 1, cb4.end());
+
+ CB_CONTAINER<MyInteger> cb5(10);
+ cb5.push_back(1);
+ cb5.push_back(2);
+ cb5.push_back(3);
+ cb5.push_back(4);
+ cb5.push_back(5);
+ cb5.push_back(6);
+ cb5.push_back(7);
+ CB_CONTAINER<MyInteger> cb6 = cb5;
+ CB_CONTAINER<MyInteger>::iterator it3 = cb5.begin() + 5;
+ int v3_0 = *it3;
+ int v3_1 = *(it3 + 1);
+ int v3_r1 = *(it3 - 1);
+ int v3_r2 = *(it3 - 2);
+ int v3_r3 = *(it3 - 3);
+ int v3_r4 = *(it3 - 4);
+ int v3_r5 = *(it3 - 5);
+ cb5.rotate(it3);
+ rotate(cb6.begin(), cb6.begin() + 5, cb6.end());
+
+ BOOST_CHECK(!cb1.full());
+ BOOST_CHECK(cb1 == cb2);
+ BOOST_CHECK(v1_0 == *it1);
+ BOOST_CHECK(v1_1 == *(it1 + 1));
+ BOOST_CHECK(v1_2 == *(it1 + 2));
+ BOOST_CHECK(v1_3 == *(it1 + 3));
+ BOOST_CHECK(v1_4 == *(it1 + 4));
+ BOOST_CHECK(v1_r1 == *(it1 + 6));
+ BOOST_CHECK(v1_r2 == *(it1 + 5));
+ BOOST_CHECK(cb1.begin() == it1);
+ BOOST_CHECK(v1_0 == cb1[0]);
+ BOOST_CHECK(v1_1 == cb1[1]);
+ BOOST_CHECK(v1_2 == cb1[2]);
+ BOOST_CHECK(v1_3 == cb1[3]);
+ BOOST_CHECK(v1_4 == cb1[4]);
+ BOOST_CHECK(v1_r1 == cb1[6]);
+ BOOST_CHECK(v1_r2 == cb1[5]);
+ BOOST_CHECK(cb3.full());
+ BOOST_CHECK(cb3 == cb4);
+ BOOST_CHECK(v2_0 == *it2);
+ BOOST_CHECK(v2_1 == *(it2 + 1));
+ BOOST_CHECK(v2_2 == *(it2 + 2));
+ BOOST_CHECK(v2_3 == *(it2 + 3));
+ BOOST_CHECK(v2_4 == *(it2 + 4));
+ BOOST_CHECK(v2_5 == *(it2 + 5));
+ BOOST_CHECK(v2_r1 == *(it2 + 6));
+ BOOST_CHECK(cb3.begin() == it2);
+ BOOST_CHECK(v2_0 == cb3[0]);
+ BOOST_CHECK(v2_1 == cb3[1]);
+ BOOST_CHECK(v2_2 == cb3[2]);
+ BOOST_CHECK(v2_3 == cb3[3]);
+ BOOST_CHECK(v2_4 == cb3[4]);
+ BOOST_CHECK(v2_5 == cb3[5]);
+ BOOST_CHECK(v2_r1 == cb3[6]);
+ BOOST_CHECK(!cb5.full());
+ BOOST_CHECK(cb5 == cb6);
+ BOOST_CHECK(v3_0 == cb5[0]);
+ BOOST_CHECK(v3_1 == cb5[1]);
+ BOOST_CHECK(v3_r1 == cb5[6]);
+ BOOST_CHECK(v3_r2 == cb5[5]);
+ BOOST_CHECK(v3_r3 == cb5[4]);
+ BOOST_CHECK(v3_r4 == cb5[3]);
+ BOOST_CHECK(v3_r5 == cb5[2]);
+
+ generic_test(cb1);
+ generic_test(cb2);
+ generic_test(cb3);
+ generic_test(cb4);
+ generic_test(cb5);
+ generic_test(cb6);
+}
+
 int MyInteger::ms_exception_trigger = 0;
 int InstanceCounter::ms_count = 0;
 
@@ -1860,4 +1993,5 @@
     tests->add(BOOST_TEST_CASE(&example_test));
     tests->add(BOOST_TEST_CASE(&element_destruction_test));
     tests->add(BOOST_TEST_CASE(&const_methods_test));
+ tests->add(BOOST_TEST_CASE(&rotate_test));
 }

Modified: trunk/libs/circular_buffer/test/soft_iterator_invalidation.cpp
==============================================================================
--- trunk/libs/circular_buffer/test/soft_iterator_invalidation.cpp (original)
+++ trunk/libs/circular_buffer/test/soft_iterator_invalidation.cpp 2008-07-23 16:40:46 EDT (Wed, 23 Jul 2008)
@@ -3,7 +3,7 @@
 // Note: The soft iterator invalidation definition CAN NOT be applied
 // to the space optimized circular buffer.
 
-// Copyright (c) 2003-2007 Jan Gaspar
+// Copyright (c) 2003-2008 Jan Gaspar
 
 // Use, modification, and distribution is subject to the Boost Software
 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at

Modified: trunk/libs/circular_buffer/test/space_optimized_test.cpp
==============================================================================
--- trunk/libs/circular_buffer/test/space_optimized_test.cpp (original)
+++ trunk/libs/circular_buffer/test/space_optimized_test.cpp 2008-07-23 16:40:46 EDT (Wed, 23 Jul 2008)
@@ -1,6 +1,6 @@
 // Test of the space optimized adaptor of the circular buffer.
 
-// Copyright (c) 2003-2007 Jan Gaspar
+// Copyright (c) 2003-2008 Jan Gaspar
 
 // Use, modification, and distribution is subject to the Boost Software
 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at

Modified: trunk/libs/circular_buffer/test/test.hpp
==============================================================================
--- trunk/libs/circular_buffer/test/test.hpp (original)
+++ trunk/libs/circular_buffer/test/test.hpp 2008-07-23 16:40:46 EDT (Wed, 23 Jul 2008)
@@ -1,6 +1,6 @@
 // Header file for the test of the circular buffer library.
 
-// Copyright (c) 2003-2007 Jan Gaspar
+// Copyright (c) 2003-2008 Jan Gaspar
 
 // Use, modification, and distribution is subject to the Boost Software
 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at


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