diff --git a/doc/TODO b/doc/TODO index 18edb86..0824286 100644 --- a/doc/TODO +++ b/doc/TODO @@ -19,7 +19,8 @@ t05 DONE and will be taken from the source doc. (was: change "Type Requirements" to "Element Type Requirements") -t06 docs: define the element type requirements (as a precondition) for every +t06 DONE + docs: define the element type requirements (as a precondition) for every method t07 DONE - verify @@ -31,7 +32,8 @@ t08 DONE t09 DONE fix needed to compile the tests with GCC 3.4 -t10 docs: define exception safety for every method +t10 DONE + docs: define exception safety for every method "Guarantee of basic exception safety" as a design criteria for the whole container should be removed or amended. Plus add some 'generic_test's if the method does't guarantee only a basic @@ -46,21 +48,25 @@ t12 DONE provide default arguments for push_back()/push_front() and insert()/rinsert() methods and remove the non-argument versions -t13 docs: fix precondition "*(this).size() > index" to "(*this).size()" +t13 DONE + docs: fix precondition "*(this).size() > index" to "(*this).size()" or remove (*this) entirely (in the whole docs) -t14 docs: explicitly document methods which do not throw any exception, +t14 DONE + docs: explicitly document methods which do not throw any exception, e.g. "Exceptions: none" t15 DONE rename the data() method to something meaningful concerning its mutation status (e.g to_array); mention its linear complexity in the docs -t16 docs: document that push_back() or other methods that they can choose NOT +t16 DONE + docs: document that push_back() or other methods that they can choose NOT to insert something -> in general document the boundary conditions in greater details -t17 docs: delete the "Semantics" paragraph and move its content directly +t17 DONE + docs: delete the "Semantics" paragraph and move its content directly into the documentation of the particular methods t18 DONE @@ -102,7 +108,8 @@ t26 DONE t27 REJECTED docs: apply the DefaultConstructible and Assignable type requirements -t28 docs: the difference between resize() and set_capacity() should be +t28 DONE + docs: the difference between resize() and set_capacity() should be mentioned more explicitly t29 DONE diff --git a/doc/circular_buffer.html b/doc/circular_buffer.html index bfdba4f..b6cd833 100644 --- a/doc/circular_buffer.html +++ b/doc/circular_buffer.html @@ -33,7 +33,7 @@ Debug Support
More Examples
Header Files
- Modeled Concepts
+ Modelled Concepts
Template Parameters
Public Types
Constructors and Destructor
@@ -41,7 +41,7 @@ Standalone Functions
Notes
See also
- Acknowledgments + Acknowledgements @@ -838,7 +838,7 @@ template <class T, class Alloc> "classboost_1_1circular__buffer_19ba12c0142a21a7d960877c22fa3ea00">size_type @@ -848,7 +848,7 @@ template <class T, class Alloc> "classboost_1_1circular__buffer_14e07c6ddfe89debe384e59bed06e7cb7">allocator_type @@ -857,7 +857,7 @@ template <class T, class Alloc> "classboost_1_1circular__buffer_15cab6d46f03c40d1e52d41843319ddb9">const_iterator @@ -866,7 +866,7 @@ template <class T, class Alloc> "classboost_1_1circular__buffer_11b8a33f2dc8519b8a7d344ed4408c532">iterator @@ -875,7 +875,7 @@ template <class T, class Alloc> "classboost_1_1circular__buffer_1ca423a848964c7915629c90fa7c58598">const_reverse_iterator @@ -884,7 +884,7 @@ template <class T, class Alloc> "classboost_1_1circular__buffer_1e5dbaec472f4b6ab6a8d4d0d6b15cbdb">reverse_iterator @@ -911,11 +911,11 @@ template <class T, class Alloc> @@ -937,7 +937,7 @@ template <class T, class Alloc> Create an empty circular_buffer with a maximum capacity.
- Postcondition: + Effect:
capacity() == @@ -990,11 +990,11 @@ template <class T, class Alloc>
@@ -3547,7 +3547,7 @@ template <class T, class Alloc> Change the capacity of the circular_buffer.
- Postcondition: + Effect:
capacity() == @@ -3633,7 +3633,7 @@ template <class T, class Alloc> Change the size of the circular_buffer.
- Postcondition: + Effect:
size() == @@ -3735,7 +3735,7 @@ template <class T, class Alloc> Change the capacity of the circular_buffer.
- Postcondition: + Effect:
capacity() == @@ -3821,7 +3821,7 @@ template <class T, class Alloc> Change the size of the circular_buffer.
- Postcondition: + Effect:
size() == @@ -3925,7 +3925,7 @@ template <class T, class Alloc>

- Postcondition: + Effect:
*this == cb @@ -3989,12 +3989,12 @@ template <class T, class Alloc>
assign(size_type, const_reference), assign(size_type, size_type, + "#classboost_1_1circular__buffer_1aa10b4e4ec1f1c5918931b04b31d43ca">assign(capacity_type, size_type, const_reference), assign(InputIterator, InputIterator), assign(size_type, InputIterator, - InputIterator) + "#classboost_1_1circular__buffer_11edb80acdf1f7f1df8217d57256e41f6">assign(capacity_type, + InputIterator, InputIterator)
@@ -4014,7 +4014,7 @@ template <class T, class Alloc>

- Postcondition: + Effect:
capacity() == n @@ -4090,21 +4090,21 @@ template <class T, class Alloc>
operator=, - assign(size_type, + assign(capacity_type, size_type, const_reference), assign(InputIterator, InputIterator), assign(size_type, InputIterator, - InputIterator) + "#classboost_1_1circular__buffer_11edb80acdf1f7f1df8217d57256e41f6">assign(capacity_type, + InputIterator, InputIterator)
@@ -4246,7 +4246,7 @@ template <class T, class Alloc>
- Postcondition: + Effect:
capacity() == @@ -4325,21 +4325,22 @@ template <class T, class Alloc> operator=, assign(size_type, const_reference), assign(size_type, size_type, + "#classboost_1_1circular__buffer_1aa10b4e4ec1f1c5918931b04b31d43ca">assign(capacity_type, size_type, const_reference), assign(size_type, InputIterator, - InputIterator) + "#classboost_1_1circular__buffer_11edb80acdf1f7f1df8217d57256e41f6">assign(capacity_type, + InputIterator, InputIterator)
+ + +
@@ -173,16 +173,16 @@ public: "#classboost_1_1circular__buffer_126d279f91fef717e25459a0817ff242f">array_range; typedef std::pair<const_pointer, size_type> const_array_range; - typedef size_type capacity_control; + typedef size_type capacity_type; explicit circular_buffer(const allocator_type& alloc = allocator_type()); explicit circular_buffer(size_type capacity, const allocator_type& alloc = allocator_type()); +"#classboost_1_1circular__buffer_1862a64cbc6a49376ecbb8321c3b44974">circular_buffer(capacity_type capacity, const allocator_type& alloc = allocator_type()); circular_buffer(size_type n, const_reference item, const allocator_type& alloc = allocator_type()); circular_buffer(size_type capacity, size_type n, const_reference item, const allocator_type& alloc = allocator_type()); +"#classboost_1_1circular__buffer_10c7e9286d8270357d7e369b183124239">circular_buffer(capacity_type capacity, size_type n, const_reference item, const allocator_type& alloc = allocator_type()); circular_buffer(const circular_buffer<T, Alloc>& cb); template <class InputIterator> @@ -190,7 +190,7 @@ public: "#classboost_1_1circular__buffer_1744ec06b06a5a723386b645a29cb8ed2">circular_buffer(InputIterator first, InputIterator last, const allocator_type& alloc = allocator_type()); template <class InputIterator> circular_buffer(size_type capacity, InputIterator first, InputIterator last, const allocator_type& alloc = allocator_type()); +"#classboost_1_1circular__buffer_1a64dcad327971194a706d52487151eb7">circular_buffer(capacity_type capacity, InputIterator first, InputIterator last, const allocator_type& alloc = allocator_type()); ~circular_buffer(); allocator_type assign(size_type n, const_reference item); void assign(size_type capacity, size_type n, const_reference item); +"#classboost_1_1circular__buffer_1aa10b4e4ec1f1c5918931b04b31d43ca">assign(capacity_type capacity, size_type n, const_reference item); template <class InputIterator> void assign(InputIterator first, InputIterator last); template <class InputIterator> void assign(size_type capacity, InputIterator first, InputIterator last); +"#classboost_1_1circular__buffer_11edb80acdf1f7f1df8217d57256e41f6">assign(capacity_type capacity, InputIterator first, InputIterator last); void swap(circular_buffer<T, Alloc>& cb); void

- The following paragraphs describe issues that had to be considered during the implemenation of the + The following paragraphs describe issues that had to be considered during the implementation of the circular_buffer:

@@ -382,7 +382,7 @@ template <class T, class Alloc>

Overwrite operation occurs when an element is inserted into a full circular_buffer - the old element - is being overwriten by the new one. There was a discussion what exactly "overwriting of an element" means during + is being overwritten by the new one. There was a discussion what exactly "overwriting of an element" means during the formal review. It may be either a destruction of the original element and a consequent inplace construction of a new element or it may be an assignment of a new element into an old one. The circular_buffer implements assignment because it is more effective. @@ -423,10 +423,10 @@ template <class T, class Alloc> complicate the matters and the usage of the circular_buffer would be probably less straightforward.

- Moreover, the first two options (and the fouth option as well) do not require the buffer to be circular at all. + Moreover, the first two options (and the fourth option as well) do not require the buffer to be circular at all. If there is a need for the first or second option, consider implementing an adaptor of e.g. std::vector. In this case the circular_buffer is not suitable for adapting, because, in - contrary to std::vector, it bears an overhead for its circular behavior. + contrary to std::vector, it bears an overhead for its circular behaviour.

Reading/Removing from an Empty Buffer @@ -444,7 +444,7 @@ template <class T, class Alloc>

It is considered to be a bug to read or remove an element (e.g. by calling front() or - pop_back()) from an empty std container and from an emtpy circular_buffer + pop_back()) from an empty std container and from an empty circular_buffer as well. The data consumer has to test if the container is not empty before reading/removing from it. However, when reading from the circular_buffer, there is an option to rely on the at() method which throws an exception when the index is out of range. @@ -498,7 +498,7 @@ template <class T, class Alloc>

The circular_buffer should not be used for storing pointers to dynamically allocated objects. When a circular_buffer becomes full, further insertion will overwrite the stored pointers - resulting in a - memoryleak. One recommend alternative is the use of smart pointers [2]. (Any + memory leak. One recommend alternative is the use of smart pointers [2]. (Any container of std::auto_ptr is considered particularly hazardous. [3] )

@@ -694,7 +694,7 @@ template <class T, class Alloc> "../../../boost/circular_buffer_fwd.hpp">boost/circular_buffer_fwd.hpp.

- Modeled Concepts + Modelled Concepts

Random AccessContainer, value_type

- The type of elements stored in the circular buffer. + The type of elements stored in the circular_buffer.
- The size type. (An unsigned integral type that can represent any nonnegative value of the container's + The size type. (An unsigned integral type that can represent any non-negative value of the container's distance type.)
- The type of an allocator used in the circular buffer. + The type of an allocator used in the circular_buffer.
- A const (random access) iterator used to iterate through the circular buffer. + A const (random access) iterator used to iterate through the circular_buffer.
- A (random access) iterator used to iterate through the circular buffer. + A (random access) iterator used to iterate through the circular_buffer.
- A const iterator used to iterate backwards through a circular buffer. + A const iterator used to iterate backwards through a circular_buffer.
- An iterator used to iterate backwards through a circular buffer. + An iterator used to iterate backwards through a circular_buffer.
- capacity_control + capacity_type - The capacity type. (Defined just for consistency with the size_type - defined for consistency with the circular_buffer_space_optimized.)
- explicit - circular_buffer(size_type - capacity, const allocator_type& alloc = + explicit + circular_buffer(capacity_type capacity, const + allocator_type& alloc = allocator_type());

Create an empty circular_buffer with the specified capacity. @@ -1025,7 +1025,7 @@ template <class T, class Alloc>
- Postcondition: + Effect:
capacity() == @@ -1065,7 +1065,7 @@ template <class T, class Alloc> copies of item.
- Postcondition: + Effect:
capacity() == n @@ -1133,9 +1133,9 @@ template <class T, class Alloc>
- circular_buffer(size_type capacity, circular_buffer(capacity_type capacity, size_type n, const_reference item, const allocator_type& alloc = @@ -1153,7 +1153,7 @@ template <class T, class Alloc>
- Postcondition: + Effect:
capacity() == @@ -1242,7 +1242,7 @@ template <class T, class Alloc>

- Postcondition: + Effect:
*this == cb @@ -1307,7 +1307,7 @@ template <class T, class Alloc>
- Postcondition: + Effect:
capacity() == @@ -1376,12 +1376,12 @@ template <class T, class Alloc>
- template <class + template <class InputIterator>
circular_buffer(size_type capacity, InputIterator - first, InputIterator last, const capacity_type capacity, + InputIterator first, InputIterator last, const allocator_type& alloc = allocator_type());


@@ -1398,7 +1398,7 @@ template <class T, class Alloc>
- Postcondition: + Effect:
capacity() == @@ -2760,7 +2760,7 @@ template <class T, class Alloc> "#classboost_1_1circular__buffer_126d279f91fef717e25459a0817ff242f">array_range array_one();

- Get the first continuos array of the internal buffer. + Get the first continuous array of the internal buffer.

This method in combination with array_two() can be useful @@ -2779,7 +2779,7 @@ template <class T, class Alloc>
where |a|b|c|d| represents the "array one", |e|f|g| represents the "array two" and | | | | is a free space.
- Now consider a typical C style function for writting data into a file:
+ Now consider a typical C style function for writing data into a file:

int write(int file_desc, char* buff, int num_bytes);

@@ -2813,7 +2813,7 @@ template <class T, class Alloc> Returns:

- The array range of the first continuos array of the internal buffer. In the case the + The array range of the first continuous array of the internal buffer. In the case the circular_buffer is empty the size of the returned array is 0.
@@ -2893,7 +2893,7 @@ template <class T, class Alloc> "#classboost_1_1circular__buffer_126d279f91fef717e25459a0817ff242f">array_range array_two();


- Get the second continuos array of the internal buffer. + Get the second continuous array of the internal buffer.

This method in combination with array_one() can be useful @@ -2904,7 +2904,7 @@ template <class T, class Alloc> Returns:

- The array range of the second continuos array of the internal buffer. In the case the internal buffer + The array range of the second continuous 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.
@@ -2959,7 +2959,7 @@ template <class T, class Alloc> "#classboost_1_1circular__buffer_11885d7f475b7e7a74c95b2448d243025">const_array_range array_one() const;

- Get the first continuos array of the internal buffer. + Get the first continuous array of the internal buffer.

This method in combination with array_two() const can be @@ -2970,7 +2970,7 @@ template <class T, class Alloc> Returns:

- The array range of the first continuos array of the internal buffer. In the case the + The array range of the first continuous array of the internal buffer. In the case the circular_buffer is empty the size of the returned array is 0.
@@ -3026,7 +3026,7 @@ template <class T, class Alloc> "#classboost_1_1circular__buffer_11885d7f475b7e7a74c95b2448d243025">const_array_range array_two() const;

- Get the second continuos array of the internal buffer. + Get the second continuous array of the internal buffer.

This method in combination with array_one() const can be @@ -3037,7 +3037,7 @@ template <class T, class Alloc> Returns:

- The array range of the second continuos array of the internal buffer. In the case the internal buffer + The array range of the second continuous 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.
@@ -3097,7 +3097,7 @@ template <class T, class Alloc>

- Postcondition: + Effect:
&(*this)[0] < &(*this)[1] < ... < &(*this)[array_one() and array_two() for the - other option.how to pass data into a legacy C API. + other option how to pass data into a legacy C API.
- void assign(size_type capacity, void assign(capacity_type capacity, size_type n, const_reference item);
@@ -4125,7 +4125,7 @@ template <class T, class Alloc>
- Postcondition: + Effect:
capacity() == @@ -4216,8 +4216,8 @@ template <class T, class Alloc> const_reference), assign(InputIterator, InputIterator), assign(size_type, InputIterator, - InputIterator) + "#classboost_1_1circular__buffer_11edb80acdf1f7f1df8217d57256e41f6">assign(capacity_type, + InputIterator, InputIterator)
- template <class + template <class InputIterator>
- void assign(size_type - capacity, InputIterator first, InputIterator last);

+ void assign(capacity_type capacity, + InputIterator first, InputIterator last);


Assign a copy of the range into the circular_buffer with the specified capacity.

@@ -4359,7 +4360,7 @@ template <class T, class Alloc>

- Postcondition: + Effect:
capacity() == @@ -4452,7 +4453,7 @@ template <class T, class Alloc> operator=, assign(size_type, const_reference), assign(size_type, size_type, + "#classboost_1_1circular__buffer_1aa10b4e4ec1f1c5918931b04b31d43ca">assign(capacity_type, size_type, const_reference), assign(InputIterator, InputIterator) @@ -4469,7 +4470,7 @@ template <class T, class Alloc> Swap the contents of two circular_buffers.
- Postcondition: + Effect:
this contains elements of cb and vice versa. @@ -4546,7 +4547,7 @@ template <class T, class Alloc> Insert a new element at the end of the circular_buffer.
- Postcondition: + Effect:
if capacity() @@ -4628,7 +4629,7 @@ template <class T, class Alloc> Insert a new element at the beginning of the circular_buffer.
- Postcondition: + Effect:
if capacity() @@ -4717,7 +4718,7 @@ template <class T, class Alloc>
- Postcondition: + Effect:
The last element is removed from the circular_buffer. @@ -4787,7 +4788,7 @@ template <class T, class Alloc>
- Postcondition: + Effect:
The first element is removed from the circular_buffer. @@ -4860,7 +4861,7 @@ template <class T, class Alloc>
- Postcondition: + Effect:
The item will be inserted at the position pos.
@@ -4965,7 +4966,7 @@ template <class T, class Alloc>
- Postcondition: + Effect:
The number of min(n, (pos -
- Postcondition: + Effect:
Elements from the range [first + max(0, distance(first, last) - (pos -
- Postcondition: + Effect:
The item will be inserted before the position pos.
@@ -5341,7 +5342,7 @@ template <class T, class Alloc>
- Postcondition: + Effect:
The number of min(n, (
- Postcondition: + Effect:
Elements from the range [first, last - max(0, distance(first, last) - (
- Postcondition: + Effect:
The element at the position pos is removed. @@ -5693,7 +5694,7 @@ template <class T, class Alloc>
- Postcondition: + Effect:
The elements from the range [first, last) are removed. @@ -5776,7 +5777,7 @@ template <class T, class Alloc>
- Postcondition: + Effect:
The element at the position pos is removed. @@ -5860,7 +5861,7 @@ template <class T, class Alloc>
- Postcondition: + Effect:
The elements from the range [first, last) are removed. @@ -5933,7 +5934,7 @@ template <class T, class Alloc> Remove all stored elements from the circular_buffer.
- Postcondition: + Effect:
size() == @@ -6458,7 +6459,7 @@ template <class T, class Alloc> Swap the contents of two circular_buffers.
- Postcondition: + Effect:
lhs contains elements of rhs and vice versa. @@ -6537,7 +6538,7 @@ template <class T, class Alloc>
  • - An indepth definition of a circular buffer can be found at Wikipedia.

  • @@ -6567,7 +6568,7 @@ template <class T, class Alloc> "http://www.sgi.com/tech/stl/Deque.html">std::deque

    - Acknowledgments + Acknowledgements

    The circular_buffer has a short history. Its first version was a std::deque adaptor. diff --git a/doc/circular_buffer_space_optimized.html b/doc/circular_buffer_space_optimized.html index f303e5b..4e8e7c9 100644 --- a/doc/circular_buffer_space_optimized.html +++ b/doc/circular_buffer_space_optimized.html @@ -112,16 +112,16 @@ public: typedef std::pair<const_pointer, size_type> const_array_range; typedef implementation-defined capacity_control; +"#classboost_1_1circular__buffer__space__optimized_1051350e031c50c8b4a7ca1e1902e92f0">capacity_type; explicit circular_buffer_space_optimized(const allocator_type& alloc = allocator_type()); explicit circular_buffer_space_optimized(capacity_control capacity_ctrl, const allocator_type& alloc = allocator_type()); +"#classboost_1_1circular__buffer__space__optimized_1741159a0511a4e0fed6eaab6d6959fa7">circular_buffer_space_optimized(capacity_type capacity_ctrl, const allocator_type& alloc = allocator_type()); circular_buffer_space_optimized(capacity_control capacity_ctrl, const_reference item, const allocator_type& alloc = allocator_type()); +"#classboost_1_1circular__buffer__space__optimized_1f8c9fa872f9a84d454d7e245cc2eadbd">circular_buffer_space_optimized(capacity_type capacity_ctrl, const_reference item, const allocator_type& alloc = allocator_type()); circular_buffer_space_optimized(capacity_control capacity_ctrl, size_type n, const_reference item, const allocator_type& alloc = allocator_type()); +"#classboost_1_1circular__buffer__space__optimized_1d29ce80b10d4a3250fedeb9427210d96">circular_buffer_space_optimized(capacity_type capacity_ctrl, size_type n, const_reference item, const allocator_type& alloc = allocator_type()); circular_buffer_space_optimized(const circular_buffer_space_optimized<T, Alloc>& cb); template <class InputIterator> @@ -129,7 +129,7 @@ public: "#classboost_1_1circular__buffer__space__optimized_11dd04145492c82a959b1df1167b4e217">circular_buffer_space_optimized(InputIterator first, InputIterator last, const allocator_type& alloc = allocator_type()); template <class InputIterator> circular_buffer_space_optimized(capacity_control capacity_ctrl, InputIterator first, InputIterator last, const allocator_type& alloc = allocator_type()); +"#classboost_1_1circular__buffer__space__optimized_196c63e0ecd56f6f1ac87bc79d2fd5b9f">circular_buffer_space_optimized(capacity_type capacity_ctrl, InputIterator first, InputIterator last, const allocator_type& alloc = allocator_type()); ~circular_buffer_space_optimized(); @@ -186,6 +186,8 @@ public: "circular_buffer.html#classboost_1_1circular__buffer_15be1c2a005ec9828549ef6dd7ebed583">empty() const; bool full() const; size_type reserve() const; + size_type min_capacity() const; void set_min_capacity(size_type new_min_capacity); @@ -204,13 +206,13 @@ public: void assign(size_type n, const_reference item); void assign(capacity_control capacity_ctrl, size_type n, const_reference item); +"#classboost_1_1circular__buffer__space__optimized_1108055ae3f6b1635e1428b0455902cbf">assign(capacity_type capacity_ctrl, size_type n, const_reference item); template <class InputIterator> void assign(InputIterator first, InputIterator last); template <class InputIterator> void assign(capacity_control capacity_ctrl, InputIterator first, InputIterator last); +"#classboost_1_1circular__buffer__space__optimized_1e9347091d2d644854af0821d4b46869b">assign(capacity_type capacity_ctrl, InputIterator first, InputIterator last); void swap(circular_buffer_space_optimized<T, Alloc>& cb); void

    - capacity_control + capacity_type Capacity controller of the space optimized circular buffer. @@ -372,10 +374,10 @@ template <class T, class Alloc>
    - explicit + explicit circular_buffer_space_optimized(capacity_control + "circular_buffer.html#classboost_1_1circular__buffer_1dc642ff2be4db0be1a457810e5d09595">capacity_type capacity_ctrl, const allocator_type& alloc = allocator_type());
    @@ -386,11 +388,25 @@ template <class T, class Alloc> Parameter(s):
    - capacity_ctrl The capacity of the buffer. (param min_capacity The minimal guaranteed - amount of allocated memory.) (The metrics of the min_capacity is number of items.) +
    +
    + capacity_ctrl +
    +
    + The capacity of the buffer. (param min_capacity The minimal guaranteed amount of allocated memory.) + (The metrics of the min_capacity is number of items.) +
    +
    - alloc The allocator. +
    +
    + alloc +
    +
    + The allocator. +
    +
    @@ -403,7 +419,7 @@ template <class T, class Alloc>
    - Postcondition: + Effect:
    (*this).
    - circular_buffer_space_optimized(capacity_control + circular_buffer_space_optimized(capacity_type capacity_ctrl, const_reference item, const Parameter(s):
    - capacity_ctrl The capacity of the buffer. (param min_capacity The minimal guaranteed - amount of allocated memory.) (The metrics of the min_capacity is number of items.) +
    +
    + capacity_ctrl +
    +
    + The capacity of the buffer. (param min_capacity The minimal guaranteed amount of allocated memory.) + (The metrics of the min_capacity is number of items.) +
    +
    - item The item to be filled with. +
    +
    + item +
    +
    + The item to be filled with. +
    +
    - alloc The allocator. +
    +
    + alloc +
    +
    + The allocator. +
    +
    @@ -468,7 +505,7 @@ template <class T, class Alloc>
    - Postcondition: + Effect:
    (*this).
    - circular_buffer_space_optimized(capacity_control + circular_buffer_space_optimized(capacity_type capacity_ctrl, size_type n,
    - template + template <class InputIterator>
    circular_buffer_space_optimized(capacity_control + "circular_buffer.html#classboost_1_1circular__buffer_1dc642ff2be4db0be1a457810e5d09595">capacity_type capacity_ctrl, InputIterator first, InputIterator last, const allocator_type& alloc = allocator_type());

    @@ -557,17 +594,45 @@ template <class T, class Alloc> Parameter(s):
    - capacity_ctrl The capacity of the buffer. (param min_capacity The minimal guaranteed - amount of allocated memory.) (The metrics of the min_capacity is number of items.) +
    +
    + capacity_ctrl +
    +
    + The capacity of the buffer. (param min_capacity The minimal guaranteed amount of allocated memory.) + (The metrics of the min_capacity is number of items.) +
    +
    - first The beginning of the range. +
    +
    + first +
    +
    + The beginning of the range. +
    +
    - last The end of the range. +
    +
    + last +
    +
    + The end of the range. +
    +
    - alloc The allocator. +
    +
    + alloc +
    +
    + The allocator. +
    +
    @@ -580,7 +645,7 @@ template <class T, class Alloc>
    - Postcondition: + Effect:
    (*this).
    + size_type + reserve() const;
    +
    + See the circular_buffer source + documentation.
    +
    +
    - Postcondition: + Effect:
    (*this).
    - void + void assign(capacity_control + "circular_buffer.html#classboost_1_1circular__buffer_1dc642ff2be4db0be1a457810e5d09595">capacity_type capacity_ctrl, size_type n,
    - template + template <class InputIterator>
    void assign(capacity_control + "circular_buffer.html#classboost_1_1circular__buffer_1dc642ff2be4db0be1a457810e5d09595">capacity_type capacity_ctrl, InputIterator first, InputIterator last);


    See the circular_buffer source diff --git a/doc/doxygen2html.xslt b/doc/doxygen2html.xslt index 255ac1f..7a42634 100644 --- a/doc/doxygen2html.xslt +++ b/doc/doxygen2html.xslt @@ -123,7 +123,7 @@ http://www.boost.org/LICENSE_1_0.txt) -
    Postcondition:
    +
    Effect:
    diff --git a/include/boost/circular_buffer/base.hpp b/include/boost/circular_buffer/base.hpp index ddcc301..44dc533 100644 --- a/include/boost/circular_buffer/base.hpp +++ b/include/boost/circular_buffer/base.hpp @@ -68,7 +68,7 @@ class circular_buffer : cb_details::iterator_registry { public: // Basic types - //! The type of elements stored in the circular buffer. + //! The type of elements stored in the circular_buffer. typedef typename Alloc::value_type value_type; //! A pointer to an element. @@ -91,25 +91,25 @@ public: //! The size type. /*! - (An unsigned integral type that can represent any nonnegative value of the container's distance type.) + (An unsigned integral type that can represent any non-negative value of the container's distance type.) */ typedef typename Alloc::size_type size_type; - //! The type of an allocator used in the circular buffer. + //! The type of an allocator used in the circular_buffer. typedef Alloc allocator_type; // Iterators - //! A const (random access) iterator used to iterate through the circular buffer. + //! A const (random access) iterator used to iterate through the circular_buffer. typedef cb_details::iterator< circular_buffer, cb_details::const_traits > const_iterator; - //! A (random access) iterator used to iterate through the circular buffer. + //! A (random access) iterator used to iterate through the circular_buffer. typedef cb_details::iterator< circular_buffer, cb_details::nonconst_traits > iterator; - //! A const iterator used to iterate backwards through a circular buffer. + //! A const iterator used to iterate backwards through a circular_buffer. typedef reverse_iterator const_reverse_iterator; - //! An iterator used to iterate backwards through a circular buffer. + //! An iterator used to iterate backwards through a circular_buffer. typedef reverse_iterator reverse_iterator; // Container specific types @@ -132,10 +132,10 @@ public: //! The capacity type. /*! - (Defined just for consistency with the - circular_buffer_space_optimized.) + (Same as size_type - defined for consistency with the + circular_buffer_space_optimized.) */ - typedef size_type capacity_control; + typedef size_type capacity_type; // Helper types @@ -483,7 +483,7 @@ public: return *((m_last == m_buff ? m_end : m_last) - 1); } - //! Get the first continuos array of the internal buffer. + //! Get the first continuous array of the internal buffer. /*! 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 @@ -497,7 +497,7 @@ public: begin -------^


    where |a|b|c|d| represents the "array one", |e|f|g| represents the "array two" and | | | | is a free space.
    - Now consider a typical C style function for writting data into a file:

    + Now consider a typical C style function for writing data into a file:

    int write(int file_desc, char* buff, int num_bytes);

    There are two ways how to write the content of the circular_buffer into a file. Either relying on array_one() and array_two() methods and calling the write function twice:

    @@ -511,7 +511,7 @@ public: option is suitable when calling the write method is "cheap". On the other hand the second option is more suitable when calling the write method is more "expensive" than calling the linearize() method whose complexity is linear. - \return The array range of the first continuos array of the internal buffer. In the case the + \return The array range of the first continuous 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 @@ -532,11 +532,11 @@ public: return array_range(m_first, (m_last <= m_first && !empty() ? m_end : m_last) - m_first); } - //! Get the second continuos array of the internal buffer. + //! Get the second continuous array of the internal buffer. /*! 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 + \return The array range of the second continuous 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. @@ -552,11 +552,11 @@ public: return array_range(m_buff, m_last <= m_first && !empty() ? m_last - m_buff : 0); } - //! Get the first continuos array of the internal buffer. + //! Get the first continuous array of the internal buffer. /*! This method in combination with array_two() const can be useful when passing the stored data into a legacy C API as an array. - \return The array range of the first continuos array of the internal buffer. In the case the + \return The array range of the first continuous 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 @@ -572,11 +572,11 @@ public: return const_array_range(m_first, (m_last <= m_first && !empty() ? m_end : m_last) - m_first); } - //! Get the second continuos array of the internal buffer. + //! Get the second continuous array of the internal buffer. /*! This method in combination with array_one() const 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 + \return The array range of the second continuous 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. @@ -608,7 +608,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 a legacy + \sa array_one() and array_two() for the other option how to pass data into a legacy C API. */ pointer linearize() { @@ -899,7 +899,7 @@ public: Constant. */ explicit circular_buffer( - size_type capacity, + capacity_type capacity, const allocator_type& alloc = allocator_type()) : m_size(0), m_alloc(alloc) { initialize(capacity); @@ -942,7 +942,7 @@ public: Linear (in the n). */ circular_buffer( - size_type capacity, + capacity_type capacity, size_type n, param_value_type item, const allocator_type& alloc = allocator_type()) @@ -987,7 +987,7 @@ public: template circular_buffer( - size_type capacity, + capacity_type capacity, InputIterator first, InputIterator last) : m_alloc(allocator_type()) { @@ -1046,7 +1046,7 @@ public: */ template circular_buffer( - size_type capacity, + capacity_type capacity, InputIterator first, InputIterator last, const allocator_type& alloc = allocator_type()) @@ -1088,10 +1088,10 @@ public: \par Iterator Invalidation Invalidates all iterators pointing to this circular_buffer. \sa \link assign(size_type, param_value_type) assign(size_type, const_reference)\endlink, - \link assign(size_type, size_type, param_value_type) - assign(size_type, size_type, const_reference)\endlink, + \link assign(capacity_type, size_type, param_value_type) + assign(capacity_type, size_type, const_reference)\endlink, assign(InputIterator, InputIterator), - assign(size_type, InputIterator, InputIterator) + assign(capacity_type, InputIterator, InputIterator) */ circular_buffer& operator = (const circular_buffer& cb) { if (this == &cb) @@ -1124,10 +1124,10 @@ public: Basic. \par Iterator Invalidation Invalidates all iterators pointing to the circular_buffer. - \sa operator=, \link assign(size_type, size_type, param_value_type) - assign(size_type, size_type, const_reference)\endlink, + \sa operator=, \link assign(capacity_type, size_type, param_value_type) + assign(capacity_type, size_type, const_reference)\endlink, assign(InputIterator, InputIterator), - assign(size_type, InputIterator, InputIterator) + assign(capacity_type, InputIterator, InputIterator) */ void assign(size_type n, param_value_type item) { assign_n(n, n, cb_details::assign_n(n, item, m_alloc)); @@ -1154,9 +1154,9 @@ public: Invalidates all iterators pointing to the circular_buffer. \sa operator=, \link assign(size_type, param_value_type) assign(size_type, const_reference)\endlink, assign(InputIterator, InputIterator), - assign(size_type, InputIterator, InputIterator) + assign(capacity_type, InputIterator, InputIterator) */ - void assign(size_type capacity, size_type n, param_value_type item) { + void assign(capacity_type capacity, size_type n, param_value_type item) { BOOST_CB_ASSERT(capacity >= n); // check for new capacity lower than n assign_n(capacity, n, cb_details::assign_n(n, item, m_alloc)); } @@ -1184,9 +1184,9 @@ public: Invalidates all iterators pointing to the circular_buffer. \sa operator=, \link assign(size_type, param_value_type) assign(size_type, const_reference)\endlink, - \link assign(size_type, size_type, param_value_type) - assign(size_type, size_type, const_reference)\endlink, - assign(size_type, InputIterator, InputIterator) + \link assign(capacity_type, size_type, param_value_type) + assign(capacity_type, size_type, const_reference)\endlink, + assign(capacity_type, InputIterator, InputIterator) */ template void assign(InputIterator first, InputIterator last) { @@ -1221,12 +1221,12 @@ public: Invalidates all iterators pointing to the circular_buffer. \sa operator=, \link assign(size_type, param_value_type) assign(size_type, const_reference)\endlink, - \link assign(size_type, size_type, param_value_type) - assign(size_type, size_type, const_reference)\endlink, + \link assign(capacity_type, size_type, param_value_type) + assign(capacity_type, size_type, const_reference)\endlink, assign(InputIterator, InputIterator) */ template - void assign(size_type capacity, InputIterator first, InputIterator last) { + void assign(capacity_type capacity, InputIterator first, InputIterator last) { assign(capacity, first, last, is_integral()); } @@ -1919,13 +1919,13 @@ private: } //! Initialize the circular buffer. - void initialize(size_type capacity) { + void initialize(capacity_type capacity) { m_first = m_last = m_buff = allocate(capacity); m_end = m_buff + capacity; } //! Initialize the circular buffer. - void initialize(size_type capacity, param_value_type item) { + void initialize(capacity_type capacity, param_value_type item) { initialize(capacity); BOOST_TRY { cb_details::uninitialized_fill_n(m_buff, size(), item, m_alloc); @@ -1969,7 +1969,7 @@ private: //! Specialized initialize method. template - void initialize(size_type capacity, IntegralType n, IntegralType item, const true_type&) { + void initialize(capacity_type capacity, IntegralType n, IntegralType item, const true_type&) { BOOST_CB_ASSERT(capacity >= static_cast(n)); // check for capacity lower than n m_size = static_cast(n); initialize(capacity, item); @@ -1977,14 +1977,14 @@ private: //! Specialized initialize method. template - void initialize(size_type capacity, Iterator first, Iterator last, const false_type&) { + void initialize(capacity_type capacity, Iterator first, Iterator last, const false_type&) { BOOST_CB_IS_CONVERTIBLE(Iterator, value_type); // check for invalid iterator type initialize(capacity, first, last, BOOST_DEDUCED_TYPENAME BOOST_ITERATOR_CATEGORY::type()); } //! Specialized initialize method. template - void initialize(size_type capacity, + void initialize(capacity_type capacity, InputIterator first, InputIterator last, const std::input_iterator_tag&) { @@ -2006,7 +2006,7 @@ private: //! Specialized initialize method. template - void initialize(size_type capacity, + void initialize(capacity_type capacity, ForwardIterator first, ForwardIterator last, const std::forward_iterator_tag&) { @@ -2016,7 +2016,7 @@ private: //! Helper initialize method. template - void initialize(size_type capacity, + void initialize(capacity_type capacity, ForwardIterator first, ForwardIterator last, size_type distance) { @@ -2039,7 +2039,7 @@ private: } //! Reset the circular buffer. - void reset(pointer buff, pointer last, size_type new_capacity) { + void reset(pointer buff, pointer last, capacity_type new_capacity) { destroy(); m_size = last - buff; m_first = m_buff = buff; @@ -2089,20 +2089,20 @@ private: //! Specialized assign method. template - void assign(size_type new_capacity, IntegralType n, IntegralType item, const true_type&) { + void assign(capacity_type new_capacity, IntegralType n, IntegralType item, const true_type&) { assign(new_capacity, static_cast(n), static_cast(item)); } //! Specialized assign method. template - void assign(size_type new_capacity, Iterator first, Iterator last, const false_type&) { + void assign(capacity_type new_capacity, Iterator first, Iterator last, const false_type&) { BOOST_CB_IS_CONVERTIBLE(Iterator, value_type); // check for invalid iterator type assign(new_capacity, first, last, BOOST_DEDUCED_TYPENAME BOOST_ITERATOR_CATEGORY::type()); } //! Specialized assign method. template - void assign(size_type new_capacity, InputIterator first, InputIterator last, const std::input_iterator_tag&) { + void assign(capacity_type new_capacity, InputIterator first, InputIterator last, const std::input_iterator_tag&) { if (new_capacity == capacity()) { clear(); insert(begin(), first, last); @@ -2114,7 +2114,7 @@ private: //! Specialized assign method. template - void assign(size_type new_capacity, ForwardIterator first, ForwardIterator last, const std::forward_iterator_tag&) { + void assign(capacity_type new_capacity, ForwardIterator first, ForwardIterator last, const std::forward_iterator_tag&) { BOOST_CB_ASSERT(std::distance(first, last) >= 0); // check for wrong range size_type distance = std::distance(first, last); if (distance > new_capacity) { @@ -2126,7 +2126,7 @@ private: //! Helper assign method. template - void assign_n(size_type new_capacity, size_type n, const Functor& fnc) { + void assign_n(capacity_type new_capacity, size_type n, const Functor& fnc) { if (new_capacity == capacity()) { destroy_content(); BOOST_TRY { diff --git a/include/boost/circular_buffer/space_optimized.hpp b/include/boost/circular_buffer/space_optimized.hpp index 51289d2..1f61027 100644 --- a/include/boost/circular_buffer/space_optimized.hpp +++ b/include/boost/circular_buffer/space_optimized.hpp @@ -77,7 +77,7 @@ public: which ensures compatibility of creating an instance of the circular_buffer_space_optimized with other STL containers.

    */ - typedef cb_details::capacity_control capacity_control; + typedef cb_details::capacity_control capacity_type; // Inherited @@ -107,7 +107,7 @@ private: // Member variables //! The capacity controller of the space optimized circular buffer. - capacity_control m_capacity_ctrl; + capacity_type m_capacity_ctrl; public: // Overridden @@ -230,7 +230,7 @@ public: in the debug mode. */ explicit circular_buffer_space_optimized( - capacity_control capacity_ctrl, + capacity_type capacity_ctrl, const allocator_type& alloc = allocator_type()) : circular_buffer(capacity_ctrl.m_min_capacity, alloc) , m_capacity_ctrl(capacity_ctrl) {} @@ -251,7 +251,7 @@ public: in the debug mode. */ circular_buffer_space_optimized( - capacity_control capacity_ctrl, + capacity_type capacity_ctrl, param_value_type item, const allocator_type& alloc = allocator_type()) : circular_buffer(capacity_ctrl.m_capacity, item, alloc) @@ -259,7 +259,7 @@ public: //! TODO doc circular_buffer_space_optimized( - capacity_control capacity_ctrl, + capacity_type capacity_ctrl, size_type n, param_value_type item, const allocator_type& alloc = allocator_type()) @@ -291,7 +291,7 @@ public: // TODO describe workaround template circular_buffer_space_optimized( - capacity_control capacity_ctrl, + capacity_type capacity_ctrl, InputIterator first, InputIterator last) : circular_buffer( @@ -337,7 +337,7 @@ public: */ template circular_buffer_space_optimized( - capacity_control capacity_ctrl, + capacity_type capacity_ctrl, InputIterator first, InputIterator last, const allocator_type& alloc = allocator_type()) @@ -375,7 +375,7 @@ public: } //! See the circular_buffer source documentation. - void assign(capacity_control capacity_ctrl, size_type n, param_value_type item) { + void assign(capacity_type capacity_ctrl, size_type n, param_value_type item) { BOOST_CB_ASSERT(capacity_ctrl.m_capacity >= n); // check for new capacity lower than n circular_buffer::assign(std::max(capacity_ctrl.m_min_capacity, n), n, item); m_capacity_ctrl = capacity_ctrl; @@ -391,7 +391,7 @@ public: //! See the circular_buffer source documentation. template - void assign(capacity_control capacity_ctrl, InputIterator first, InputIterator last) { + void assign(capacity_type capacity_ctrl, InputIterator first, InputIterator last) { m_capacity_ctrl = capacity_ctrl; circular_buffer::assign(capacity(), first, last); check_high_capacity(); @@ -626,33 +626,33 @@ private: } //! TODO doc - static size_type init_capacity(const capacity_control& capacity_ctrl, size_type n) { + static size_type init_capacity(const capacity_type& capacity_ctrl, size_type n) { BOOST_CB_ASSERT(capacity_ctrl.m_capacity >= n); // check for capacity lower than n return std::max(capacity_ctrl.m_min_capacity, n); } //! Specialized method for determining the initial capacity. template - static size_type init_capacity(const capacity_control& capacity_ctrl, IntegralType n, IntegralType item, const true_type&) { + static size_type init_capacity(const capacity_type& capacity_ctrl, IntegralType n, IntegralType item, const true_type&) { return init_capacity(capacity_ctrl, static_cast(n)); } //! Specialized method for determining the initial capacity. template - static size_type init_capacity(const capacity_control& capacity_ctrl, Iterator first, Iterator last, const false_type&) { + static size_type init_capacity(const capacity_type& capacity_ctrl, Iterator first, Iterator last, const false_type&) { BOOST_CB_IS_CONVERTIBLE(Iterator, value_type); // check for invalid iterator type return init_capacity(capacity_ctrl, first, last, BOOST_DEDUCED_TYPENAME BOOST_ITERATOR_CATEGORY::type()); } //! Specialized method for determining the initial capacity. template - static size_type init_capacity(const capacity_control& capacity_ctrl, InputIterator first, InputIterator last, const std::input_iterator_tag&) { + static size_type init_capacity(const capacity_type& capacity_ctrl, InputIterator first, InputIterator last, const std::input_iterator_tag&) { return capacity_ctrl.m_capacity; } //! Specialized method for determining the initial capacity. template - static size_type init_capacity(const capacity_control& capacity_ctrl, ForwardIterator first, ForwardIterator last, const std::forward_iterator_tag&) { + static size_type init_capacity(const capacity_type& capacity_ctrl, ForwardIterator first, ForwardIterator last, const std::forward_iterator_tag&) { BOOST_CB_ASSERT(std::distance(first, last) >= 0); // check for wrong range return std::min(capacity_ctrl.m_capacity, std::max(capacity_ctrl.m_min_capacity, static_cast(std::distance(first, last)))); } diff --git a/test/space_optimized_test.cpp b/test/space_optimized_test.cpp index 9540ab1..fc07920 100644 --- a/test/space_optimized_test.cpp +++ b/test/space_optimized_test.cpp @@ -15,7 +15,7 @@ #include "common.ipp" typedef circular_buffer_space_optimized cb_space_optimized; -typedef cb_space_optimized::capacity_control capacity_ctrl; +typedef cb_space_optimized::capacity_type capacity_ctrl; // min_capacity test (it is useful to use a debug tool) void min_capacity_test() {