diff --git a/doc/circular_buffer.html b/doc/circular_buffer.html index 7cd1eb1..999a2b2 100644 --- a/doc/circular_buffer.html +++ b/doc/circular_buffer.html @@ -1049,7 +1049,7 @@ template <class T, class Alloc> Throws:
- An allocation error if memory is exhausted (std::bad_alloc if the standard + An allocation error if memory is exhausted (std::bad_alloc if the standard allocator is used).
@@ -1067,10 +1067,10 @@ template <class T, class Alloc> Create an empty circular buffer with a given capacity.
- Parameters: + Parameter(s):
- capacity - The maximum number of elements which can be stored in the + capacity The maximum number of elements which can be stored in the circular_buffer.
@@ -1089,7 +1089,7 @@ template <class T, class Alloc> Throws:
- An allocation error if memory is exhausted (std::bad_alloc if the standard + An allocation error if memory is exhausted (std::bad_alloc if the standard allocator is used).
@@ -1120,11 +1120,11 @@ template <class T, class Alloc> Throws:
- An allocation error if memory is exhausted (std::bad_alloc if the standard + An allocation error if memory is exhausted (std::bad_alloc if the standard allocator is used).
- Whatever T::T(const T&) throws. + Whatever T::T(const T&) throws.
@@ -1163,11 +1163,11 @@ template <class T, class Alloc> Throws:
- An allocation error if memory is exhausted (std::bad_alloc if the standard + An allocation error if memory is exhausted (std::bad_alloc if the standard allocator is used).
- Whatever T::T(const T&) throws. + Whatever T::T(const T&) throws.
@@ -1247,11 +1247,11 @@ template <class T, class Alloc> Throws:
- An allocation error if memory is exhausted (std::bad_alloc if the standard + An allocation error if memory is exhausted (std::bad_alloc if the standard allocator is used).
- Whatever T::T(const T&) throws. + Whatever T::T(const T&) throws.
@@ -1294,7 +1294,7 @@ template <class T, class Alloc> Throws:
- Nothing. + Nothing.
@@ -1302,7 +1302,7 @@ template <class T, class Alloc> Complexity:
- Constant. + Constant (in the size of the circular_buffer).
@@ -1327,7 +1327,8 @@ template <class T, class Alloc>
get_allocator() + "#classboost_1_1circular__buffer_1af7758a36ac2f84a3024b50b4fc7e098">get_allocator() for + obtaining an allocator reference.
@@ -1353,7 +1354,7 @@ template <class T, class Alloc> Throws:
- Nothing. + Nothing.
@@ -1361,7 +1362,7 @@ template <class T, class Alloc> Complexity:
- Constant. + Constant (in the size of the circular_buffer).
@@ -1413,8 +1414,8 @@ template <class T, class Alloc>
A random access iterator pointing to the first element of the circular_buffer. If the - circular_buffer is empty it returns an iterator equal to the one returned by end(). + circular_buffer is empty it returns an iterator equal to the one returned by + end() .
@@ -1422,7 +1423,7 @@ template <class T, class Alloc> Throws:
- Nothing. + Nothing.
@@ -1430,7 +1431,7 @@ template <class T, class Alloc> Complexity:
- Constant. + Constant (in the size of the circular_buffer).
@@ -1455,7 +1456,8 @@ template <class T, class Alloc>
end(), - rbegin() + rbegin(), + rend()
@@ -1474,8 +1476,8 @@ template <class T, class Alloc>
A random access iterator pointing to the element "one behind" the last element of the circular_buffer. If the circular_buffer is empty it returns an iterator equal - to the one returned by begin(). + to the one returned by begin().
@@ -1483,7 +1485,7 @@ template <class T, class Alloc> Throws:
- Nothing. + Nothing.
@@ -1491,7 +1493,7 @@ template <class T, class Alloc> Complexity:
- Constant. + Constant (in the size of the circular_buffer).
@@ -1515,7 +1517,9 @@ template <class T, class Alloc> See Also:
- begin() + begin(), + rbegin(), + rend()
@@ -1534,8 +1538,9 @@ template <class T, class Alloc>
A const random access iterator pointing to the first element of the circular_buffer. If - the circular_buffer is empty it returns an iterator equal to the one returned by end() const. + the circular_buffer is empty it returns an iterator equal to the one returned by + end() + const.
@@ -1543,7 +1548,7 @@ template <class T, class Alloc> Throws:
- Nothing. + Nothing.
@@ -1551,7 +1556,7 @@ template <class T, class Alloc> Complexity:
- Constant. + Constant (in the size of the circular_buffer).
@@ -1576,6 +1581,9 @@ template <class T, class Alloc>
end() + const, rbegin() const, + rend() const
@@ -1596,8 +1604,8 @@ template <class T, class Alloc>
A const random access iterator pointing to the element "one behind" the last element of the circular_buffer. If the circular_buffer is empty it returns an iterator equal - to the one returned by begin() const. + to the one returned by begin() const const.
@@ -1605,7 +1613,7 @@ template <class T, class Alloc> Throws:
- Nothing. + Nothing.
@@ -1613,7 +1621,7 @@ template <class T, class Alloc> Complexity:
- Constant. + Constant (in the size of the circular_buffer).
@@ -1638,6 +1646,9 @@ template <class T, class Alloc>
begin() + const, rbegin() const, + rend() const
@@ -1657,8 +1668,8 @@ template <class T, class Alloc>
A reverse random access iterator pointing to the last element of the circular_buffer. If - the circular_buffer is empty it returns an iterator equal to the one returned by rend(). + the circular_buffer is empty it returns an iterator equal to the one returned by + rend().
@@ -1666,7 +1677,7 @@ template <class T, class Alloc> Throws:
- Nothing. + Nothing.
@@ -1674,7 +1685,7 @@ template <class T, class Alloc> Complexity:
- Constant. + Constant (in the size of the circular_buffer).
@@ -1699,7 +1710,8 @@ template <class T, class Alloc>
rend(), - begin() + begin(), + end()
@@ -1719,8 +1731,8 @@ template <class T, class Alloc>
A reverse random access iterator pointing to the element "one before" the first element of the circular_buffer. If the circular_buffer is empty it returns an iterator equal - to the one returned by rbegin(). + to the one returned by rbegin().
@@ -1728,7 +1740,7 @@ template <class T, class Alloc> Throws:
- Nothing. + Nothing.
@@ -1736,7 +1748,7 @@ template <class T, class Alloc> Complexity:
- Constant. + Constant (in the size of the circular_buffer).
@@ -1760,7 +1772,9 @@ template <class T, class Alloc> See Also:
- rbegin() + rbegin(), + begin(), + end()
@@ -1780,7 +1794,8 @@ template <class T, class Alloc>
A const reverse random access iterator pointing to the last element of the circular_buffer . If the circular_buffer is empty it returns an iterator equal to the one returned by - rend() const. + rend() + const.
@@ -1788,7 +1803,7 @@ template <class T, class Alloc> Throws:
- Nothing. + Nothing.
@@ -1796,7 +1811,7 @@ template <class T, class Alloc> Complexity:
- Constant. + Constant (in the size of the circular_buffer).
@@ -1821,6 +1836,9 @@ template <class T, class Alloc>
rend() + const, begin() const, + end() const
@@ -1841,8 +1859,8 @@ template <class T, class Alloc>
A const reverse random access iterator pointing to the element "one before" the first element of the circular_buffer. If the circular_buffer is empty it returns an iterator equal - to the one returned by rbegin() const. + to the one returned by rbegin() const.
@@ -1850,7 +1868,7 @@ template <class T, class Alloc> Throws:
- Nothing. + Nothing.
@@ -1858,7 +1876,7 @@ template <class T, class Alloc> Complexity:
- Constant. + Constant (in the size of the circular_buffer).
@@ -1883,6 +1901,9 @@ template <class T, class Alloc>
rbegin() + const, begin() const, + end() const
@@ -1905,6 +1926,14 @@ template <class T, class Alloc> "#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size() +
+
+ Parameter(s): +
+
+ index The position of the element. +
+
Returns: @@ -1918,7 +1947,7 @@ template <class T, class Alloc> Throws:
- Nothing. + Nothing.
@@ -1926,7 +1955,7 @@ template <class T, class Alloc> Complexity:
- Constant. + Constant (in the size of the circular_buffer).
@@ -1950,8 +1979,7 @@ template <class T, class Alloc> See Also:
- at(size_type) + at()
@@ -1974,6 +2002,14 @@ template <class T, class Alloc> "#classboost_1_1circular__buffer_15fa0edd153e2591dd6bf070eb663ee32">size() +
+
+ Parameter(s): +
+
+ index The position of the element. +
+
Returns: @@ -1987,7 +2023,7 @@ template <class T, class Alloc> Throws:
- Nothing. + Nothing.
@@ -2019,8 +2055,7 @@ template <class T, class Alloc> See Also:
- at(size_type) - const + at() const
@@ -2033,6 +2068,14 @@ template <class T, class Alloc> "#classboost_1_1circular__buffer_19ba12c0142a21a7d960877c22fa3ea00">size_type index);

Get the element at the index position. +
+
+ Parameter(s): +
+
+ index The position of the element. +
+
Returns: @@ -2046,7 +2089,7 @@ template <class T, class Alloc> Throws:
- std::out_of_range when the index is invalid (when index >= std::out_of_range when the index is invalid (when index >= size()).
@@ -2055,7 +2098,7 @@ template <class T, class Alloc> Complexity:
- Constant. + Constant (in the size of the circular_buffer).
@@ -2079,8 +2122,7 @@ template <class T, class Alloc> See Also:
- operator[](size_type) + operator[]
@@ -2094,6 +2136,14 @@ template <class T, class Alloc> const;

Get the element at the index position. +
+
+ Parameter(s): +
+
+ index The position of the element. +
+
Returns: @@ -2107,7 +2157,7 @@ template <class T, class Alloc> Throws:
- std::out_of_range when the index is invalid (when index >= std::out_of_range when the index is invalid (when index >= size()).
@@ -2116,7 +2166,7 @@ template <class T, class Alloc> Complexity:
- Constant. + Constant (in the size of the circular_buffer).
@@ -2140,7 +2190,7 @@ template <class T, class Alloc> See Also:
- operator[](size_type) + operator[] const
@@ -2174,7 +2224,7 @@ template <class T, class Alloc> Throws:
- Nothing. + Nothing.
@@ -2182,7 +2232,7 @@ template <class T, class Alloc> Complexity:
- Constant. + Constant (in the size of the circular_buffer).
@@ -2239,7 +2289,7 @@ template <class T, class Alloc> Throws:
- Nothing. + Nothing.
@@ -2247,7 +2297,7 @@ template <class T, class Alloc> Complexity:
- Constant. + Constant (in the size of the circular_buffer).
@@ -2305,7 +2355,7 @@ template <class T, class Alloc> Throws:
- Nothing. + Nothing.
@@ -2313,7 +2363,7 @@ template <class T, class Alloc> Complexity:
- Constant. + Constant (in the size of the circular_buffer).
@@ -2372,7 +2422,7 @@ template <class T, class Alloc> Throws:
- Nothing. + Nothing.
@@ -2380,7 +2430,7 @@ template <class T, class Alloc> Complexity:
- Constant. + Constant (in the size of the circular_buffer).
@@ -2421,7 +2471,7 @@ template <class T, class Alloc>

This method in combination with array_two() can be useful - when passing the stored data into the legacy C API as an array. Suppose there is a + when passing the stored data into a legacy C API as an array. Suppose there is a circular_buffer of capacity 10, containing 7 characters 'a', 'b', ..., 'g' where cbuff[0] == 'a', cbuff[1] == 'b', ... and cbuff[6] == 'g':
@@ -2480,7 +2530,7 @@ template <class T, class Alloc> Throws:

- Nothing. + Nothing.
@@ -2488,7 +2538,7 @@ template <class T, class Alloc> Complexity:
- Constant. + Constant (in the size of the circular_buffer).
@@ -2542,7 +2592,7 @@ template <class T, class Alloc>

This method in combination with array_one() can be useful - when passing the stored data into the legacy C API as an array. + when passing the stored data into a legacy C API as an array.

@@ -2559,7 +2609,7 @@ template <class T, class Alloc> Throws:
- Nothing. + Nothing.
@@ -2567,7 +2617,7 @@ template <class T, class Alloc> Complexity:
- Constant. + Constant (in the size of the circular_buffer).
@@ -2608,7 +2658,7 @@ template <class T, class Alloc>

This method in combination with array_two() const can be - useful when passing the stored data into the legacy C API as an array. + useful when passing the stored data into a legacy C API as an array.

@@ -2624,7 +2674,7 @@ template <class T, class Alloc> Throws:
- Nothing. + Nothing.
@@ -2632,7 +2682,7 @@ template <class T, class Alloc> Complexity:
- Constant. + Constant (in the size of the circular_buffer).
@@ -2656,9 +2706,10 @@ template <class T, class Alloc> See Also:
- array_two() + const; array_one() for more - details.how to pass data into the legacy C API. + details.how to pass data into a legacy C API.
@@ -2674,7 +2725,7 @@ template <class T, class Alloc>

This method in combination with array_one() const can be - useful when passing the stored data into the legacy C API as an array. + useful when passing the stored data into a legacy C API as an array.

@@ -2691,7 +2742,7 @@ template <class T, class Alloc> Throws:
- Nothing. + Nothing.
@@ -2699,7 +2750,7 @@ template <class T, class Alloc> Complexity:
- Constant. + Constant (in the size of the circular_buffer).
@@ -2737,7 +2788,7 @@ template <class T, class Alloc>
Linearize the internal buffer into a continuous array.

- This method can be useful when passing the stored data into the legacy C API as an array. + This method can be useful when passing the stored data into a legacy C API as an array.

@@ -2753,7 +2804,7 @@ template <class T, class Alloc> Returns:
- A pointer to the beginning of the array or 0 if empty. + A pointer to the beginning of the array or 0 if empty.
@@ -2761,10 +2812,10 @@ template <class T, class Alloc> Throws:
- Whatever T::T(const T&) throws. + Whatever T::T(const T&) throws.
- Whatever T::operator = (const T&) throws. + Whatever T::operator = (const T&) throws.
@@ -2810,7 +2861,7 @@ template <class T, class Alloc> "#classboost_1_1circular__buffer_1957cccdcb0c4ef7d80a34a990065818d">array_one() and array_two() for the - other option.how to pass data into the legacy C API. + other option.how to pass data into a legacy C API.
@@ -2836,7 +2887,7 @@ template <class T, class Alloc> Throws:
- Nothing. + Nothing.
@@ -2844,7 +2895,7 @@ template <class T, class Alloc> Complexity:
- Constant. + Constant (in the size of the circular_buffer).
@@ -2898,7 +2949,7 @@ template <class T, class Alloc> Throws:
- Nothing. + Nothing.
@@ -2906,7 +2957,7 @@ template <class T, class Alloc> Complexity:
- Constant. + Constant (in the size of the circular_buffer).
@@ -2931,11 +2982,7 @@ template <class T, class Alloc>
size(), - capacity(), - resize(), - set_capacity() + capacity()
@@ -2961,7 +3008,7 @@ template <class T, class Alloc> Throws:
- Nothing. + Nothing.
@@ -2969,7 +3016,7 @@ template <class T, class Alloc> Complexity:
- Constant. + Constant (in the size of the circular_buffer).
@@ -3019,7 +3066,7 @@ template <class T, class Alloc> Throws:
- Nothing. + Nothing.
@@ -3027,7 +3074,7 @@ template <class T, class Alloc> Complexity:
- Constant. + Constant (in the size of the circular_buffer).
@@ -3077,7 +3124,7 @@ template <class T, class Alloc> Throws:
- Nothing. + Nothing.
@@ -3085,7 +3132,7 @@ template <class T, class Alloc> Complexity:
- Constant. + Constant (in the size of the circular_buffer).
@@ -3125,33 +3172,27 @@ template <class T, class Alloc> "#classboost_1_1circular__buffer_19ba12c0142a21a7d960877c22fa3ea00">size_type new_capacity);

- Change the capacity of the circular buffer. -
-
- Parameters: -
-
- new_capacity - The new capacity. -
-
- remove_front - This parameter plays its role only if the current number of elements stored in - the circular buffer is greater than the desired new capacity. If set to true then the - first (leftmost) elements will be removed. If set to false then the last (leftmost) - elements will be removed. -
-
+ Change the capacity of the circular_buffer.
Postcondition:
- (*this).capacity() == + capacity() == new_capacity
- If the current number of elements stored in the circular buffer is greater than the desired new - capacity then ((*this).size() - new_capacity) - elements will be removed according to the remove_front parameter. +
+ If the current number of elements stored in the circular_buffer is greater than the + desired new capacity then number of [size() - new_capacity] + first (leftmost) elements will be removed. +
+
+
+
+ Parameter(s): +
+
+ new_capacity The new capacity.
@@ -3159,19 +3200,49 @@ template <class T, class Alloc> Throws:
- An allocation error if memory is exhausted (std::bad_alloc if the standard + An allocation error if memory is exhausted (std::bad_alloc if the standard allocator is used).
- Whatever T::T(const T&) throws. + Whatever T::T(const T&) throws.
- Note: + Complexity:
- For iterator invalidation see the documentation. + Linear (in the size/new capacity of the circular_buffer). The complexity of the + allocator's allocate() and deallocate() methods which are used in + set_capacity() is not + considered. +
+
+
+
+ Exception Safety: +
+
+ Strong. +
+
+
+
+ Iterator Invalidation: +
+
+ Invalidates all iterators pointing to the circular_buffer. +
+
+
+
+ See Also: +
+
+ rset_capacity(), + resize()
@@ -3184,36 +3255,37 @@ template <class T, class Alloc> "#classboost_1_1circular__buffer_1a8397191092f5bacee991b623ca4b910">const_reference item = value_type());


- Change the size of the circular buffer. -
-
- Parameters: -
-
- new_size - The new size. -
-
- item - See the postcondition. -
-
- remove_front - This parameter plays its role only if the current number of elements stored in - the circular buffer is greater than the desired new capacity. If set to true then the - first (leftmost) elements will be removed. If set to false then the last (rightmost) - elements will be removed. -
-
+ Change the size of the circular_buffer.
Postcondition:
- (*this).size() == + size() == + new_size && capacity() >= new_size
- If the new size is greater than the current size, the rest of the circular buffer is filled with copies - of item. In case the resulting size exceeds the current capacity the capacity is set to - new_size. If the new size is lower than the current size then ((*this).size() - new_size) - elements will be removed according to the remove_front parameter. +
+ If the new size is greater than the current size, copies of item will be inserted at the + back of the of the circular_buffer in order to achieve the desired size. In the + case the resulting size exceeds the current capacity the capacity will be set to + new_size.
+ If the current number of elements stored in the circular_buffer is greater than the + desired new size then number of [size() - new_size] + last (rightmost) elements will be removed. (The capacity will remain unchanged.) +
+
+
+
+ Parameter(s): +
+
+ new_size The new size. +
+
+ item The element the circular_buffer will be filled with in order to gain the + requested size. (See the postcondition.)
@@ -3221,19 +3293,49 @@ template <class T, class Alloc> Throws:
- An allocation error if memory is exhausted (std::bad_alloc if the standard + An allocation error if memory is exhausted (std::bad_alloc if the standard allocator is used).
- Whatever T::T(const T&) throws. + Whatever T::T(const T&) throws.
- Note: + Complexity:
- For iterator invalidation see the documentation. + Linear (in the size/new capacity of the circular_buffer). The complexity of the + allocator's allocate() and deallocate() methods which are used in + set_capacity() is not + considered. +
+
+
+
+ Exception Safety: +
+
+ Strong. +
+
+
+
+ Iterator Invalidation: +
+
+ Invalidates all iterators pointing to the circular_buffer. +
+
+
+
+ See Also: +
+
+ rresize(), + set_capacity()
@@ -3245,8 +3347,79 @@ template <class T, class Alloc> "#classboost_1_1circular__buffer_19ba12c0142a21a7d960877c22fa3ea00">size_type new_capacity);


- TODO doc.
-
+ Change the capacity of the circular_buffer. +
+
+ Postcondition: +
+
+ capacity() == + new_capacity
+
+ If the current number of elements stored in the circular_buffer is greater than the + desired new capacity then number of [size() - new_capacity] + last (rightmost) elements will be removed. +
+
+
+
+ Parameter(s): +
+
+ new_capacity The new capacity. +
+
+
+
+ Throws: +
+
+ An allocation error if memory is exhausted (std::bad_alloc if the standard + allocator is used). +
+
+ Whatever T::T(const T&) throws. +
+
+
+
+ Complexity: +
+
+ Linear (in the size/new capacity of the circular_buffer). The complexity of the + allocator's allocate() and deallocate() methods which are used in + rset_capacity() is not + considered. +
+
+
+
+ Exception Safety: +
+
+ Basic. +
+
+
+
+ Iterator Invalidation: +
+
+ Invalidates all iterators pointing to the circular_buffer. +
+
+
+
+ See Also: +
+
+ set_capacity(), + rresize() +
+
@@ -3257,8 +3430,89 @@ template <class T, class Alloc> "#classboost_1_1circular__buffer_1a8397191092f5bacee991b623ca4b910">const_reference item = value_type());

- TODO doc.
-
+ Change the size of the circular_buffer. +
+
+ Postcondition: +
+
+ size() == + new_size && capacity() >= + new_size
+
+ If the new size is greater than the current size, copies of item will be inserted at the + front of the of the circular_buffer in order to achieve the desired size. In the + case the resulting size exceeds the current capacity the capacity will be set to + new_size.
+ If the current number of elements stored in the circular_buffer is greater than the + desired new size then number of [size() - new_size] + first (leftmost) elements will be removed. (The capacity will remain unchanged.) +
+
+
+
+ Parameter(s): +
+
+ new_size The new size. +
+
+ item The element the circular_buffer will be filled with in order to gain the + requested size. (See the postcondition.) +
+
+
+
+ Throws: +
+
+ An allocation error if memory is exhausted (std::bad_alloc if the standard + allocator is used). +
+
+ Whatever T::T(const T&) throws. +
+
+
+
+ Complexity: +
+
+ Linear (in the size/new capacity of the circular_buffer). The complexity of the + allocator's allocate() and deallocate() methods which are used in + set_capacity() is not + considered. +
+
+
+
+ Exception Safety: +
+
+ Strong. +
+
+
+
+ Iterator Invalidation: +
+
+ Invalidates all iterators pointing to the circular_buffer. +
+
+
+
+ See Also: +
+
+ rresize(), + set_capacity() +
+
@@ -3281,11 +3535,11 @@ template <class T, class Alloc> Throws:
- An allocation error if memory is exhausted (std::bad_alloc if the standard + An allocation error if memory is exhausted (std::bad_alloc if the standard allocator is used).
- Whatever T::T(const T&) throws. + Whatever T::T(const T&) throws.
@@ -3324,11 +3578,11 @@ template <class T, class Alloc> Throws:
- An allocation error if memory is exhausted (std::bad_alloc if the standard + An allocation error if memory is exhausted (std::bad_alloc if the standard allocator is used).
- Whatever T::T(const T&) throws. + Whatever T::T(const T&) throws.
@@ -3387,11 +3641,11 @@ template <class T, class Alloc> Throws:
- An allocation error if memory is exhausted (std::bad_alloc if the standard + An allocation error if memory is exhausted (std::bad_alloc if the standard allocator is used).
- Whatever T::T(const T&) throws. + Whatever T::T(const T&) throws.
@@ -3425,10 +3679,10 @@ template <class T, class Alloc> Swap the contents of two circular_buffers.
- Parameters: + Parameter(s):
- cb - The circular_buffer whose content should be swapped. + cb The circular_buffer whose content should be swapped.
@@ -3436,7 +3690,7 @@ template <class T, class Alloc> Throws:
- Nothing. + Nothing.
@@ -3452,7 +3706,7 @@ template <class T, class Alloc> Complexity:
- Constant. + Constant (in the size of the circular_buffer).
@@ -3508,7 +3762,7 @@ template <class T, class Alloc> Throws:
- Whatever T::T(const T&) throws. + Whatever T::T(const T&) throws.
@@ -3544,7 +3798,7 @@ template <class T, class Alloc> Throws:
- Whatever T::T(const T&) throws. + Whatever T::T(const T&) throws.
@@ -3671,10 +3925,10 @@ template <class T, class Alloc> Throws:
- Whatever T::T(const T&) throws. + Whatever T::T(const T&) throws.
- Whatever T::operator = (const T&) throws. + Whatever T::operator = (const T&) throws.
@@ -3727,10 +3981,10 @@ template <class T, class Alloc> Throws:
- Whatever T::T(const T&) throws. + Whatever T::T(const T&) throws.
- Whatever T::operator = (const T&) throws. + Whatever T::operator = (const T&) throws.
@@ -3784,10 +4038,10 @@ template <class T, class Alloc> Throws:
- Whatever T::T(const T&) throws. + Whatever T::T(const T&) throws.
- Whatever T::operator = (const T&) throws. + Whatever T::operator = (const T&) throws.
@@ -3840,10 +4094,10 @@ template <class T, class Alloc> Throws:
- Whatever T::T(const T&) throws. + Whatever T::T(const T&) throws.
- Whatever T::operator = (const T&) throws. + Whatever T::operator = (const T&) throws.
@@ -3896,10 +4150,10 @@ template <class T, class Alloc> Throws:
- Whatever T::T(const T&) throws. + Whatever T::T(const T&) throws.
- Whatever T::operator = (const T&) throws. + Whatever T::operator = (const T&) throws.
@@ -3953,10 +4207,10 @@ template <class T, class Alloc> Throws:
- Whatever T::T(const T&) throws. + Whatever T::T(const T&) throws.
- Whatever T::operator = (const T&) throws. + Whatever T::operator = (const T&) throws.
diff --git a/doc/doxygen2html.xslt b/doc/doxygen2html.xslt index 71ac4ae..9c95213 100644 --- a/doc/doxygen2html.xslt +++ b/doc/doxygen2html.xslt @@ -37,6 +37,10 @@ http://www.boost.org/LICENSE_1_0.txt)   + + + +
@@ -87,16 +91,12 @@ http://www.boost.org/LICENSE_1_0.txt) -
-
- +
- - - +
@@ -129,8 +129,7 @@ http://www.boost.org/LICENSE_1_0.txt)
- - +
diff --git a/include/boost/circular_buffer/base.hpp b/include/boost/circular_buffer/base.hpp index 59729de..c8cec5e 100644 --- a/include/boost/circular_buffer/base.hpp +++ b/include/boost/circular_buffer/base.hpp @@ -179,12 +179,12 @@ public: \return The allocator. \throws Nothing. \par Complexity - Constant. + Constant (in the size of the circular_buffer). \par Exception Safety No-throw. \par Iterator Invalidation Does not invalidate any iterator. - \sa get_allocator() + \sa get_allocator() for obtaining an allocator %reference. */ allocator_type get_allocator() const { return m_alloc; } @@ -193,7 +193,7 @@ public: \return A reference to the allocator. \throws Nothing. \par Complexity - Constant. + Constant (in the size of the circular_buffer). \par Exception Safety No-throw. \par Iterator Invalidation @@ -209,15 +209,16 @@ public: //! Get the iterator pointing to the beginning of the circular_buffer. /*! \return A random access iterator pointing to the first element of the circular_buffer. If the - circular_buffer is empty it returns an iterator equal to the one returned by end(). + circular_buffer is empty it returns an iterator equal to the one returned by end() + . \throws Nothing. \par Complexity - Constant. + Constant (in the size of the circular_buffer). \par Exception Safety No-throw. \par Iterator Invalidation Does not invalidate any iterator. - \sa end(), rbegin() + \sa end(), rbegin(), rend() */ iterator begin() { return iterator(this, empty() ? 0 : m_first); } @@ -225,15 +226,15 @@ public: /*! \return A random access iterator pointing to the element "one behind" the last element of the circular_buffer. If the circular_buffer is empty it returns an iterator equal to - the one returned by begin(). + the one returned by begin(). \throws Nothing. \par Complexity - Constant. + Constant (in the size of the circular_buffer). \par Exception Safety No-throw. \par Iterator Invalidation Does not invalidate any iterator. - \sa begin() + \sa begin(), rbegin(), rend() */ iterator end() { return iterator(this, 0); } @@ -241,15 +242,15 @@ public: /*! \return A const random access iterator pointing to the first element of the circular_buffer. If the circular_buffer is empty it returns an iterator equal to the one returned by - end() const. + end() const. \throws Nothing. \par Complexity - Constant. + Constant (in the size of the circular_buffer). \par Exception Safety No-throw. \par Iterator Invalidation Does not invalidate any iterator. - \sa end() const + \sa end() const, rbegin() const, rend() const */ const_iterator begin() const { return const_iterator(this, empty() ? 0 : m_first); } @@ -257,15 +258,15 @@ public: /*! \return A const random access iterator pointing to the element "one behind" the last element of the circular_buffer. If the circular_buffer is empty it returns an iterator equal to - the one returned by begin() const. + the one returned by begin() const const. \throws Nothing. \par Complexity - Constant. + Constant (in the size of the circular_buffer). \par Exception Safety No-throw. \par Iterator Invalidation Does not invalidate any iterator. - \sa begin() const + \sa begin() const, rbegin() const, rend() const */ const_iterator end() const { return const_iterator(this, 0); } @@ -273,15 +274,15 @@ public: /*! \return A reverse random access iterator pointing to the last element of the circular_buffer. If the circular_buffer is empty it returns an iterator equal to the one returned by - rend(). + rend(). \throws Nothing. \par Complexity - Constant. + Constant (in the size of the circular_buffer). \par Exception Safety No-throw. \par Iterator Invalidation Does not invalidate any iterator. - \sa rend(), begin() + \sa rend(), begin(), end() */ reverse_iterator rbegin() { return reverse_iterator(end()); } @@ -289,15 +290,15 @@ public: /*! \return A reverse random access iterator pointing to the element "one before" the first element of the circular_buffer. If the circular_buffer is empty it returns an iterator equal to the - one returned by rbegin(). + one returned by rbegin(). \throws Nothing. \par Complexity - Constant. + Constant (in the size of the circular_buffer). \par Exception Safety No-throw. \par Iterator Invalidation Does not invalidate any iterator. - \sa rbegin() + \sa rbegin(), begin(), end() */ reverse_iterator rend() { return reverse_iterator(begin()); } @@ -305,15 +306,15 @@ public: /*! \return A const reverse random access iterator pointing to the last element of the circular_buffer . If the circular_buffer is empty it returns an iterator equal to the one returned - by rend() const. + by rend() const. \throws Nothing. \par Complexity - Constant. + Constant (in the size of the circular_buffer). \par Exception Safety No-throw. \par Iterator Invalidation Does not invalidate any iterator. - \sa rend() const + \sa rend() const, begin() const, end() const */ const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); } @@ -321,30 +322,31 @@ public: /*! \return A const reverse random access iterator pointing to the element "one before" the first element of the circular_buffer. If the circular_buffer is empty it returns an iterator equal - to the one returned by rbegin() const. + to the one returned by rbegin() const. \throws Nothing. \par Complexity - Constant. + Constant (in the size of the circular_buffer). \par Exception Safety No-throw. \par Iterator Invalidation Does not invalidate any iterator. - \sa rbegin() const + \sa rbegin() const, begin() const, end() const */ const_reverse_iterator rend() const { return const_reverse_iterator(begin()); } //! Get the element at the index position. /*! \pre 0 \<= index \&\& index < size() + \param index The position of the element. \return A reference to the element at the index position. \throws Nothing. \par Complexity - Constant. + Constant (in the size of the circular_buffer). \par Exception Safety No-throw. \par Iterator Invalidation Does not invalidate any iterator. - \sa at(size_type) + \sa at() */ reference operator [] (size_type index) { BOOST_CB_ASSERT(index < size()); // check for invalid index @@ -354,6 +356,7 @@ public: //! Get the element at the index position. /*! \pre 0 \<= index \&\& index < size() + \param index The position of the element. \return A const reference to the element at the index position. \throws Nothing. \par Complexity @@ -362,7 +365,7 @@ public: Strong. \par Iterator Invalidation Does not invalidate any iterator. - \sa at(size_type) const + \sa \link at(size_type)const at() const \endlink */ return_value_type operator [] (size_type index) const { BOOST_CB_ASSERT(index < size()); // check for invalid index @@ -371,15 +374,16 @@ public: //! Get the element at the index position. /*! + \param index The position of the element. \return A const reference to the element at the index position. \throws std::out_of_range when the index is invalid (when index >= size()). \par Complexity - Constant. + Constant (in the size of the circular_buffer). \par Exception Safety Strong. \par Iterator Invalidation Does not invalidate any iterator. - \sa operator[](size_type) + \sa operator[] */ reference at(size_type index) { check_position(index); @@ -388,15 +392,16 @@ public: //! Get the element at the index position. /*! + \param index The position of the element. \return A const reference to the element at the index position. \throws std::out_of_range when the index is invalid (when index >= size()). \par Complexity - Constant. + Constant (in the size of the circular_buffer). \par Exception Safety Strong. \par Iterator Invalidation Does not invalidate any iterator. - \sa operator[](size_type) const + \sa \link operator[](size_type)const operator[] const \endlink */ return_value_type at(size_type index) const { check_position(index); @@ -409,7 +414,7 @@ public: \return A reference to the first element of the circular_buffer. \throws Nothing. \par Complexity - Constant. + Constant (in the size of the circular_buffer). \par Exception Safety No-throw. \par Iterator Invalidation @@ -427,7 +432,7 @@ public: \return A reference to the last element of the circular_buffer. \throws Nothing. \par Complexity - Constant. + Constant (in the size of the circular_buffer). \par Exception Safety No-throw. \par Iterator Invalidation @@ -445,7 +450,7 @@ public: \return A const reference to the first element of the circular_buffer. \throws Nothing. \par Complexity - Constant. + Constant (in the size of the circular_buffer). \par Exception Safety No-throw. \par Iterator Invalidation @@ -463,7 +468,7 @@ public: \return A const reference to the last element of the circular_buffer. \throws Nothing. \par Complexity - Constant. + Constant (in the size of the circular_buffer). \par Exception Safety No-throw. \par Iterator Invalidation @@ -477,8 +482,8 @@ public: //! Get the first continuos array of the internal buffer. /*! - This method in combination with array_two() can be useful when passing the stored data into the - legacy C API as an array. Suppose there is a circular_buffer of capacity 10, containing 7 + This method in combination with array_two() can be useful when passing the stored data into + a legacy C API as an array. Suppose there is a circular_buffer of capacity 10, containing 7 characters 'a', 'b', ..., 'g' where cbuff[0] == 'a', cbuff[1] == 'b', ... and cbuff[6] == 'g':

circular_buffer cbuff(10);

@@ -507,7 +512,7 @@ public: circular_buffer is empty the size of the returned array is 0. \throws Nothing. \par Complexity - Constant. + Constant (in the size of the circular_buffer). \par Exception Safety No-throw. \par Iterator Invalidation @@ -523,14 +528,14 @@ public: //! Get the second continuos array of the internal buffer. /*! - This method in combination with array_one() can be useful when passing the stored data into the - legacy C API as an array. + This method in combination with array_one() can be useful when passing the stored data into + a legacy C API as an array. \return The array range of the second continuos array of the internal buffer. In the case the internal buffer is linear or the circular_buffer is empty the size of the returned array is 0. \throws Nothing. \par Complexity - Constant. + Constant (in the size of the circular_buffer). \par Exception Safety No-throw. \par Iterator Invalidation @@ -544,17 +549,17 @@ public: //! Get the first continuos array of the internal buffer. /*! This method in combination with array_two() const can be useful when passing the stored data into - the legacy C API as an array. + a legacy C API as an array. \return The array range of the first continuos array of the internal buffer. In the case the circular_buffer is empty the size of the returned array is 0. \throws Nothing. \par Complexity - Constant. + Constant (in the size of the circular_buffer). \par Exception Safety No-throw. \par Iterator Invalidation Does not invalidate any iterator. - \sa array_one() for more details.how to pass data into the legacy C API. + \sa array_two() const; array_one() for more details.how to pass data into a legacy C API. */ const_array_range array_one() const { return const_array_range(m_first, (m_last <= m_first && !empty() ? m_end : m_last) - m_first); @@ -563,13 +568,13 @@ public: //! Get the second continuos array of the internal buffer. /*! This method in combination with array_one() const can be useful when passing the stored data into - the legacy C API as an array. + a legacy C API as an array. \return The array range of the second continuos array of the internal buffer. In the case the internal buffer is linear or the circular_buffer is empty the size of the returned array is 0. \throws Nothing. \par Complexity - Constant. + Constant (in the size of the circular_buffer). \par Exception Safety No-throw. \par Iterator Invalidation @@ -582,9 +587,9 @@ public: //! Linearize the internal buffer into a continuous array. /*! - This method can be useful when passing the stored data into the legacy C API as an array. + This method can be useful when passing the stored data into a legacy C API as an array. \post \&(*this)[0] \< \&(*this)[1] \< ... \< \&(*this)[size() - 1] - \return A pointer to the beginning of the array or 0 if empty. + \return A pointer to the beginning of the array or 0 if empty. \throws Whatever T::T(const T&) throws. \throws Whatever T::operator = (const T&) throws. \par Complexity @@ -596,7 +601,7 @@ public: if the postcondition is already met prior calling this method. \warning In general invoking any method which modifies the internal state of the circular_buffer may delinearize the internal buffer and invalidate the returned pointer. - \sa array_one() and array_two() for the other option.how to pass data into the legacy + \sa array_one() and array_two() for the other option.how to pass data into a legacy C API. */ pointer linearize() { @@ -649,7 +654,7 @@ public: \return The number of elements stored in the circular_buffer. \throws Nothing. \par Complexity - Constant. + Constant (in the size of the circular_buffer). \par Exception Safety No-throw. \par Iterator Invalidation @@ -663,12 +668,12 @@ public: \return The maximum size/capacity the circular_buffer can be set to. \throws Nothing. \par Complexity - Constant. + Constant (in the size of the circular_buffer). \par Exception Safety No-throw. \par Iterator Invalidation Does not invalidate any iterator. - \sa size(), capacity(), resize(), set_capacity() + \sa size(), capacity() */ size_type max_size() const { return std::min(m_alloc.max_size(), std::numeric_limits::max()); @@ -680,7 +685,7 @@ public: false otherwise. \throws Nothing. \par Complexity - Constant. + Constant (in the size of the circular_buffer). \par Exception Safety No-throw. \par Iterator Invalidation @@ -695,7 +700,7 @@ public: equals the capacity of the circular_buffer; false otherwise. \throws Nothing. \par Complexity - Constant. + Constant (in the size of the circular_buffer). \par Exception Safety No-throw. \par Iterator Invalidation @@ -709,7 +714,7 @@ public: \return The maximum number of elements which can be stored in the circular_buffer. \throws Nothing. \par Complexity - Constant. + Constant (in the size of the circular_buffer). \par Exception Safety No-throw. \par Iterator Invalidation @@ -718,24 +723,25 @@ public: */ size_type capacity() const { return m_end - m_buff; } - //! Change the capacity of the circular buffer. + //! Change the capacity of the circular_buffer. /*! + \post capacity() == new_capacity

+ If the current number of elements stored in the circular_buffer is greater than the desired + new capacity then number of [size() - new_capacity] first (leftmost) elements will be + removed. \param new_capacity The new capacity. - \param remove_front This parameter plays its role only if the - current number of elements stored in the circular buffer - is greater than the desired new capacity. If set to - true then the first (leftmost) elements - will be removed. If set to false then the - last (leftmost) elements will be removed. - \post (*this).capacity() == new_capacity
- If the current number of elements stored in the circular - buffer is greater than the desired new capacity then - ((*this).size() - new_capacity) elements - will be removed according to the remove_front - parameter. - \throws "An allocation error" if memory is exhausted (std::bad_alloc if the standard allocator is used). + \throws "An allocation error" if memory is exhausted (std::bad_alloc if the standard allocator is + used). \throws Whatever T::T(const T&) throws. - \note For iterator invalidation see the documentation. + \par Complexity + Linear (in the size/new capacity of the circular_buffer). The complexity of the allocator's + %allocate() and %deallocate() methods which are used in set_capacity() + is not considered. + \par Exception Safety + Strong. + \par Iterator Invalidation + Invalidates all iterators pointing to the circular_buffer. + \sa rset_capacity(), resize() */ void set_capacity(size_type new_capacity) { if (new_capacity == capacity()) @@ -750,36 +756,60 @@ public: BOOST_CATCH_END } - //! Change the size of the circular buffer. + //! Change the size of the circular_buffer. /*! + \post size() == new_size \&\& capacity() >= new_size

+ If the new size is greater than the current size, copies of item will be inserted at the + back of the of the circular_buffer in order to achieve the desired size. In the case + the resulting size exceeds the current capacity the capacity will be set to new_size.
+ If the current number of elements stored in the circular_buffer is greater than the desired + new size then number of [size() - new_size] last (rightmost) elements will be + removed. (The capacity will remain unchanged.) \param new_size The new size. - \param item See the postcondition. - \param remove_front This parameter plays its role only if the - current number of elements stored in the circular buffer - is greater than the desired new capacity. If set to - true then the first (leftmost) elements - will be removed. If set to false then the - last (rightmost) elements will be removed. - \post (*this).size() == new_size
- If the new size is greater than the current size, the rest - of the circular buffer is filled with copies of item. - In case the resulting size exceeds the current capacity - the capacity is set to new_size. - If the new size is lower than the current size then - ((*this).size() - new_size) elements will be removed - according to the remove_front parameter. + \param item The element the circular_buffer will be filled with in order to gain the requested + size. (See the postcondition.) \throws "An allocation error" if memory is exhausted (std::bad_alloc if the standard allocator is used). \throws Whatever T::T(const T&) throws. - \note For iterator invalidation see the documentation. + \par Complexity + Linear (in the size/new capacity of the circular_buffer). The complexity of the allocator's + %allocate() and %deallocate() methods which are used in set_capacity() + is not considered. + \par Exception Safety + Strong. + \par Iterator Invalidation + Invalidates all iterators pointing to the circular_buffer. + \sa rresize(), set_capacity() */ void resize(size_type new_size, param_value_type item = value_type()) { - if (new_size > size()) - increase_size(new_size, item); - else - erase(begin(), end() - new_size); + if (new_size > size()) { + if (new_size > capacity()) + set_capacity(new_size); + insert(end(), new_size - size(), item); + } else { + erase(end() - (size() - new_size), end()); + } } - //! TODO doc + //! Change the capacity of the circular_buffer. + /*! + \post capacity() == new_capacity

+ If the current number of elements stored in the circular_buffer is greater than the desired + new capacity then number of [size() - new_capacity] last (rightmost) elements will be + removed. + \param new_capacity The new capacity. + \throws "An allocation error" if memory is exhausted (std::bad_alloc if the standard allocator is + used). + \throws Whatever T::T(const T&) throws. + \par Complexity + Linear (in the size/new capacity of the circular_buffer). The complexity of the allocator's + %allocate() and %deallocate() methods which are used in rset_capacity() + is not considered. + \par Exception Safety + Basic. + \par Iterator Invalidation + Invalidates all iterators pointing to the circular_buffer. + \sa set_capacity(), rresize() + */ void rset_capacity(size_type new_capacity) { if (new_capacity == capacity()) return; @@ -793,12 +823,38 @@ public: BOOST_CATCH_END } - //! TODO doc + //! Change the size of the circular_buffer. + /*! + \post size() == new_size \&\& capacity() >= new_size

+ If the new size is greater than the current size, copies of item will be inserted at the + front of the of the circular_buffer in order to achieve the desired size. In the case + the resulting size exceeds the current capacity the capacity will be set to new_size.
+ If the current number of elements stored in the circular_buffer is greater than the desired + new size then number of [size() - new_size] first (leftmost) elements will be + removed. (The capacity will remain unchanged.) + \param new_size The new size. + \param item The element the circular_buffer will be filled with in order to gain the requested + size. (See the postcondition.) + \throws "An allocation error" if memory is exhausted (std::bad_alloc if the standard allocator is used). + \throws Whatever T::T(const T&) throws. + \par Complexity + Linear (in the size/new capacity of the circular_buffer). The complexity of the allocator's + %allocate() and %deallocate() methods which are used in set_capacity() + is not considered. + \par Exception Safety + Strong. + \par Iterator Invalidation + Invalidates all iterators pointing to the circular_buffer. + \sa rresize(), set_capacity() + */ void rresize(size_type new_size, param_value_type item = value_type()) { - if (new_size > size()) - increase_size(new_size, item); - else - erase(begin() + new_size, end()); + if (new_size > size()) { + if (new_size > capacity()) + set_capacity(new_size); + insert(begin(), new_size - size(), item); + } else { + erase(begin(), end() - new_size); + } } // Construction/Destruction @@ -997,7 +1053,7 @@ public: \throws Nothing. \post this contains elements of cb and vice versa. \par Complexity - Constant. + Constant (in the size of the circular_buffer). \par Exception Safety No-throw. \par Iterator Invalidation @@ -1650,13 +1706,6 @@ private: BOOST_CATCH_END } - //! Increase the size of the circular buffer. - void increase_size(size_type new_size, param_value_type item) { - if (new_size > capacity()) - set_capacity(new_size); - insert(end(), new_size - size(), item); - } - //! Reset the circular buffer. void reset(pointer buff, pointer last, size_type new_capacity) { destroy(); diff --git a/include/boost/circular_buffer/space_optimized.hpp b/include/boost/circular_buffer/space_optimized.hpp index 7905432..917424b 100644 --- a/include/boost/circular_buffer/space_optimized.hpp +++ b/include/boost/circular_buffer/space_optimized.hpp @@ -169,10 +169,13 @@ public: //! See the circular_buffer source documentation. void resize(size_type new_size, param_value_type item = value_type()) { - if (new_size > size()) - increase_size(new_size, item); - else - erase(begin(), end() - new_size); + if (new_size > size()) { + if (new_size > capacity()) + m_capacity_ctrl.m_capacity = new_size; + insert(end(), new_size - size(), item); + } else { + erase(end() - (size() - new_size), end()); + } } //! See the circular_buffer source documentation. @@ -191,10 +194,13 @@ public: //! See the circular_buffer source documentation. void rresize(size_type new_size, param_value_type item = value_type()) { - if (new_size > size()) - increase_size(new_size, item); - else - erase(begin() + new_size, end()); + if (new_size > size()) { + if (new_size > capacity()) + m_capacity_ctrl.m_capacity = new_size; + insert(begin(), new_size - size(), item); + } else { + erase(begin(), end() - new_size); + } } //! Create an empty space optimized circular buffer with a maximum capacity. @@ -648,13 +654,6 @@ private: return std::min(capacity_ctrl.m_capacity, std::max(capacity_ctrl.m_min_capacity, static_cast(std::distance(first, last)))); } - //! Increase the size of the space optimized circular buffer. - void increase_size(size_type new_size, param_value_type item) { - if (new_size > capacity()) - m_capacity_ctrl.m_capacity = new_size; - insert(end(), new_size - size(), item); - } - //! Specialized insert method. template void insert(const iterator& pos, IntegralType n, IntegralType item, const true_type&) { diff --git a/test/common.ipp b/test/common.ipp index 758caab..c022c39 100644 --- a/test/common.ipp +++ b/test/common.ipp @@ -549,8 +549,8 @@ void resize_test() { BOOST_CHECK(cb1[19] == 5); BOOST_CHECK(cb2.size() == 2); BOOST_CHECK(cb2.capacity() == 10); - BOOST_CHECK(cb2[0] == 3); - BOOST_CHECK(cb2[1] == 4); + BOOST_CHECK(cb2[0] == 1); + BOOST_CHECK(cb2[1] == 2); BOOST_CHECK(cb3.size() == 0); BOOST_CHECK(cb3.capacity() == 10); BOOST_CHECK(cb4.size() == 10); @@ -575,8 +575,8 @@ void rresize_test() { BOOST_CHECK(cb.size() == 2); BOOST_CHECK(cb.capacity() == 10); - BOOST_CHECK(cb[0] == 1); - BOOST_CHECK(cb[1] == 2); + BOOST_CHECK(cb[0] == 3); + BOOST_CHECK(cb[1] == 4); generic_test(cb); }