From b1e2909878838595c080ba23e0e8a31b9695ca74 Mon Sep 17 00:00:00 2001 From: Eric Niebler Date: Tue, 5 Aug 2008 05:39:57 +0000 Subject: [PATCH] merged from trunk [SVN r47983] --- doc/Doxyfile | 2 +- doc/HOWTO-srcdoc | 2 +- doc/Tidy.conf | 2 +- doc/circular_buffer.html | 347 ++++++++++++++++-- doc/circular_buffer.xslt | 2 +- doc/copy.xslt | 2 +- doc/doxygen2html.xslt | 2 +- doc/html2xhtml.xslt | 2 +- doc/space_optimized.html | 36 +- doc/space_optimized.xslt | 2 +- doc/update_srcdoc.sh | 2 +- doc/update_srcdoc.xslt | 2 +- include/boost/circular_buffer.hpp | 12 +- include/boost/circular_buffer/base.hpp | 77 +++- include/boost/circular_buffer/debug.hpp | 2 +- include/boost/circular_buffer/details.hpp | 68 +--- .../boost/circular_buffer/space_optimized.hpp | 4 +- include/boost/circular_buffer_fwd.hpp | 2 +- index.html | 2 +- test/Jamfile.v2 | 2 +- test/base_test.cpp | 59 ++- test/bounded_buffer_comparison.cpp | 2 +- test/common.ipp | 136 ++++++- test/soft_iterator_invalidation.cpp | 2 +- test/space_optimized_test.cpp | 2 +- test/test.hpp | 2 +- 26 files changed, 661 insertions(+), 114 deletions(-) diff --git a/doc/Doxyfile b/doc/Doxyfile index a57e929..0be52fd 100644 --- a/doc/Doxyfile +++ b/doc/Doxyfile @@ -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 diff --git a/doc/HOWTO-srcdoc b/doc/HOWTO-srcdoc index a846b48..cefeb42 100644 --- a/doc/HOWTO-srcdoc +++ b/doc/HOWTO-srcdoc @@ -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 # diff --git a/doc/Tidy.conf b/doc/Tidy.conf index 7e00237..a3da39c 100644 --- a/doc/Tidy.conf +++ b/doc/Tidy.conf @@ -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 diff --git a/doc/circular_buffer.html b/doc/circular_buffer.html index 7e2fda2..db95ec5 100644 --- a/doc/circular_buffer.html +++ b/doc/circular_buffer.html @@ -26,29 +26,82 @@

Contents -

Description
- Introductory Example
- Synopsis
- Rationale
- - Thread-Safety
- - Overwrite Operation
- - Writing to a Full Buffer
- - Reading/Removing from an Empty Buffer
- - Iterator Invalidation
- Caveats
- Debug Support
- More Examples
- Header Files
- Modelled Concepts
- Template Parameters
- Public Types
- Constructors and Destructor
- Public Member Functions
- Standalone Functions
- Notes
- See also
- Acknowledgements
- Release Notes + +
+
+ Description +
+
+ Introductory Example +
+
+ Synopsis +
+
+ Rationale +
+
+ +
+
+ Caveats +
+
+ Debug Support +
+
+ More Examples +
+
+ Header Files +
+
+ Modelled Concepts +
+
+ Template Parameters +
+
+ Public Types +
+
+ Constructors and Destructor +
+
+ Public Member Functions +
+
+ Standalone Functions +
+
+ Notes +
+
+ See also +
+
+ Acknowledgements +
+
+ Release Notes +
+
@@ -3175,7 +3252,183 @@ template <class T, class Alloc> "#classboost_1_1circular__buffer_1957cccdcb0c4ef7d80a34a990065818d">array_one() and array_two() for the - other option how to pass data into a legacy C API. + other option how to pass data into a legacy C API; is_linearized(), + rotate(const_iterator) + + + + + + + + + @@ -4618,6 +4871,9 @@ template <class T, class Alloc>
Whatever T::T(const T&) throws.
+
+ Whatever T::operator = (const T&) throws. +
@@ -4700,6 +4956,9 @@ template <class T, class Alloc>
Whatever T::T(const T&) throws.
+
+ Whatever T::operator = (const T&) throws. +
@@ -6856,9 +7115,41 @@ template <class T, class Alloc>

Release Notes

+
+
+

+ Boost 1.36 +

+
+
+
    +
  • Changed behaviour of the circular_buffer(const allocator_type&) constructor. Since this + version the constructor does not allocate any memory and both capacity and size are set to zero. +
  • +
  • Added new methods is_linearized() and rotate(const_iterator). +
  • +
  • Fixed bugs:
    + #1987 Patch to make circular_buffer.hpp #includes absolute.
    + #1919 Default constructed circular buffer throws std::bad_alloc.
    + #1852 Copy constructor does not copy capacity. +
  • +
+
+
+

+ Boost 1.35 +

+
+
+
    +
  • Initial release. +
  • +
+
+

- Copyright © 2003-2007 Jan Gaspar + Copyright © 2003-2008 Jan Gaspar

Use, modification, and distribution is subject to the Boost Software License, Version 1.0.
diff --git a/doc/circular_buffer.xslt b/doc/circular_buffer.xslt index 4117111..ebe9225 100644 --- a/doc/circular_buffer.xslt +++ b/doc/circular_buffer.xslt @@ -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 diff --git a/doc/copy.xslt b/doc/copy.xslt index 95f5f10..703593b 100644 --- a/doc/copy.xslt +++ b/doc/copy.xslt @@ -2,7 +2,7 @@

@@ -228,6 +281,9 @@ public: const_array_range array_one() const; const_array_range array_two() const; pointer linearize(); + bool is_linearized() const; + void rotate(const_iterator new_begin); size_type size() const; size_type max_size() const; bool empty() const; @@ -589,9 +645,9 @@ template <class T, class Alloc>

The circular_buffer has a capacity of three int. Therefore, the size of the buffer will - not exceed three. The accumulate algorithm - evaluates the sum of the stored elements. The semantics of the circular_buffer can be inferred from - the assertions. + not exceed three. The std::accumulate + algorithm evaluates the sum of the stored elements. The semantics of the circular_buffer can be + inferred from the assertions.

Bounded Buffer Example @@ -997,6 +1053,27 @@ template <class T, class Alloc> value_type)) nothing will be inserted and the size (as well as capacity) remains zero. +
+
+ Note: +
+
+ You can explicitly set the capacity by calling the set_capacity(capacity_type) + method or you can use the other constructor with the capacity specified. +
+
+
+
+ See Also: +
+
+ circular_buffer(capacity_type, + const allocator_type& alloc), set_capacity(capacity_type) +
+

+ bool is_linearized() + const;
+
+ Is the circular_buffer linearized? +
+
+ Returns: +
+
+ true if the internal buffer is linearized into a continuous array (i.e. the + circular_buffer meets a condition &(*this)[0] < &(*this)[1] < ... < + &(*this)[size() - + 1]); false otherwise. +
+
+
+
+ Throws: +
+
+ Nothing. +
+
+
+
+ Exception Safety: +
+
+ No-throw. +
+
+
+
+ Iterator Invalidation: +
+
+ Does not invalidate any iterators. +
+
+
+
+ Complexity: +
+
+ Constant (in the size of the circular_buffer). +
+
+
+
+ See Also: +
+
+ linearize(), + array_one(), + array_two() +
+
+
+ void rotate(const_iterator + new_begin);
+
+ Rotate elements in the circular_buffer. +

+ A more effective implementation of std::rotate. +

+
+
+ Precondition: +
+
+ new_begin is a valid iterator pointing to the circular_buffer except + its end. +
+
+
+
+ Effect: +
+
+ Before calling the method suppose:
+
+ m == std::distance(new_begin, end())
+ n == std::distance(begin(), new_begin)
+ val_0 == *new_begin, val_1 == *(new_begin + 1), ... val_m == *(new_begin + m)
+ val_r1 == *(new_begin - 1), val_r2 == *(new_begin - 2), ... val_rn == *(new_begin - n)
+
+ then after call to the method:
+
+ val_0 == (*this)[0] && val_1 == (*this)[1] && ... && val_m == (*this)[m - + 1] && val_r1 == (*this)[m + n - 1] && val_r2 == (*this)[m + n - 2] && ... + && val_rn == (*this)[m] +
+
+
+
+ Parameter(s): +
+
+
+
+ new_begin +
+
+ The new beginning. +
+
+
+
+
+
+ Throws: +
+
+ Whatever T::T(const T&) throws. +
+
+ Whatever T::operator = (const T&) throws. +
+
+
+
+ Exception Safety: +
+
+ Basic; no-throw if the circular_buffer is full or new_begin points to + begin() or + if the operations in the Throws section do not throw anything. +
+
+
+
+ Iterator Invalidation: +
+
+ If m < n invalidates iterators pointing to the last m elements + (including new_begin, but not iterators equal to end()) else invalidates + iterators pointing to the first n elements; does not invalidate any iterators if the + circular_buffer is full. +
+
+
+
+ Complexity: +
+
+ Linear (in std::min(m, n)); constant if the circular_buffer is full. +
+
+
+
+ See Also: +
+
+ std::rotate