diff --git a/doc/circular_buffer.html b/doc/circular_buffer.html
index f12fb5a..319d6ef 100644
--- a/doc/circular_buffer.html
+++ b/doc/circular_buffer.html
@@ -30,6 +30,11 @@
Introductory Example
Synopsis
Rationale
+ - Thread-Safety
+ - Overwrite Operation
+ - Writing to a Full Buffer
+ - Reading/Removing from an Empty Buffer
+ - Iterator Invalidation
Caveats
Debug Support
More Examples
@@ -366,9 +371,10 @@ template <class T, class Alloc>
The thread-safety of the circular_buffer is the same as the thread-safety of containers in most STL
- implementations. This means the circular_buffer is thread-safe only in the sense that simultaneous
- accesses to distinct instances of the circular_buffer are safe, and simultaneous read accesses to a
- shared circular_buffer are safe.
+ implementations. This means the circular_buffer is not thread-safe. The thread-safety is
+ guarantied only in the sense that simultaneous accesses to distinct instances of the
+ circular_buffer are safe, and simultaneous read accesses to a shared circular_buffer
+ are safe.
If multiple threads access a single circular_buffer, and at least one of the threads may potentially
@@ -378,7 +384,7 @@ template <class T, class Alloc>
Buffer Example.)
Overwrite operation occurs when an element is inserted into a full circular_buffer - the old element
@@ -397,7 +403,7 @@ template <class T, class Alloc>
being shifted (e.g. as a result of insertion into the middle of container).
There are several options how to cope with the case if a data source produces more data than can fit in the
@@ -429,7 +435,7 @@ template <class T, class Alloc>
contrary to std::vector, it bears an overhead for its circular behaviour.
When reading or removing an element from an empty buffer, the buffer should be able to notify the data consumer @@ -450,7 +456,7 @@ template <class T, class Alloc> which throws an exception when the index is out of range.
An iterator is usually considered to be invalidated if an element, the iterator pointed to, had been removed or @@ -933,11 +939,11 @@ template <class T, class Alloc>
erase(iterator) method
+ and is more effective than erase(iterator) if the
+ iterator pos is close to the beginning of the circular_buffer. (See the
+ Complexity.)
+ erase(iterator,
+ iterator) method and is more effective than erase(iterator,
+ iterator) if std::distance(begin(), first) is lower
+ that std::distance(last, end()).
+ circular_buffer_space_optimized).
erase(iterator)
+ and this method. It is implemented only for consistency with the base circular_buffer.
+ circular_buffer_space_optimized).
erase(iterator,
+ iterator) and this method. It is implemented only for consistency with the base
+ circular_buffer.
+ std::distance(begin(), pos)).
+ \note This method is symetric to the erase(iterator) method and is more effective than
+ erase(iterator) if the iterator pos is close to the beginning of the
+ circular_buffer. (See the Complexity.)
\sa erase(iterator), erase(iterator, iterator),
rerase(iterator, iterator), clear()
*/
@@ -1818,6 +1821,9 @@ public:
the erased range (towards the beginning).
\par Complexity
Linear (in std::distance(begin(), last)).
+ \note This method is symetric to the erase(iterator, iterator) method and is more effective than
+ erase(iterator, iterator) if std::distance(begin(), first) is lower that
+ std::distance(last, end()).
\sa erase(iterator), erase(iterator, iterator), rerase(iterator),
clear()
*/
diff --git a/include/boost/circular_buffer/details.hpp b/include/boost/circular_buffer/details.hpp
index b47fbca..f9f5b2e 100644
--- a/include/boost/circular_buffer/details.hpp
+++ b/include/boost/circular_buffer/details.hpp
@@ -227,7 +227,7 @@ public:
//! Difference type.
typedef typename base_iterator::difference_type difference_type;
-#if !defined(BOOST_CB_TEST) && !BOOST_CB_ENABLE_DEBUG
+#if !defined(BOOST_CB_TEST) && BOOST_CB_ENABLE_DEBUG == 0
private:
#endif
// Member variables
diff --git a/include/boost/circular_buffer/space_optimized.hpp b/include/boost/circular_buffer/space_optimized.hpp
index 6ba6800..b8950cb 100644
--- a/include/boost/circular_buffer/space_optimized.hpp
+++ b/include/boost/circular_buffer/space_optimized.hpp
@@ -1141,6 +1141,8 @@ public:
equal to end()).
\par Complexity
Linear (in the size of the circular_buffer_space_optimized).
+ \note Basically there is no difference between erase(iterator) and this method. It is implemented
+ only for consistency with the base circular_buffer.
\sa erase(iterator), erase(iterator, iterator),
rerase(iterator, iterator), clear()
*/
@@ -1171,6 +1173,9 @@ public:
equal to end()).
\par Complexity
Linear (in the size of the circular_buffer_space_optimized).
+ \note Basically there is no difference between erase(iterator, iterator) and this method. It is
+ implemented only for consistency with the base
+ circular_buffer.
\sa erase(iterator), erase(iterator, iterator), rerase(iterator),
clear()
*/
diff --git a/test/base_test.cpp b/test/base_test.cpp
index 5386137..439d7f7 100644
--- a/test/base_test.cpp
+++ b/test/base_test.cpp
@@ -189,7 +189,6 @@ void iterator_comparison_test() {
BOOST_CHECK(!(end - 1 < it));
}
-// TODO add insert, push_back etc.
void iterator_invalidation_test() {
#if !defined(NDEBUG) && !defined(BOOST_CB_DISABLE_DEBUG)
diff --git a/test/common.ipp b/test/common.ipp
index 8b248d9..d3403f7 100644
--- a/test/common.ipp
+++ b/test/common.ipp
@@ -534,9 +534,11 @@ void capacity_and_reserve_test() {
BOOST_CHECK(cb1.reserve() == 0);
BOOST_CHECK(cb1.full());
BOOST_CHECK(cb1.empty());
+ BOOST_CHECK(cb1.reserve() == cb1.capacity() - cb1.size());
BOOST_CHECK(cb2.capacity() == 10);
BOOST_CHECK(cb2.size() == 0);
BOOST_CHECK(cb2.reserve() == 10);
+ BOOST_CHECK(cb2.reserve() == cb2.capacity() - cb2.size());
cb1.push_back(1);
cb2.push_back(2);
@@ -548,9 +550,11 @@ void capacity_and_reserve_test() {
BOOST_CHECK(cb1.reserve() == 0);
BOOST_CHECK(cb1.full());
BOOST_CHECK(cb1.empty());
+ BOOST_CHECK(cb1.reserve() == cb1.capacity() - cb1.size());
BOOST_CHECK(cb2.capacity() == 10);
BOOST_CHECK(cb2.size() == 3);
BOOST_CHECK(cb2.reserve() == 7);
+ BOOST_CHECK(cb2.reserve() == cb2.capacity() - cb2.size());
generic_test(cb1);
generic_test(cb2);