Compare commits

..

1 Commits

Author SHA1 Message Date
Beman Dawes
3136815a88 1.36.0
[SVN r48100]
2008-08-12 12:44:50 +00:00
30 changed files with 459 additions and 1142 deletions

View File

@@ -1,23 +0,0 @@
#----------------------------------------------------------------------------
# This file was automatically generated from the original CMakeLists.txt file
# Add a variable to hold the headers for the library
set (lib_headers
circular_buffer.hpp
circular_buffer_fwd.hpp
circular_buffer
)
# Add a library target to the build system
boost_library_project(
circular_buffer
# SRCDIRS
TESTDIRS test
HEADERS ${lib_headers}
# DOCDIRS
DESCRIPTION "STL compliant container also known as ring or cyclic buffer."
MODULARIZED
AUTHORS "Jan Gaspar <jano_gaspar -at- yahoo.com>"
# MAINTAINERS
)

View File

@@ -1,6 +1,6 @@
# Doxygen configuration file.
#
# Copyright (c) 2003-2008 Jan Gaspar
# Copyright (c) 2003-2007 Jan Gaspar
#
# Distributed under the Boost Software License, Version 1.0. (See
# accompanying file LICENSE_1_0.txt or copy at

View File

@@ -2,7 +2,7 @@
# HOW-TO documentation about generating/updating source code documentation for #
# the Circular Buffer library. #
# #
# Copyright (c) 2003-2008 Jan Gaspar #
# Copyright (c) 2007 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 #

View File

@@ -1,6 +1,6 @@
# HTML Tidy configuration file.
#
# Copyright (c) 2003-2008 Jan Gaspar
# Copyright (c) 2003-2007 Jan Gaspar
#
# Distributed under the Boost Software License, Version 1.0. (See
# accompanying file LICENSE_1_0.txt or copy at

File diff suppressed because it is too large Load Diff

View File

@@ -3,7 +3,7 @@
XSL transformation from the XML files generated by Doxygen into XHTML source
code documentation of the circular_buffer.
Copyright (c) 2003-2008 Jan Gaspar
Copyright (c) 2007 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

View File

@@ -2,7 +2,7 @@
<!--
Helper XSL transformation making plain copy of an XML tree.
Copyright (c) 2003-2008 Jan Gaspar
Copyright (c) 2007 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

View File

@@ -3,7 +3,7 @@
Generic XSL transformation from the XML files generated by Doxygen into XHTML
source code documentation.
Copyright (c) 2003-2008 Jan Gaspar
Copyright (c) 2007 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

View File

@@ -2,7 +2,7 @@
<!--
Helper XSL transformation which converts HTML into XHTML.
Copyright (c) 2003-2008 Jan Gaspar
Copyright (c) 2007 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

View File

@@ -35,8 +35,7 @@
<a href="#constructors">Constructors and Destructor</a><br>
<a href="#methods">Specific Public Member Functions</a><br>
<a href="#see">See also</a><br>
<a href="#ack">Acknowledgements</a><br>
<a href="#relnotes">Release Notes</a>
<a href="#ack">Acknowledgements</a>
<h2>
<a name="description" id="description">Description</a>
</h2>
@@ -137,24 +136,24 @@ public:
"#classboost_1_1circular__buffer__space__optimized_16839c3ea656ff0f800e38096748fe8ac">~circular_buffer_space_optimized</a>();
allocator_type <a href=
"circular_buffer.html#classboost_1_1circular__buffer_1a20b7d0e7a4da0af13286df9f53d660c">get_allocator</a>() const;
"circular_buffer.html#classboost_1_1circular__buffer_15693ba52e58ef90f1d914cbb63143cd3">get_allocator</a>() const;
allocator_type&amp; <a href=
"circular_buffer.html#classboost_1_1circular__buffer_1af7758a36ac2f84a3024b50b4fc7e098">get_allocator</a>();
iterator <a href=
"circular_buffer.html#classboost_1_1circular__buffer_158d1ede2e85f5d46eda8db3f0c4efef0">begin</a>();
iterator <a href="circular_buffer.html#classboost_1_1circular__buffer_1babfa093dad7801223b80626b598dee1">end</a>();
const_iterator <a href=
"circular_buffer.html#classboost_1_1circular__buffer_10640d3d41c13b6089b6f169224cf1038">begin</a>() const;
"circular_buffer.html#classboost_1_1circular__buffer_1ee6c38b2ecdc8dfec79975dbc685c80b">begin</a>() const;
const_iterator <a href=
"circular_buffer.html#classboost_1_1circular__buffer_17890810d07bc595cfb87f9c47cb075ac">end</a>() const;
"circular_buffer.html#classboost_1_1circular__buffer_19813e1d191cd04c4cfc100bbc4733e92">end</a>() const;
reverse_iterator <a href=
"circular_buffer.html#classboost_1_1circular__buffer_1db3d6b10b6763549f54d2627228fa7aa">rbegin</a>();
reverse_iterator <a href=
"circular_buffer.html#classboost_1_1circular__buffer_1cff9236a50107188b8942847a4dc2697">rend</a>();
const_reverse_iterator <a href=
"circular_buffer.html#classboost_1_1circular__buffer_1765d91bf48341907418433a1e3aab026">rbegin</a>() const;
"circular_buffer.html#classboost_1_1circular__buffer_146a8356a1aec6abca9c44cfc60b3bb10">rbegin</a>() const;
const_reverse_iterator <a href=
"circular_buffer.html#classboost_1_1circular__buffer_108dbf538b00a14daf5582ece80746fc3">rend</a>() const;
"circular_buffer.html#classboost_1_1circular__buffer_1a09f7111dde9f52a4d8babfcdef7e798">rend</a>() const;
reference <a href=
"circular_buffer.html#classboost_1_1circular__buffer_1d219f0d3203fb43b964a8cf63f1865cd">operator[]</a>(size_type index);
const_reference <a href=
@@ -168,34 +167,30 @@ public:
reference <a href=
"circular_buffer.html#classboost_1_1circular__buffer_1d985d974020f88bb4255d8edbae0a30a">back</a>();
const_reference <a href=
"circular_buffer.html#classboost_1_1circular__buffer_10df8595d83bb9d8a7ce50aabc678f90b">front</a>() const;
"circular_buffer.html#classboost_1_1circular__buffer_13261c47e81bb5e447fb0d70f096728b8">front</a>() const;
const_reference <a href=
"circular_buffer.html#classboost_1_1circular__buffer_1027201797868c6274feb6712f670a132">back</a>() const;
"circular_buffer.html#classboost_1_1circular__buffer_14cd3a019a9d99b4e29918b51c2181a07">back</a>() const;
array_range <a href=
"circular_buffer.html#classboost_1_1circular__buffer_1957cccdcb0c4ef7d80a34a990065818d">array_one</a>();
array_range <a href=
"circular_buffer.html#classboost_1_1circular__buffer_1f5081a54afbc2dfc1a7fb20329df7d5b">array_two</a>();
const_array_range <a href=
"circular_buffer.html#classboost_1_1circular__buffer_10f4b157e27b1170a571417986b239945">array_one</a>() const;
"circular_buffer.html#classboost_1_1circular__buffer_1586cfbdef335f1d3d31faacec63f7b04">array_one</a>() const;
const_array_range <a href=
"circular_buffer.html#classboost_1_1circular__buffer_1bb8eb0f298ad2012c55c5303e1f174d5">array_two</a>() const;
"circular_buffer.html#classboost_1_1circular__buffer_191a0e2c33c0e5b4d7b8c497847bc29ce">array_two</a>() const;
pointer <a href=
"circular_buffer.html#classboost_1_1circular__buffer_1ea728bf57f91aa8946eddf76ce816a4e">linearize</a>();
size_type <a href=
"circular_buffer.html#classboost_1_1circular__buffer_1d666f694897465b0d4d7cdd8ddcbc213">size</a>() const;
size_type <a href=
"circular_buffer.html#classboost_1_1circular__buffer_195158ed4d4b03794068e259f85291995">max_size</a>() const;
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);
"circular_buffer.html#classboost_1_1circular__buffer_105acab2b9a0b41044b5241cfc9d87663">empty</a>() const;
bool <a href="#classboost_1_1circular__buffer__space__optimized_15f5e6fb070d2484eaa037cdf4ffd69a8">full</a>() const;
size_type <a href=
"circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size</a>() const;
size_type <a href=
"circular_buffer.html#classboost_1_1circular__buffer_157e2d506bc274b2a63fbe1b8fcafebd7">max_size</a>() const;
bool <a href=
"circular_buffer.html#classboost_1_1circular__buffer_15be1c2a005ec9828549ef6dd7ebed583">empty</a>() const;
bool <a href="#classboost_1_1circular__buffer__space__optimized_142f4a13c50904a4ac0bf746c88451954">full</a>() const;
size_type <a href=
"#classboost_1_1circular__buffer__space__optimized_170eec72a6e8d088b58e26ac7e2dd7c9f">reserve</a>() const;
"#classboost_1_1circular__buffer__space__optimized_100d0c06a38f789ae760709cc86420ae4">reserve</a>() const;
const capacity_type&amp; <a href=
"#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity</a>() const;
"#classboost_1_1circular__buffer__space__optimized_1ea8a89fbae5e03b364ac28e5dc49e353">capacity</a>() const;
void <a href=
"#classboost_1_1circular__buffer__space__optimized_149f28bc5b33d2062b9f6a33b48264e3f">set_capacity</a>(const capacity_type&amp; capacity_ctrl);
void <a href=
@@ -347,7 +342,7 @@ public:
<code>capacity &gt;= min_capacity</code>
</dd>
</dl>The <code><a href=
"#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a></code>
"#classboost_1_1circular__buffer__space__optimized_1ea8a89fbae5e03b364ac28e5dc49e353">capacity()</a></code>
represents the capacity of the <code>circular_buffer_space_optimized</code> and the
<code>min_capacity()</code> determines the minimal allocated size of its internal buffer. The converting
constructor of the <code>capacity_control</code> allows implicit conversion from
@@ -373,19 +368,23 @@ public:
"circular_buffer.html#classboost_1_1circular__buffer_14e07c6ddfe89debe384e59bed06e7cb7">allocator_type</a>&amp;
alloc = allocator_type());</b></code><br>
<br>
Create an empty space optimized circular buffer with zero capacity.
Create an empty space optimized circular buffer with a maximum capacity.
<dl>
<dt>
<b>Effect:</b>
</dt>
<dd>
<code><a href=
"#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a>.capacity()
"#classboost_1_1circular__buffer__space__optimized_1ea8a89fbae5e03b364ac28e5dc49e353">capacity()</a>.capacity()
== <a href=
"circular_buffer.html#classboost_1_1circular__buffer_195158ed4d4b03794068e259f85291995">max_size()</a>
&amp;&amp; <a href=
"#classboost_1_1circular__buffer__space__optimized_1ea8a89fbae5e03b364ac28e5dc49e353">capacity()</a>.min_capacity()
== 0 &amp;&amp; <a href=
"#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a>.min_capacity()
== 0 &amp;&amp; <a href=
"circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> ==
0</code>
"circular_buffer.html#classboost_1_1circular__buffer_1d666f694897465b0d4d7cdd8ddcbc213">size()</a> ==
0</code><br>
<br>
There is no memory allocated in the internal buffer.
</dd>
</dl>
<dl>
@@ -419,15 +418,6 @@ public:
Constant.
</dd>
</dl>
<dl>
<dt>
<b>Warning:</b>
</dt>
<dd>
Since Boost version 1.36 the behaviour of this constructor has changed. Now it creates a space
optimized circular buffer with zero capacity.
</dd>
</dl>
</td>
</tr>
<tr>
@@ -447,9 +437,9 @@ public:
</dt>
<dd>
<code><a href=
"#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a> ==
"#classboost_1_1circular__buffer__space__optimized_1ea8a89fbae5e03b364ac28e5dc49e353">capacity()</a> ==
capacity_ctrl &amp;&amp; <a href=
"circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> ==
"circular_buffer.html#classboost_1_1circular__buffer_1d666f694897465b0d4d7cdd8ddcbc213">size()</a> ==
0</code><br>
<br>
The amount of allocated memory in the internal buffer is <code>capacity_ctrl.min_capacity()</code>.
@@ -518,9 +508,9 @@ public:
</dt>
<dd>
<code><a href=
"#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a> ==
"#classboost_1_1circular__buffer__space__optimized_1ea8a89fbae5e03b364ac28e5dc49e353">capacity()</a> ==
capacity_ctrl &amp;&amp; <a href=
"#classboost_1_1circular__buffer__space__optimized_142f4a13c50904a4ac0bf746c88451954">full()</a>
"#classboost_1_1circular__buffer__space__optimized_15f5e6fb070d2484eaa037cdf4ffd69a8">full()</a>
&amp;&amp; (*this)[0] == item &amp;&amp; (*this)[1] == item &amp;&amp; ... &amp;&amp; (*this)
[capacity_ctrl.capacity() - 1] == item</code><br>
<br>
@@ -613,9 +603,9 @@ public:
</dt>
<dd>
<code><a href=
"#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a> ==
"#classboost_1_1circular__buffer__space__optimized_1ea8a89fbae5e03b364ac28e5dc49e353">capacity()</a> ==
capacity_ctrl &amp;&amp; <a href=
"circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> == n
"circular_buffer.html#classboost_1_1circular__buffer_1d666f694897465b0d4d7cdd8ddcbc213">size()</a> == n
&amp;&amp; (*this)[0] == item &amp;&amp; (*this)[1] == item &amp;&amp; ... &amp;&amp; (*this)[n - 1] ==
item</code><br>
<br>
@@ -775,11 +765,11 @@ public:
</dt>
<dd>
<code><a href=
"#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a>.capacity()
"#classboost_1_1circular__buffer__space__optimized_1ea8a89fbae5e03b364ac28e5dc49e353">capacity()</a>.capacity()
== std::distance(first, last) &amp;&amp; <a href=
"#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a>.min_capacity()
"#classboost_1_1circular__buffer__space__optimized_1ea8a89fbae5e03b364ac28e5dc49e353">capacity()</a>.min_capacity()
== 0 &amp;&amp; <a href=
"#classboost_1_1circular__buffer__space__optimized_142f4a13c50904a4ac0bf746c88451954">full()</a>
"#classboost_1_1circular__buffer__space__optimized_15f5e6fb070d2484eaa037cdf4ffd69a8">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><br>
<br>
@@ -872,9 +862,9 @@ public:
</dt>
<dd>
<code><a href=
"#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a> ==
"#classboost_1_1circular__buffer__space__optimized_1ea8a89fbae5e03b364ac28e5dc49e353">capacity()</a> ==
capacity_ctrl &amp;&amp; <a href=
"circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a>
"circular_buffer.html#classboost_1_1circular__buffer_1d666f694897465b0d4d7cdd8ddcbc213">size()</a>
&lt;= std::distance(first, last) &amp;&amp; (*this)[0]== (last - capacity_ctrl.capacity()) &amp;&amp;
(*this)[1] == *(last - capacity_ctrl.capacity() + 1) &amp;&amp; ... &amp;&amp;
(*this)[capacity_ctrl.capacity() - 1] == *(last - 1)</code><br>
@@ -1018,8 +1008,8 @@ public:
<table id="table_methods" border="1" cellpadding="3">
<tr>
<td>
<a id="classboost_1_1circular__buffer__space__optimized_142f4a13c50904a4ac0bf746c88451954" name=
"classboost_1_1circular__buffer__space__optimized_142f4a13c50904a4ac0bf746c88451954"></a><code><b>bool
<a id="classboost_1_1circular__buffer__space__optimized_15f5e6fb070d2484eaa037cdf4ffd69a8" name=
"classboost_1_1circular__buffer__space__optimized_15f5e6fb070d2484eaa037cdf4ffd69a8"></a><code><b>bool
full() const;</b></code><br>
<br>
Is the <code>circular_buffer_space_optimized</code> full?
@@ -1070,15 +1060,15 @@ public:
</dt>
<dd>
<code><a href=
"circular_buffer.html#classboost_1_1circular__buffer_15be1c2a005ec9828549ef6dd7ebed583">empty()</a></code>
"circular_buffer.html#classboost_1_1circular__buffer_105acab2b9a0b41044b5241cfc9d87663">empty()</a></code>
</dd>
</dl>
</td>
</tr>
<tr>
<td>
<a id="classboost_1_1circular__buffer__space__optimized_170eec72a6e8d088b58e26ac7e2dd7c9f" name=
"classboost_1_1circular__buffer__space__optimized_170eec72a6e8d088b58e26ac7e2dd7c9f"></a><code><b><a href=
<a id="classboost_1_1circular__buffer__space__optimized_100d0c06a38f789ae760709cc86420ae4" name=
"classboost_1_1circular__buffer__space__optimized_100d0c06a38f789ae760709cc86420ae4"></a><code><b><a href=
"circular_buffer.html#classboost_1_1circular__buffer_19ba12c0142a21a7d960877c22fa3ea00">size_type</a>
reserve() const;</b></code><br>
<br>
@@ -1090,9 +1080,9 @@ public:
</dt>
<dd>
<code><a href=
"#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a>.capacity()
"#classboost_1_1circular__buffer__space__optimized_1ea8a89fbae5e03b364ac28e5dc49e353">capacity()</a>.capacity()
- <a href=
"circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a></code>
"circular_buffer.html#classboost_1_1circular__buffer_1d666f694897465b0d4d7cdd8ddcbc213">size()</a></code>
</dd>
</dl>
<dl>
@@ -1133,19 +1123,19 @@ public:
</dt>
<dd>
<code><a href=
"#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a></code>,
"#classboost_1_1circular__buffer__space__optimized_1ea8a89fbae5e03b364ac28e5dc49e353">capacity()</a></code>,
<code><a href=
"circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a></code>,
"circular_buffer.html#classboost_1_1circular__buffer_1d666f694897465b0d4d7cdd8ddcbc213">size()</a></code>,
<code><a href=
"circular_buffer.html#classboost_1_1circular__buffer_157e2d506bc274b2a63fbe1b8fcafebd7">max_size()</a></code>
"circular_buffer.html#classboost_1_1circular__buffer_195158ed4d4b03794068e259f85291995">max_size()</a></code>
</dd>
</dl>
</td>
</tr>
<tr>
<td>
<a id="classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa" name=
"classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa"></a><code><b>const
<a id="classboost_1_1circular__buffer__space__optimized_1ea8a89fbae5e03b364ac28e5dc49e353" name=
"classboost_1_1circular__buffer__space__optimized_1ea8a89fbae5e03b364ac28e5dc49e353"></a><code><b>const
<a href=
"#classboost_1_1circular__buffer__space__optimized_1051350e031c50c8b4a7ca1e1902e92f0">capacity_type</a>&amp;
capacity() const;</b></code><br>
@@ -1198,11 +1188,11 @@ public:
</dt>
<dd>
<code><a href=
"#classboost_1_1circular__buffer__space__optimized_170eec72a6e8d088b58e26ac7e2dd7c9f">reserve()</a></code>,
"#classboost_1_1circular__buffer__space__optimized_100d0c06a38f789ae760709cc86420ae4">reserve()</a></code>,
<code><a href=
"circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a></code>,
"circular_buffer.html#classboost_1_1circular__buffer_1d666f694897465b0d4d7cdd8ddcbc213">size()</a></code>,
<code><a href=
"circular_buffer.html#classboost_1_1circular__buffer_157e2d506bc274b2a63fbe1b8fcafebd7">max_size()</a></code>,
"circular_buffer.html#classboost_1_1circular__buffer_195158ed4d4b03794068e259f85291995">max_size()</a></code>,
<code><a href=
"#classboost_1_1circular__buffer__space__optimized_149f28bc5b33d2062b9f6a33b48264e3f">set_capacity(const
capacity_type&amp;)</a></code>
@@ -1226,14 +1216,14 @@ public:
</dt>
<dd>
<code><a href=
"#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a> ==
"#classboost_1_1circular__buffer__space__optimized_1ea8a89fbae5e03b364ac28e5dc49e353">capacity()</a> ==
capacity_ctrl &amp;&amp; <a href=
"circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a>
"circular_buffer.html#classboost_1_1circular__buffer_1d666f694897465b0d4d7cdd8ddcbc213">size()</a>
&lt;= capacity_ctrl.capacity()</code><br>
<br>
If the current number of elements stored in the <code>circular_buffer_space_optimized</code> is greater
than the desired new capacity then number of <code>[<a href=
"circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> -
"circular_buffer.html#classboost_1_1circular__buffer_1d666f694897465b0d4d7cdd8ddcbc213">size()</a> -
capacity_ctrl.capacity()]</code> <b>last</b> elements will be removed and the new size will be equal to
<code>capacity_ctrl.capacity()</code>.<br>
<br>
@@ -1293,7 +1283,7 @@ public:
</dt>
<dd>
Linear (in <code>min[<a href=
"circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a>,
"circular_buffer.html#classboost_1_1circular__buffer_1d666f694897465b0d4d7cdd8ddcbc213">size()</a>,
capacity_ctrl.capacity()]</code>).
</dd>
</dl>
@@ -1347,9 +1337,9 @@ public:
</dt>
<dd>
<code><a href=
"circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> ==
"circular_buffer.html#classboost_1_1circular__buffer_1d666f694897465b0d4d7cdd8ddcbc213">size()</a> ==
new_size &amp;&amp; <a href=
"#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a>.capacity()
"#classboost_1_1circular__buffer__space__optimized_1ea8a89fbae5e03b364ac28e5dc49e353">capacity()</a>.capacity()
&gt;= new_size</code><br>
<br>
If the new size is greater than the current size, copies of <code>item</code> will be inserted at the
@@ -1359,7 +1349,7 @@ public:
<br>
If the current number of elements stored in the <code>circular_buffer_space_optimized</code> is greater
than the desired new size then number of <code>[<a href=
"circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> -
"circular_buffer.html#classboost_1_1circular__buffer_1d666f694897465b0d4d7cdd8ddcbc213">size()</a> -
new_size]</code> <b>last</b> elements will be removed. (The capacity will remain unchanged.)<br>
<br>
The amount of allocated memory in the internal buffer may be accommodated as necessary.
@@ -1459,14 +1449,14 @@ public:
</dt>
<dd>
<code><a href=
"#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a> ==
"#classboost_1_1circular__buffer__space__optimized_1ea8a89fbae5e03b364ac28e5dc49e353">capacity()</a> ==
capacity_ctrl &amp;&amp; <a href=
"circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a>
"circular_buffer.html#classboost_1_1circular__buffer_1d666f694897465b0d4d7cdd8ddcbc213">size()</a>
&lt;= capacity_ctrl</code><br>
<br>
If the current number of elements stored in the <code>circular_buffer_space_optimized</code> is greater
than the desired new capacity then number of <code>[<a href=
"circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> -
"circular_buffer.html#classboost_1_1circular__buffer_1d666f694897465b0d4d7cdd8ddcbc213">size()</a> -
capacity_ctrl.capacity()]</code> <b>first</b> elements will be removed and the new size will be equal
to <code>capacity_ctrl.capacity()</code>.<br>
<br>
@@ -1526,7 +1516,7 @@ public:
</dt>
<dd>
Linear (in <code>min[<a href=
"circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a>,
"circular_buffer.html#classboost_1_1circular__buffer_1d666f694897465b0d4d7cdd8ddcbc213">size()</a>,
capacity_ctrl.capacity()]</code>).
</dd>
</dl>
@@ -1561,9 +1551,9 @@ public:
</dt>
<dd>
<code><a href=
"circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> ==
"circular_buffer.html#classboost_1_1circular__buffer_1d666f694897465b0d4d7cdd8ddcbc213">size()</a> ==
new_size &amp;&amp; <a href=
"#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a>.capacity()
"#classboost_1_1circular__buffer__space__optimized_1ea8a89fbae5e03b364ac28e5dc49e353">capacity()</a>.capacity()
&gt;= new_size</code><br>
<br>
If the new size is greater than the current size, copies of <code>item</code> will be inserted at the
@@ -1573,7 +1563,7 @@ public:
<br>
If the current number of elements stored in the <code>circular_buffer_space_optimized</code> is greater
than the desired new size then number of <code>[<a href=
"circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> -
"circular_buffer.html#classboost_1_1circular__buffer_1d666f694897465b0d4d7cdd8ddcbc213">size()</a> -
new_size]</code> <b>first</b> elements will be removed. (The capacity will remain unchanged.)<br>
<br>
The amount of allocated memory in the internal buffer may be accommodated as necessary.
@@ -1770,11 +1760,11 @@ public:
</dt>
<dd>
<code><a href=
"#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a>.capacity()
"#classboost_1_1circular__buffer__space__optimized_1ea8a89fbae5e03b364ac28e5dc49e353">capacity()</a>.capacity()
== n &amp;&amp; <a href=
"#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a>.min_capacity()
"#classboost_1_1circular__buffer__space__optimized_1ea8a89fbae5e03b364ac28e5dc49e353">capacity()</a>.min_capacity()
== 0 &amp;&amp; <a href=
"circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> == n
"circular_buffer.html#classboost_1_1circular__buffer_1d666f694897465b0d4d7cdd8ddcbc213">size()</a> == n
&amp;&amp; (*this)[0] == item &amp;&amp; (*this)[1] == item &amp;&amp; ... &amp;&amp; (*this) [n - 1]
== item</code><br>
<br>
@@ -1849,7 +1839,9 @@ public:
<b>See Also:</b>
</dt>
<dd>
<code>operator=</code>, <code><a href=
<code><a href=
"#classboost_1_1circular__buffer__space__optimized_177e35432c5e69b7a16ef7d937950e7a8">operator=</a></code>,
<code><a href=
"#classboost_1_1circular__buffer__space__optimized_1108055ae3f6b1635e1428b0455902cbf">assign(capacity_type,
size_type, const_reference)</a></code>, <code><a href=
"#classboost_1_1circular__buffer__space__optimized_1417de2c2419c44d83a92c463762df5fb">assign(InputIterator,
@@ -1892,9 +1884,9 @@ public:
</dt>
<dd>
<code><a href=
"#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a> ==
"#classboost_1_1circular__buffer__space__optimized_1ea8a89fbae5e03b364ac28e5dc49e353">capacity()</a> ==
capacity_ctrl &amp;&amp; <a href=
"circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> == n
"circular_buffer.html#classboost_1_1circular__buffer_1d666f694897465b0d4d7cdd8ddcbc213">size()</a> == n
&amp;&amp; (*this)[0] == item &amp;&amp; (*this)[1] == item &amp;&amp; ... &amp;&amp; (*this) [n - 1]
== item</code><br>
<br>
@@ -1979,7 +1971,9 @@ public:
<b>See Also:</b>
</dt>
<dd>
<code>operator=</code>, <code><a href=
<code><a href=
"#classboost_1_1circular__buffer__space__optimized_177e35432c5e69b7a16ef7d937950e7a8">operator=</a></code>,
<code><a href=
"#classboost_1_1circular__buffer__space__optimized_17ca4fda9526d0dad99706763c3b2d9f1">assign(size_type,
const_reference)</a></code>, <code><a href=
"#classboost_1_1circular__buffer__space__optimized_1417de2c2419c44d83a92c463762df5fb">assign(InputIterator,
@@ -2018,11 +2012,11 @@ public:
</dt>
<dd>
<code><a href=
"#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a>.capacity()
"#classboost_1_1circular__buffer__space__optimized_1ea8a89fbae5e03b364ac28e5dc49e353">capacity()</a>.capacity()
== std::distance(first, last) &amp;&amp; <a href=
"#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a>.min_capacity()
"#classboost_1_1circular__buffer__space__optimized_1ea8a89fbae5e03b364ac28e5dc49e353">capacity()</a>.min_capacity()
== 0 &amp;&amp; <a href=
"circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> ==
"circular_buffer.html#classboost_1_1circular__buffer_1d666f694897465b0d4d7cdd8ddcbc213">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><br>
<br>
@@ -2097,7 +2091,9 @@ public:
<b>See Also:</b>
</dt>
<dd>
<code>operator=</code>, <code><a href=
<code><a href=
"#classboost_1_1circular__buffer__space__optimized_177e35432c5e69b7a16ef7d937950e7a8">operator=</a></code>,
<code><a href=
"#classboost_1_1circular__buffer__space__optimized_17ca4fda9526d0dad99706763c3b2d9f1">assign(size_type,
const_reference)</a></code>, <code><a href=
"#classboost_1_1circular__buffer__space__optimized_1108055ae3f6b1635e1428b0455902cbf">assign(capacity_type,
@@ -2139,9 +2135,9 @@ public:
</dt>
<dd>
<code><a href=
"#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a> ==
"#classboost_1_1circular__buffer__space__optimized_1ea8a89fbae5e03b364ac28e5dc49e353">capacity()</a> ==
capacity_ctrl &amp;&amp; <a href=
"circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a>
"circular_buffer.html#classboost_1_1circular__buffer_1d666f694897465b0d4d7cdd8ddcbc213">size()</a>
&lt;= std::distance(first, last) &amp;&amp; (*this)[0]== *(last - capacity) &amp;&amp; (*this)[1] ==
*(last - capacity + 1) &amp;&amp; ... &amp;&amp; (*this)[capacity - 1] == *(last - 1)</code><br>
<br>
@@ -2233,7 +2229,9 @@ public:
<b>See Also:</b>
</dt>
<dd>
<code>operator=</code>, <code><a href=
<code><a href=
"#classboost_1_1circular__buffer__space__optimized_177e35432c5e69b7a16ef7d937950e7a8">operator=</a></code>,
<code><a href=
"#classboost_1_1circular__buffer__space__optimized_17ca4fda9526d0dad99706763c3b2d9f1">assign(size_type,
const_reference)</a></code>, <code><a href=
"#classboost_1_1circular__buffer__space__optimized_1108055ae3f6b1635e1428b0455902cbf">assign(capacity_type,
@@ -2338,7 +2336,7 @@ public:
</dt>
<dd>
if <code><a href=
"#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a>.capacity()
"#classboost_1_1circular__buffer__space__optimized_1ea8a89fbae5e03b364ac28e5dc49e353">capacity()</a>.capacity()
&gt; 0</code> then <code><a href=
"circular_buffer.html#classboost_1_1circular__buffer_1d985d974020f88bb4255d8edbae0a30a">back()</a> ==
item</code><br>
@@ -2431,7 +2429,7 @@ public:
</dt>
<dd>
if <code><a href=
"#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a>.capacity()
"#classboost_1_1circular__buffer__space__optimized_1ea8a89fbae5e03b364ac28e5dc49e353">capacity()</a>.capacity()
&gt; 0</code> then <code><a href=
"circular_buffer.html#classboost_1_1circular__buffer_10d5fdeabeb352f47d1f7bb1ea8d9819f">front()</a> ==
item</code><br>
@@ -2822,12 +2820,12 @@ public:
The number of <code>min[n, (pos - <a href=
"circular_buffer.html#classboost_1_1circular__buffer_158d1ede2e85f5d46eda8db3f0c4efef0">begin()</a>) +
<a href=
"#classboost_1_1circular__buffer__space__optimized_170eec72a6e8d088b58e26ac7e2dd7c9f">reserve()</a>]</code>
"#classboost_1_1circular__buffer__space__optimized_100d0c06a38f789ae760709cc86420ae4">reserve()</a>]</code>
elements will be inserted at the position <code>pos</code>.<br>
The number of <code>min[pos - <a href=
"circular_buffer.html#classboost_1_1circular__buffer_158d1ede2e85f5d46eda8db3f0c4efef0">begin()</a>,
max[0, n - <a href=
"#classboost_1_1circular__buffer__space__optimized_170eec72a6e8d088b58e26ac7e2dd7c9f">reserve()</a>]]</code>
"#classboost_1_1circular__buffer__space__optimized_100d0c06a38f789ae760709cc86420ae4">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>
@@ -2908,9 +2906,9 @@ public:
</dt>
<dd>
Linear (in <code>min[<a href=
"#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a>.capacity(),
"#classboost_1_1circular__buffer__space__optimized_1ea8a89fbae5e03b364ac28e5dc49e353">capacity()</a>.capacity(),
<a href=
"circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> +
"circular_buffer.html#classboost_1_1circular__buffer_1d666f694897465b0d4d7cdd8ddcbc213">size()</a> +
n]</code>).
</dd>
</dl>
@@ -2988,12 +2986,12 @@ public:
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>],
"#classboost_1_1circular__buffer__space__optimized_100d0c06a38f789ae760709cc86420ae4">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>
"#classboost_1_1circular__buffer__space__optimized_100d0c06a38f789ae760709cc86420ae4">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>
@@ -3074,11 +3072,11 @@ public:
</dt>
<dd>
Linear (in <code>[<a href=
"circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> +
"circular_buffer.html#classboost_1_1circular__buffer_1d666f694897465b0d4d7cdd8ddcbc213">size()</a> +
std::distance(first, last)]</code>; in <code>min[<a href=
"#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a>.capacity(),
"#classboost_1_1circular__buffer__space__optimized_1ea8a89fbae5e03b364ac28e5dc49e353">capacity()</a>.capacity(),
<a href=
"circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> +
"circular_buffer.html#classboost_1_1circular__buffer_1d666f694897465b0d4d7cdd8ddcbc213">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>
@@ -3293,12 +3291,12 @@ public:
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>
"#classboost_1_1circular__buffer__space__optimized_100d0c06a38f789ae760709cc86420ae4">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>
"#classboost_1_1circular__buffer__space__optimized_100d0c06a38f789ae760709cc86420ae4">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>
@@ -3379,9 +3377,9 @@ public:
</dt>
<dd>
Linear (in <code>min[<a href=
"#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a>.capacity(),
"#classboost_1_1circular__buffer__space__optimized_1ea8a89fbae5e03b364ac28e5dc49e353">capacity()</a>.capacity(),
<a href=
"circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> +
"circular_buffer.html#classboost_1_1circular__buffer_1d666f694897465b0d4d7cdd8ddcbc213">size()</a> +
n]</code>).
</dd>
</dl>
@@ -3459,12 +3457,12 @@ public:
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>
"#classboost_1_1circular__buffer__space__optimized_100d0c06a38f789ae760709cc86420ae4">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>
"#classboost_1_1circular__buffer__space__optimized_100d0c06a38f789ae760709cc86420ae4">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>
@@ -3546,11 +3544,11 @@ public:
</dt>
<dd>
Linear (in <code>[<a href=
"circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> +
"circular_buffer.html#classboost_1_1circular__buffer_1d666f694897465b0d4d7cdd8ddcbc213">size()</a> +
std::distance(first, last)]</code>; in <code>min[<a href=
"#classboost_1_1circular__buffer__space__optimized_1aa2695c84ac9fc912e28d1a5920dadfa">capacity()</a>.capacity(),
"#classboost_1_1circular__buffer__space__optimized_1ea8a89fbae5e03b364ac28e5dc49e353">capacity()</a>.capacity(),
<a href=
"circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> +
"circular_buffer.html#classboost_1_1circular__buffer_1d666f694897465b0d4d7cdd8ddcbc213">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>
@@ -4100,7 +4098,7 @@ public:
</dt>
<dd>
<code><a href=
"circular_buffer.html#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size()</a> ==
"circular_buffer.html#classboost_1_1circular__buffer_1d666f694897465b0d4d7cdd8ddcbc213">size()</a> ==
0</code><br>
<br>
The amount of allocated memory in the internal buffer may be predictively decreased.
@@ -4176,53 +4174,25 @@ public:
<p>
The idea of the space optimized circular buffer has been introduced by Pavel Vozenilek.
</p>
<h2>
<a name="relnotes" id="relnotes">Release Notes</a>
</h2>
<dl>
<dd>
<h3>
Boost 1.37
</h3>
</dd>
<dd>
<ul>
<li>Added new methods <code>is_linearized()</code> and <code>rotate(const_iterator)</code>.
</li>
</ul>
</dd>
<dd>
<h3>
Boost 1.36
</h3>
</dd>
<dd>
<ul>
<li>Changed behaviour of the <code>circular_buffer_space_optimized(const allocator_type&amp;)</code>
constructor. Since this version the constructor sets the capacity to zero.
</li>
</ul>
</dd>
<dd>
<h3>
Boost 1.35
</h3>
</dd>
<dd>
<ul>
<li>Initial release.
</li>
</ul>
</dd>
</dl>
<hr size="1">
<p>
<small>Copyright © 2003-2008 Jan Gaspar</small>
</p>
<p>
<small>Use, modification, and distribution is subject to the Boost Software License, Version 1.0.<br>
(See accompanying file <code>LICENSE_1_0.txt</code> or copy at <a href=
"http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</a>)</small>
</p>
<table id="footer" border="0" width="100%">
<tr>
<td align="left" valign="top">
<p>
<small>Copyright © 2003-2007 Jan Gaspar</small>
</p>
<p>
<small>Use, modification, and distribution is subject to the Boost Software License, Version 1.0.<br>
(See accompanying file <code>LICENSE_1_0.txt</code> or copy at <a href=
"http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</a>)</small>
</p>
</td>
<td align="right" valign="top">
<a href="http://validator.w3.org/check?uri=referer"><img border="0" src=
"http://www.w3.org/Icons/valid-html401" alt="This is a Valid HTML 4.01 Transitional Document." height="31"
width="88"></a>
</td>
</tr>
</table>
</body>
</html>

View File

@@ -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) 2003-2008 Jan Gaspar
Copyright (c) 2007 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

View File

@@ -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) 2003-2008 Jan Gaspar #
# Copyright (c) 2007 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 #

View File

@@ -3,7 +3,7 @@
Helper XSL transformation updating source code documentation sections
in the specified HTML file.
Copyright (c) 2003-2008 Jan Gaspar
Copyright (c) 2007 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

BIN
doc/valid-html40.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -1,6 +1,6 @@
// Circular buffer library header file.
// Copyright (c) 2003-2008 Jan Gaspar
// Copyright (c) 2003-2007 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 <boost/circular_buffer_fwd.hpp>
#include "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 <boost/circular_buffer/debug.hpp>
#include <boost/circular_buffer/details.hpp>
#include <boost/circular_buffer/base.hpp>
#include <boost/circular_buffer/space_optimized.hpp>
#include "circular_buffer/debug.hpp"
#include "circular_buffer/details.hpp"
#include "circular_buffer/base.hpp"
#include "circular_buffer/space_optimized.hpp"
#undef BOOST_CB_ASSERT_TEMPLATED_ITERATOR_CONSTRUCTORS
#undef BOOST_CB_IS_CONVERTIBLE

View File

@@ -1,6 +1,6 @@
// Implementation of the base circular buffer.
// Copyright (c) 2003-2008 Jan Gaspar
// Copyright (c) 2003-2007 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 @@ public:
\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; <code>is_linearized()</code>, <code>rotate(const_iterator)</code>
C API.
*/
pointer linearize() {
if (empty())
@@ -667,73 +667,6 @@ public:
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><a href="http://www.sgi.com/tech/stl/rotate.html">std::rotate</a></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><a href="http://www.sgi.com/tech/stl/rotate.html">std::rotate</a></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>.
@@ -988,10 +921,6 @@ public:
<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) {}
@@ -1008,8 +937,7 @@ public:
*/
explicit circular_buffer(capacity_type capacity, const allocator_type& alloc = allocator_type())
: m_size(0), m_alloc(alloc) {
initialize_buffer(capacity);
m_first = m_last = m_buff;
initialize(capacity);
}
/*! \brief Create a full <code>circular_buffer</code> with the specified capacity and filled with <code>n</code>
@@ -1027,8 +955,7 @@ public:
*/
circular_buffer(size_type n, param_value_type item, const allocator_type& alloc = allocator_type())
: m_size(n), m_alloc(alloc) {
initialize_buffer(n, item);
m_first = m_last = m_buff;
initialize(n, item);
}
/*! \brief Create a <code>circular_buffer</code> with the specified capacity and filled with <code>n</code>
@@ -1050,9 +977,7 @@ public:
const allocator_type& alloc = allocator_type())
: m_size(n), m_alloc(alloc) {
BOOST_CB_ASSERT(capacity >= size()); // check for capacity lower than size
initialize_buffer(capacity, item);
m_first = m_buff;
m_last = capacity == n ? m_buff : m_buff + n;
initialize(capacity, item);
}
//! The copy constructor.
@@ -1068,17 +993,14 @@ public:
*/
circular_buffer(const circular_buffer<T, Alloc>& cb)
: m_size(cb.size()), m_alloc(cb.get_allocator()) {
initialize_buffer(cb.capacity());
m_first = m_buff;
m_first = m_last = m_buff = allocate(cb.capacity());
BOOST_TRY {
m_last = cb_details::uninitialized_copy_with_alloc(cb.begin(), cb.end(), m_buff, m_alloc);
m_end = cb_details::uninitialized_copy_with_alloc(cb.begin(), cb.end(), m_buff, m_alloc);
} BOOST_CATCH(...) {
deallocate(m_buff, cb.capacity());
BOOST_RETHROW
}
BOOST_CATCH_END
if (m_last == m_end)
m_last = m_buff;
}
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
@@ -1376,7 +1298,6 @@ public:
<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
@@ -1407,7 +1328,6 @@ public:
<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
@@ -2078,15 +1998,15 @@ private:
#endif
}
//! Initialize the internal buffer.
void initialize_buffer(capacity_type capacity) {
m_buff = allocate(capacity);
//! Initialize the circular buffer.
void initialize(capacity_type capacity) {
m_first = m_last = m_buff = allocate(capacity);
m_end = m_buff + capacity;
}
//! Initialize the internal buffer.
void initialize_buffer(capacity_type capacity, param_value_type item) {
initialize_buffer(capacity);
//! Initialize the circular buffer.
void initialize(capacity_type capacity, param_value_type item) {
initialize(capacity);
BOOST_TRY {
cb_details::uninitialized_fill_n_with_alloc(m_buff, size(), item, m_alloc);
} BOOST_CATCH(...) {
@@ -2100,8 +2020,7 @@ private:
template <class IntegralType>
void initialize(IntegralType n, IntegralType item, const true_type&) {
m_size = static_cast<size_type>(n);
initialize_buffer(size(), item);
m_first = m_last = m_buff;
initialize(size(), item);
}
//! Specialized initialize method.
@@ -2138,9 +2057,7 @@ private:
void initialize(capacity_type capacity, IntegralType n, IntegralType item, const true_type&) {
BOOST_CB_ASSERT(capacity >= static_cast<size_type>(n)); // check for capacity lower than n
m_size = static_cast<size_type>(n);
initialize_buffer(capacity, item);
m_first = m_buff;
m_last = capacity == size() ? m_buff : m_buff + size();
initialize(capacity, item);
}
//! Specialized initialize method.
@@ -2160,8 +2077,7 @@ private:
InputIterator first,
InputIterator last,
const std::input_iterator_tag&) {
initialize_buffer(capacity);
m_first = m_last = m_buff;
initialize(capacity);
m_size = 0;
if (capacity == 0)
return;
@@ -2187,29 +2103,28 @@ private:
initialize(capacity, first, last, std::distance(first, last));
}
//! Initialize the circular buffer.
//! Helper initialize method.
template <class ForwardIterator>
void initialize(capacity_type capacity,
ForwardIterator first,
ForwardIterator last,
size_type distance) {
initialize_buffer(capacity);
m_first = m_buff;
initialize(capacity);
if (distance > capacity) {
std::advance(first, distance - capacity);
m_size = capacity;
} else {
m_size = distance;
if (distance != capacity)
m_last = m_buff + size();
}
BOOST_TRY {
m_last = cb_details::uninitialized_copy_with_alloc(first, last, m_buff, m_alloc);
cb_details::uninitialized_copy_with_alloc(first, last, m_buff, m_alloc);
} BOOST_CATCH(...) {
deallocate(m_buff, capacity);
BOOST_RETHROW
}
BOOST_CATCH_END
if (m_last == m_end)
m_last = m_buff;
}
//! Reset the circular buffer.

View File

@@ -1,6 +1,6 @@
// Debug support for the circular buffer library.
// Copyright (c) 2003-2008 Jan Gaspar
// Copyright (c) 2003-2007 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

View File

@@ -1,6 +1,6 @@
// Helper classes and functions for the circular buffer.
// Copyright (c) 2003-2008 Jan Gaspar
// Copyright (c) 2003-2007 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
@@ -66,6 +66,16 @@ struct nonconst_traits {
typedef nonconst_traits<Traits> nonconst_self;
};
/*!
\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.
@@ -131,7 +141,7 @@ private:
};
/*!
\class capacity_control
\struct capacity_control
\brief Capacity controller of the space optimized circular buffer.
*/
template <class Size>
@@ -166,7 +176,7 @@ public:
};
/*!
\struct iterator
\class iterator
\brief Random access iterator for the circular buffer.
\param Buff The type of the underlying circular buffer.
\param Traits Basic iterator types.
@@ -174,7 +184,7 @@ public:
for iterating from begin() to end() of the circular buffer.
*/
template <class Buff, class Traits>
struct iterator :
class iterator :
public boost::iterator<
std::random_access_iterator_tag,
typename Traits::value_type,
@@ -185,6 +195,7 @@ struct iterator :
, public debug_iterator_base
#endif // #if BOOST_CB_ENABLE_DEBUG
{
private:
// Helper types
//! Base iterator.
@@ -198,6 +209,7 @@ struct iterator :
//! Non-const iterator.
typedef iterator<Buff, typename Traits::nonconst_self> nonconst_self;
public:
// Basic types
//! The type of the elements stored in the circular buffer.
@@ -215,6 +227,7 @@ struct iterator :
//! Difference type.
typedef typename base_iterator::difference_type difference_type;
public:
// Member variables
//! The circular buffer where the iterator points to.
@@ -223,6 +236,7 @@ struct iterator :
//! An internal iterator.
pointer m_it;
public:
// Construction & assignment
// Default copy constructor.
@@ -274,11 +288,16 @@ struct iterator :
pointer operator -> () const { return &(operator*()); }
//! Difference operator.
template <class Traits0>
difference_type operator - (const iterator<Buff, Traits0>& it) const {
difference_type operator - (const iterator& 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 linearize_pointer(*this) - linearize_pointer(it);
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;
}
//! Increment operator (prefix).
@@ -336,7 +355,7 @@ struct iterator :
iterator& operator -= (difference_type n) {
BOOST_CB_ASSERT(is_valid(m_buff)); // check for uninitialized or invalidated iterator
if (n > 0) {
BOOST_CB_ASSERT(*this - m_buff->begin() >= n); // check for too large n
BOOST_CB_ASSERT(m_buff->begin() - *this <= -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;
@@ -373,12 +392,12 @@ struct iterator :
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 linearize_pointer(*this) < linearize_pointer(it);
return less(create_helper_pointer(*this), create_helper_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>
@@ -388,14 +407,44 @@ struct iterator :
template <class Traits0>
bool operator >= (const iterator<Buff, Traits0>& it) const { return !(*this < it); }
private:
// Helpers
//! Get a pointer which would point to the same element as the iterator in case the circular buffer is linearized.
//! Create helper pointer.
template <class Traits0>
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));
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;
}
};

View File

@@ -1,6 +1,6 @@
// Implementation of the circular buffer adaptor.
// Copyright (c) 2003-2008 Jan Gaspar
// Copyright (c) 2003-2007 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,8 +90,6 @@ public:
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;
@@ -314,19 +312,18 @@ public:
}
}
//! Create an empty space optimized circular buffer with zero capacity.
//! Create an empty space optimized circular buffer with a maximum capacity.
/*!
\post <code>capacity().%capacity() == 0 \&\& capacity().min_capacity() == 0 \&\& size() == 0</code>
\post <code>capacity().%capacity() == max_size() \&\& capacity().min_capacity() == 0 \&\& size() == 0</code>
<br><br>There is no memory allocated in the internal buffer.
\param alloc The allocator.
\throws Nothing.
\par Complexity
Constant.
\warning Since Boost version 1.36 the behaviour of this constructor has changed. Now it creates a space
optimized circular buffer with zero capacity.
*/
explicit circular_buffer_space_optimized(const allocator_type& alloc = allocator_type())
: circular_buffer<T, Alloc>(0, alloc)
, m_capacity_ctrl(0) {}
, m_capacity_ctrl(max_size()) {}
//! Create an empty space optimized circular buffer with the specified capacity.
/*!

View File

@@ -1,6 +1,6 @@
// Forward declaration of the circular buffer and its adaptor.
// Copyright (c) 2003-2008 Jan Gaspar
// Copyright (c) 2003-2007 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

View File

@@ -11,7 +11,7 @@
<body>
Automatic redirection failed, please go to <a href="doc/circular_buffer.html">circular_buffer.html</a>.
<p>
<small>Copyright © 2003-2008 Jan Gaspar</small>
<small>Copyright © 2003-2007 Jan Gaspar</small>
</p>
<p>
<small>Use, modification, and distribution is subject to the Boost Software License, Version 1.0.<br>

View File

@@ -1 +0,0 @@
boost_module (circular_buffer DEPENDS config)

View File

@@ -1,7 +0,0 @@
boost_additional_test_dependencies(circular_buffer BOOST_DEPENDS test )
boost_test_run(base_test SINGLE_THREADED)
boost_test_run(space_optimized_test SINGLE_THREADED)
boost_test_run(soft_iterator_invalidation SINGLE_THREADED)
boost_test_compile(bounded_buffer_comparison)

View File

@@ -1,26 +1,14 @@
# Boost circular_buffer test Jamfile.
#
# Copyright (c) 2003-2008 Jan Gaspar
# Copyright (c) 2003-2007 Jan Gaspar
#
# Distributed under the Boost Software License, Version 1.0. (See
# accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
# Added warning supression Paul A. Bristow 25 Nov 2008
# Bring in rules for testing.
import testing ;
project
: requirements
<toolset>msvc:<warnings>all
<toolset>msvc:<asynch-exceptions>on
<toolset>msvc:<define>_SCL_SECURE_NO_WARNINGS
<toolset>msvc:<cxxflags>/wd4996 # 'function': was declared deprecated
<toolset>msvc:<cxxflags>/wd4244 # conversion from 'int' to 'unsigned short', possible loss of data
# in date-time
;
test-suite "circular_buffer"
: [ run base_test.cpp : <threading>single : ]
[ run space_optimized_test.cpp : <threading>single : ]

View File

@@ -1,6 +1,6 @@
// Test of the base circular buffer container.
// Copyright (c) 2003-2008 Jan Gaspar
// Copyright (c) 2003-2007 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,7 +61,6 @@ void iterator_difference_test() {
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);
@@ -190,6 +189,7 @@ void iterator_comparison_test() {
BOOST_CHECK(!(end - 1 < it));
}
// TODO add insert, push_back etc.
void iterator_invalidation_test() {
#if !defined(NDEBUG) && !defined(BOOST_CB_DISABLE_DEBUG)
@@ -506,62 +506,6 @@ void iterator_invalidation_test() {
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)
}

View File

@@ -1,6 +1,6 @@
// Comparison of bounded buffers based on different containers.
// Copyright (c) 2003-2008 Jan Gaspar
// Copyright (c) 2003-2007 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

View File

@@ -1,6 +1,6 @@
// Common tests for the circular buffer and its adaptor.
// Copyright (c) 2003-2008 Jan Gaspar
// Copyright (c) 2003-2007 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,16 +328,8 @@ void linearize_test() {
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]
@@ -357,9 +349,7 @@ void linearize_test() {
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]
@@ -378,9 +368,7 @@ void linearize_test() {
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]
@@ -396,9 +384,7 @@ void linearize_test() {
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]
@@ -410,7 +396,6 @@ void linearize_test() {
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]
@@ -419,7 +404,6 @@ void linearize_test() {
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);
@@ -427,7 +411,6 @@ void linearize_test() {
generic_test(cb4);
generic_test(cb5);
generic_test(cb6);
generic_test(cb7);
}
void array_range_test() {
@@ -786,17 +769,6 @@ void rresize_test() {
void constructor_test() {
CB_CONTAINER<MyInteger> cb0;
BOOST_CHECK(cb0.capacity() == 0);
BOOST_CHECK(cb0.size() == 0);
cb0.push_back(1);
cb0.push_back(2);
cb0.push_back(3);
BOOST_CHECK(cb0.size() == 0);
BOOST_CHECK(cb0.capacity() == 0);
CB_CONTAINER<MyInteger> cb1(3);
CB_CONTAINER<MyInteger> cb2(3, 2);
vector<int> v;
@@ -808,7 +780,6 @@ void constructor_test() {
CB_CONTAINER<MyInteger> cb3(v.begin(), v.end());
CB_CONTAINER<MyInteger> cb4(3, v.begin(), v.end());
CB_CONTAINER<MyInteger> cb5(10, v.begin(), v.end());
CB_CONTAINER<MyInteger> cb6(10, 3, MyInteger(2));
BOOST_CHECK(cb1.size() == 0);
BOOST_CHECK(cb1.capacity() == 3);
@@ -832,29 +803,19 @@ void constructor_test() {
BOOST_CHECK(!cb5.full());
BOOST_CHECK(cb5[0] == 1);
BOOST_CHECK(cb5[4] == 5);
BOOST_CHECK(cb6.size() == 3);
BOOST_CHECK(cb6.capacity() == 10);
BOOST_CHECK(!cb6.full());
BOOST_CHECK(cb6[0] == 2);
BOOST_CHECK(cb6[2] == 2);
cb5.push_back(6);
cb6.push_back(6);
BOOST_CHECK(cb5[5] == 6);
BOOST_CHECK(cb5[0] == 1);
BOOST_CHECK(cb5.size() == 6);
BOOST_CHECK(cb6[3] == 6);
BOOST_CHECK(cb6.size() == 4);
BOOST_CHECK(cb6[0] == 2);
#if !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS)
CB_CONTAINER<int> cb7(MyInputIterator(v.begin()), MyInputIterator(v.end()));
CB_CONTAINER<int> cb8(3, MyInputIterator(v.begin()), MyInputIterator(v.end()));
CB_CONTAINER<int> cb6(MyInputIterator(v.begin()), MyInputIterator(v.end()));
CB_CONTAINER<int> cb7(3, MyInputIterator(v.begin()), MyInputIterator(v.end()));
BOOST_CHECK(cb7.capacity() == 5);
BOOST_CHECK(cb8.capacity() == 3);
BOOST_CHECK(cb6.capacity() == 5);
BOOST_CHECK(cb7.capacity() == 3);
#endif // #if !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS)
@@ -863,7 +824,6 @@ void constructor_test() {
generic_test(cb3);
generic_test(cb4);
generic_test(cb5);
generic_test(cb6);
}
void assign_test() {
@@ -934,9 +894,6 @@ void copy_constructor_and_assign_test() {
CB_CONTAINER<MyInteger> cb2 = cb1;
BOOST_CHECK(cb1 == cb2);
BOOST_CHECK(cb2.capacity() == 4);
BOOST_CHECK(cb2[0] == 2);
BOOST_CHECK(cb2[3] == 5);
CB_CONTAINER<MyInteger> cb3(20);
cb1.pop_back();
@@ -944,7 +901,6 @@ void copy_constructor_and_assign_test() {
cb3 = cb2;
cb3 = cb3;
cb4 = cb1;
CB_CONTAINER<MyInteger> cb5 = cb1;
BOOST_CHECK(cb3 == cb2);
BOOST_CHECK(cb4 == cb1);
@@ -955,16 +911,11 @@ void copy_constructor_and_assign_test() {
BOOST_CHECK(cb4.capacity() == 4);
BOOST_CHECK(!cb4.full());
BOOST_CHECK(*(cb4.end() - 1) == 4);
BOOST_CHECK(cb1 == cb5);
BOOST_CHECK(cb5.capacity() == 4);
BOOST_CHECK(cb2[0] == 2);
BOOST_CHECK(cb2[2] == 4);
generic_test(cb1);
generic_test(cb2);
generic_test(cb3);
generic_test(cb4);
generic_test(cb5);
}
void swap_test() {
@@ -1830,122 +1781,6 @@ void const_methods_test() {
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;
@@ -1993,5 +1828,4 @@ void add_common_tests(test_suite* tests) {
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));
}

View File

@@ -3,7 +3,7 @@
// Note: The soft iterator invalidation definition CAN NOT be applied
// to the space optimized circular buffer.
// Copyright (c) 2003-2008 Jan Gaspar
// Copyright (c) 2003-2007 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

View File

@@ -1,6 +1,6 @@
// Test of the space optimized adaptor of the circular buffer.
// Copyright (c) 2003-2008 Jan Gaspar
// Copyright (c) 2003-2007 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
@@ -62,7 +62,7 @@ void capacity_control_test() {
circular_buffer_space_optimized<int>::capacity_type c1 = 10;
circular_buffer_space_optimized<int>::capacity_type c2 =
circular_buffer_space_optimized<int>::capacity_type(20, 5);
circular_buffer_space_optimized<int>::capacity_type(20, 5);
circular_buffer_space_optimized<int>::capacity_type c3 = c2;
BOOST_CHECK(c1.capacity() == 10);
@@ -78,10 +78,10 @@ void capacity_control_test() {
BOOST_CHECK(c1.min_capacity() == 5);
}
void specific_constructors_test() {
void some_constructors_test() {
cb_space_optimized cb1;
BOOST_CHECK(cb1.capacity() == 0);
BOOST_CHECK(cb1.capacity() == cb1.max_size());
BOOST_CHECK(cb1.capacity().min_capacity() == 0);
BOOST_CHECK(cb1.internal_capacity() == 0);
BOOST_CHECK(cb1.size() == 0);
@@ -90,15 +90,10 @@ void specific_constructors_test() {
cb1.push_back(2);
cb1.push_back(3);
BOOST_CHECK(cb1.size() == 0);
BOOST_CHECK(cb1.capacity() == 0);
BOOST_CHECK(cb1.size() == 3);
BOOST_CHECK(cb1.capacity() == cb1.max_size());
vector<int> v;
v.push_back(1);
v.push_back(2);
v.push_back(3);
cb_space_optimized cb2(v.begin(), v.end());
cb_space_optimized cb2(cb1.begin(), cb1.end());
BOOST_CHECK(cb2.capacity() == 3);
BOOST_CHECK(cb2.capacity().min_capacity() == 0);
@@ -188,7 +183,7 @@ test_suite* init_unit_test_suite(int /*argc*/, char* /*argv*/[]) {
tests->add(BOOST_TEST_CASE(&min_capacity_test));
tests->add(BOOST_TEST_CASE(&capacity_control_test));
tests->add(BOOST_TEST_CASE(&specific_constructors_test));
tests->add(BOOST_TEST_CASE(&some_constructors_test));
tests->add(BOOST_TEST_CASE(&shrink_to_fit_test));
tests->add(BOOST_TEST_CASE(&iterator_invalidation_test));

View File

@@ -1,6 +1,6 @@
// Header file for the test of the circular buffer library.
// Copyright (c) 2003-2008 Jan Gaspar
// Copyright (c) 2003-2007 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