- 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() {
|