mirror of
https://github.com/boostorg/circular_buffer.git
synced 2026-02-03 09:02:12 +00:00
Compare commits
23 Commits
boost-1.56
...
boost-1.66
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
70664ea403 | ||
|
|
a2a85b57d4 | ||
|
|
ef8c59c4a6 | ||
|
|
0b9a59f270 | ||
|
|
31aa9939b3 | ||
|
|
99c93337d7 | ||
|
|
12b896d57f | ||
|
|
ea60799f31 | ||
|
|
d49044344f | ||
|
|
45c5d05b1d | ||
|
|
9cf5fbb0fe | ||
|
|
2c88fa2f27 | ||
|
|
ce9a8538f2 | ||
|
|
5136d09e0a | ||
|
|
8a35c1deb0 | ||
|
|
a54ccf9962 | ||
|
|
d48b479c6a | ||
|
|
8ba2c24454 | ||
|
|
05a6e6e0d5 | ||
|
|
483a1bdc2d | ||
|
|
cfdf5c063b | ||
|
|
f02cbb939c | ||
|
|
d18e2283a4 |
@@ -334,9 +334,9 @@ so for example: iterators `(begin() - 1)` and `(end() + 1)` are both invalid.
|
||||
[h3 Debug Support]
|
||||
|
||||
In order to help a programmer to avoid and find common bugs,
|
||||
the __cb contains a kind of debug support.
|
||||
the __cb can be enabled to provide a kind of debug support.
|
||||
|
||||
The __cb maintains a list of valid iterators.
|
||||
When the debugging functionality is enabled, the __cb maintains a list of valid iterators.
|
||||
As soon as any element gets destroyed all iterators pointing to this element
|
||||
are removed from this list and explicitly invalidated (an invalidation flag is set).
|
||||
The debug support also consists of many assertions (`BOOST_ASSERT` macros)
|
||||
@@ -349,9 +349,13 @@ Moreover, the uninitialized memory allocated by __cb is filled with the value `0
|
||||
When debugging the code, this can help the programmer to recognize the initialized memory from the uninitialized.
|
||||
For details refer the source code [@boost:boost/circular_buffer/debug.hpp circular_buffer/debug.hpp].
|
||||
|
||||
The debug support is enabled only in the debug mode (when the `NDEBUG` is not defined).
|
||||
It can also be explicitly disabled (only for __cb)
|
||||
by defining macro BOOST_CB_DISABLE_DEBUG.
|
||||
[caution Since the debugging code makes __cb and its iterators more interconnected, thread safety guarantees of __cb
|
||||
are different when debug support is enabled. In addition to the container itself, all iterators tracked by the container
|
||||
(including any copies thereof) must be protected from concurrent access. In particular, this includes copying, destroying or
|
||||
obtaining iterators from the container, even if for read-only access.]
|
||||
|
||||
The debug support is disabled by default. To enable it, one has to define `BOOST_CB_ENABLE_DEBUG` macro with the value of 1
|
||||
while compiling the code using __cb.
|
||||
|
||||
[h3 Compatibility with Interprocess library]
|
||||
|
||||
@@ -360,7 +364,7 @@ The __cb is compatible with the [@boost:libs/interprocess/index.html Boost.Inte
|
||||
library used for interprocess communication.
|
||||
Considering that the circular_buffer's debug support relies on 'raw' pointers
|
||||
(which is not permited by the Interprocess library)
|
||||
the code has to compiled with `-DBOOST_CB_DISABLE_DEBUG` or `-DNDEBUG` (which disables the Debug Support).
|
||||
the code has to compiled with debug support disabled (i.e. with `BOOST_CB_ENABLE_DEBUG` macro not defined or defined to 0).
|
||||
Not doing that will cause the compilation to fail.
|
||||
|
||||
[endsect] [/section:implementation Implementation ]
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
path-constant nav_images : html/images/ ; # png and svg images for home, next, note, tip...
|
||||
path-constant images_location : html/images ; # location of my SVG and PNG images referenced by Quickbook.
|
||||
path-constant pdf_images_location : html ; # location of SVG and PNG images referenced by pdf.
|
||||
path-constant pdf_images_location : .. ; # location of SVG and PNG images referenced by pdf.
|
||||
path-constant here : . ; # location of /doc folder.
|
||||
|
||||
# echo "nav_images = " $(nav_images) ; # "nav_images = I:\boost-trunk\libs\circular_buffer\doc\html\images
|
||||
@@ -181,14 +181,15 @@ boostbook standalone
|
||||
# Set these one for PDF generation *only*:
|
||||
# default png graphics are awful in PDF form,
|
||||
# better use SVG instead:
|
||||
#<format>pdf:<xsl:param>admon.graphics.extension=".svg"
|
||||
<format>pdf:<xsl:param>admon.graphics.extension=".png" # Only png images are available.
|
||||
<format>pdf:<xsl:param>admon.graphics.path=$(nav_images)/ # next, prev, note, tip ... for pdf.
|
||||
<format>pdf:<xsl:param>admon.graphics.extension=".svg"
|
||||
#<format>pdf:<xsl:param>admon.graphics.extension=".png" # Only png images are available.
|
||||
# Don't need this, default path works OK:
|
||||
#<format>pdf:<xsl:param>admon.graphics.path=$(nav_images)/ # next, prev, note, tip ... for pdf.
|
||||
<format>pdf:<xsl:param>use.role.for.mediaobject=1
|
||||
<format>pdf:<xsl:param>preferred.mediaobject.role=print
|
||||
<format>pdf:<xsl:param>img.src.path=$(pdf_images_location)/ # graphics (diagrams) for pdf.
|
||||
<format>pdf:<xsl:param>img.src.path=$(pdf_images_location)/ # graphics (diagrams) for pdf.
|
||||
<format>pdf:<xsl:param>draft.mode="no"
|
||||
<format>pdf:<xsl:param>boost.url.prefix=../../../..
|
||||
<format>pdf:<xsl:param>boost.url.prefix=../../../..
|
||||
|
||||
<dependency>autodoc #
|
||||
<dependency>png_install
|
||||
@@ -205,7 +206,14 @@ install png_install : [ glob $(here)/*.png ] : <location>$(here)/../../../doc/ht
|
||||
# because a modified pdf file is created, so this command
|
||||
# will rename the file to the expected filename, here circular_buffer.pdf.
|
||||
|
||||
install pdf-install : standalone : <install-type>PDF <location>. <name>circular_buffer.pdf ;
|
||||
|
||||
|
||||
install pdfinstall : standalone : <install-type>PDF <location>. <name>circular_buffer.pdf ;
|
||||
|
||||
###############################################################################
|
||||
alias boostdoc
|
||||
: standalone/<format>docbook
|
||||
:
|
||||
:
|
||||
: ;
|
||||
explicit boostdoc ;
|
||||
alias boostrelease ;
|
||||
explicit boostrelease ;
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#define BOOST_CB_DISABLE_DEBUG
|
||||
|
||||
#include <boost/circular_buffer.hpp>
|
||||
#include <boost/thread/mutex.hpp>
|
||||
#include <boost/thread/condition.hpp>
|
||||
|
||||
@@ -5,11 +5,13 @@
|
||||
// (See the accompanying file LICENSE_1_0.txt
|
||||
// or a copy at <http://www.boost.org/LICENSE_1_0.txt>.)
|
||||
|
||||
#undef BOOST_CB_ENABLE_DEBUG
|
||||
|
||||
//[circular_buffer_iter_example_1
|
||||
/*`
|
||||
*/
|
||||
|
||||
#define BOOST_CB_DISABLE_DEBUG // The Debug Support has to be disabled, otherwise the code produces a runtime error.
|
||||
#define BOOST_CB_ENABLE_DEBUG 0 // The Debug Support has to be disabled, otherwise the code produces a runtime error.
|
||||
|
||||
#include <boost/circular_buffer.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
@@ -34,5 +36,5 @@ int main(int /*argc*/, char* /*argv*/[])
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//] [/circular_buffer_iter_example_1]
|
||||
|
||||
//] [/circular_buffer_iter_example_1]
|
||||
|
||||
@@ -20,10 +20,8 @@
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
// BOOST_CB_ENABLE_DEBUG: Debug support control.
|
||||
#if defined(NDEBUG) || defined(BOOST_CB_DISABLE_DEBUG)
|
||||
#if !defined(BOOST_CB_ENABLE_DEBUG)
|
||||
#define BOOST_CB_ENABLE_DEBUG 0
|
||||
#else
|
||||
#define BOOST_CB_ENABLE_DEBUG 1
|
||||
#endif
|
||||
|
||||
// BOOST_CB_ASSERT: Runtime assertion.
|
||||
@@ -60,6 +58,5 @@
|
||||
#undef BOOST_CB_ASSERT_TEMPLATED_ITERATOR_CONSTRUCTORS
|
||||
#undef BOOST_CB_IS_CONVERTIBLE
|
||||
#undef BOOST_CB_ASSERT
|
||||
#undef BOOST_CB_ENABLE_DEBUG
|
||||
|
||||
#endif // #if !defined(BOOST_CIRCULAR_BUFFER_HPP)
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include <boost/type_traits/is_nothrow_move_assignable.hpp>
|
||||
#include <boost/type_traits/is_copy_constructible.hpp>
|
||||
#include <boost/type_traits/conditional.hpp>
|
||||
#include <boost/move/adl_move_swap.hpp>
|
||||
#include <boost/move/move.hpp>
|
||||
#include <boost/utility/addressof.hpp>
|
||||
#include <algorithm>
|
||||
@@ -175,23 +176,6 @@ public:
|
||||
typedef BOOST_RV_REF(value_type) rvalue_type;
|
||||
|
||||
private:
|
||||
|
||||
// TODO: move to Boost.Move
|
||||
/*! \cond */
|
||||
template <class ValT>
|
||||
static inline typename boost::conditional<
|
||||
((boost::is_nothrow_move_constructible<ValT>::value && boost::is_nothrow_move_assignable<ValT>::value) || !boost::is_copy_constructible<ValT>::value)
|
||||
#if defined(BOOST_NO_CXX11_DELETED_FUNCTIONS) && defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
&& has_move_emulation_enabled<ValT>::value
|
||||
#endif
|
||||
,
|
||||
rvalue_type,
|
||||
param_value_type
|
||||
>::type move_if_noexcept(ValT& value) BOOST_NOEXCEPT {
|
||||
return boost::move(value);
|
||||
}
|
||||
/*! \endcond */
|
||||
|
||||
// Member variables
|
||||
|
||||
//! The internal buffer used for storing elements in the circular buffer.
|
||||
@@ -682,11 +666,11 @@ public:
|
||||
break;
|
||||
}
|
||||
if (is_uninitialized(dest)) {
|
||||
boost::container::allocator_traits<Alloc>::construct(m_alloc, boost::addressof(*dest), this_type::move_if_noexcept(*src));
|
||||
boost::container::allocator_traits<Alloc>::construct(m_alloc, cb_details::to_address(dest), boost::move_if_noexcept(*src));
|
||||
++constructed;
|
||||
} else {
|
||||
value_type tmp = this_type::move_if_noexcept(*src);
|
||||
replace(src, this_type::move_if_noexcept(*dest));
|
||||
value_type tmp = boost::move_if_noexcept(*src);
|
||||
replace(src, boost::move_if_noexcept(*dest));
|
||||
replace(dest, boost::move(tmp));
|
||||
}
|
||||
}
|
||||
@@ -761,12 +745,12 @@ public:
|
||||
difference_type n = new_begin - begin();
|
||||
if (m < n) {
|
||||
for (; m > 0; --m) {
|
||||
push_front(this_type::move_if_noexcept(back()));
|
||||
push_front(boost::move_if_noexcept(back()));
|
||||
pop_back();
|
||||
}
|
||||
} else {
|
||||
for (; n > 0; --n) {
|
||||
push_back(this_type::move_if_noexcept(front()));
|
||||
push_back(boost::move_if_noexcept(front()));
|
||||
pop_front();
|
||||
}
|
||||
}
|
||||
@@ -1416,11 +1400,11 @@ public:
|
||||
*/
|
||||
void swap(circular_buffer<T, Alloc>& cb) BOOST_NOEXCEPT {
|
||||
swap_allocator(cb, is_stateless<allocator_type>());
|
||||
std::swap(m_buff, cb.m_buff);
|
||||
std::swap(m_end, cb.m_end);
|
||||
std::swap(m_first, cb.m_first);
|
||||
std::swap(m_last, cb.m_last);
|
||||
std::swap(m_size, cb.m_size);
|
||||
adl_move_swap(m_buff, cb.m_buff);
|
||||
adl_move_swap(m_end, cb.m_end);
|
||||
adl_move_swap(m_first, cb.m_first);
|
||||
adl_move_swap(m_last, cb.m_last);
|
||||
adl_move_swap(m_size, cb.m_size);
|
||||
#if BOOST_CB_ENABLE_DEBUG
|
||||
invalidate_all_iterators();
|
||||
cb.invalidate_all_iterators();
|
||||
@@ -1438,7 +1422,7 @@ private:
|
||||
increment(m_last);
|
||||
m_first = m_last;
|
||||
} else {
|
||||
boost::container::allocator_traits<Alloc>::construct(m_alloc, boost::addressof(*m_last), static_cast<ValT>(item));
|
||||
boost::container::allocator_traits<Alloc>::construct(m_alloc, cb_details::to_address(m_last), static_cast<ValT>(item));
|
||||
increment(m_last);
|
||||
++m_size;
|
||||
}
|
||||
@@ -1455,7 +1439,7 @@ private:
|
||||
m_last = m_first;
|
||||
} else {
|
||||
decrement(m_first);
|
||||
boost::container::allocator_traits<Alloc>::construct(m_alloc, boost::addressof(*m_first), static_cast<ValT>(item));
|
||||
boost::container::allocator_traits<Alloc>::construct(m_alloc, cb_details::to_address(m_first), static_cast<ValT>(item));
|
||||
++m_size;
|
||||
}
|
||||
} BOOST_CATCH(...) {
|
||||
@@ -1878,7 +1862,7 @@ private:
|
||||
bool construct = !full();
|
||||
BOOST_TRY {
|
||||
while (src != pos.m_it) {
|
||||
construct_or_replace(construct, dest, this_type::move_if_noexcept(*src));
|
||||
construct_or_replace(construct, dest, boost::move_if_noexcept(*src));
|
||||
increment(src);
|
||||
increment(dest);
|
||||
construct = false;
|
||||
@@ -2125,7 +2109,7 @@ public:
|
||||
pointer next = pos.m_it;
|
||||
increment(next);
|
||||
for (pointer p = pos.m_it; next != m_last; p = next, increment(next))
|
||||
replace(p, this_type::move_if_noexcept(*next));
|
||||
replace(p, boost::move_if_noexcept(*next));
|
||||
decrement(m_last);
|
||||
destroy_item(m_last);
|
||||
--m_size;
|
||||
@@ -2164,7 +2148,7 @@ public:
|
||||
return first;
|
||||
pointer p = first.m_it;
|
||||
while (last.m_it != 0)
|
||||
replace((first++).m_it, this_type::move_if_noexcept(*last++));
|
||||
replace((first++).m_it, boost::move_if_noexcept(*last++));
|
||||
do {
|
||||
decrement(m_last);
|
||||
destroy_item(m_last);
|
||||
@@ -2202,7 +2186,7 @@ public:
|
||||
pointer prev = pos.m_it;
|
||||
pointer p = prev;
|
||||
for (decrement(prev); p != m_first; p = prev, decrement(prev))
|
||||
replace(p, this_type::move_if_noexcept(*prev));
|
||||
replace(p, boost::move_if_noexcept(*prev));
|
||||
destroy_item(m_first);
|
||||
increment(m_first);
|
||||
--m_size;
|
||||
@@ -2247,7 +2231,7 @@ public:
|
||||
while (first.m_it != m_first) {
|
||||
decrement(first.m_it);
|
||||
decrement(p);
|
||||
replace(p, this_type::move_if_noexcept(*first.m_it));
|
||||
replace(p, boost::move_if_noexcept(*first.m_it));
|
||||
}
|
||||
do {
|
||||
destroy_item(m_first);
|
||||
@@ -2430,7 +2414,7 @@ private:
|
||||
*/
|
||||
void construct_or_replace(bool construct, pointer pos, param_value_type item) {
|
||||
if (construct)
|
||||
boost::container::allocator_traits<Alloc>::construct(m_alloc, boost::addressof(*pos), item);
|
||||
boost::container::allocator_traits<Alloc>::construct(m_alloc, cb_details::to_address(pos), item);
|
||||
else
|
||||
replace(pos, item);
|
||||
}
|
||||
@@ -2442,14 +2426,14 @@ private:
|
||||
*/
|
||||
void construct_or_replace(bool construct, pointer pos, rvalue_type item) {
|
||||
if (construct)
|
||||
boost::container::allocator_traits<Alloc>::construct(m_alloc, boost::addressof(*pos), boost::move(item));
|
||||
boost::container::allocator_traits<Alloc>::construct(m_alloc, cb_details::to_address(pos), boost::move(item));
|
||||
else
|
||||
replace(pos, boost::move(item));
|
||||
}
|
||||
|
||||
//! Destroy an item.
|
||||
void destroy_item(pointer p) {
|
||||
boost::container::allocator_traits<Alloc>::destroy(m_alloc, boost::addressof(*p));
|
||||
boost::container::allocator_traits<Alloc>::destroy(m_alloc, cb_details::to_address(p));
|
||||
#if BOOST_CB_ENABLE_DEBUG
|
||||
invalidate_iterators(iterator(this, p));
|
||||
cb_details::do_fill_uninitialized_memory(p, sizeof(value_type));
|
||||
@@ -2582,7 +2566,7 @@ private:
|
||||
if (buffer_capacity == 0)
|
||||
return;
|
||||
while (first != last && !full()) {
|
||||
boost::container::allocator_traits<Alloc>::construct(m_alloc, boost::addressof(*m_last), *first++);
|
||||
boost::container::allocator_traits<Alloc>::construct(m_alloc, cb_details::to_address(m_last), *first++);
|
||||
increment(m_last);
|
||||
++m_size;
|
||||
}
|
||||
@@ -2644,7 +2628,7 @@ private:
|
||||
|
||||
//! Specialized method for swapping the allocator.
|
||||
void swap_allocator(circular_buffer<T, Alloc>& cb, const false_type&) {
|
||||
std::swap(m_alloc, cb.m_alloc);
|
||||
adl_move_swap(m_alloc, cb.m_alloc);
|
||||
}
|
||||
|
||||
//! Specialized assign method.
|
||||
@@ -2771,7 +2755,7 @@ private:
|
||||
BOOST_TRY {
|
||||
while (src != p) {
|
||||
decrement(src);
|
||||
construct_or_replace(construct, dest, this_type::move_if_noexcept(*src));
|
||||
construct_or_replace(construct, dest, boost::move_if_noexcept(*src));
|
||||
decrement(dest);
|
||||
construct = false;
|
||||
}
|
||||
@@ -2847,7 +2831,7 @@ private:
|
||||
pointer p = m_last;
|
||||
BOOST_TRY {
|
||||
for (; ii < construct; ++ii, increment(p))
|
||||
boost::container::allocator_traits<Alloc>::construct(m_alloc, boost::addressof(*p), *wrapper());
|
||||
boost::container::allocator_traits<Alloc>::construct(m_alloc, cb_details::to_address(p), *wrapper());
|
||||
for (;ii < n; ++ii, increment(p))
|
||||
replace(p, *wrapper());
|
||||
} BOOST_CATCH(...) {
|
||||
@@ -2941,7 +2925,7 @@ private:
|
||||
for (;ii > construct; --ii, increment(p))
|
||||
replace(p, *wrapper());
|
||||
for (; ii > 0; --ii, increment(p))
|
||||
boost::container::allocator_traits<Alloc>::construct(m_alloc, boost::addressof(*p), *wrapper());
|
||||
boost::container::allocator_traits<Alloc>::construct(m_alloc, cb_details::to_address(p), *wrapper());
|
||||
} BOOST_CATCH(...) {
|
||||
size_type constructed = ii < construct ? construct - ii : 0;
|
||||
m_last = add(m_last, constructed);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Helper classes and functions for the circular buffer.
|
||||
|
||||
// Copyright (c) 2003-2008 Jan Gaspar
|
||||
// Copyright (c) 2014 Glen Fernandes // C++11 allocator model support.
|
||||
// Copyright (c) 2014 Glen Joseph Fernandes // C++11 allocator model support.
|
||||
|
||||
// Use, modification, and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -14,9 +14,9 @@
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/iterator.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
#include <boost/container/allocator_traits.hpp>
|
||||
#include <boost/core/pointer_traits.hpp>
|
||||
#include <boost/move/move.hpp>
|
||||
#include <boost/type_traits/is_nothrow_move_constructible.hpp>
|
||||
#include <boost/utility/addressof.hpp>
|
||||
@@ -35,6 +35,13 @@ namespace boost {
|
||||
|
||||
namespace cb_details {
|
||||
|
||||
template<class Pointer>
|
||||
inline typename boost::pointer_traits<Pointer>::element_type*
|
||||
to_address(Pointer p) BOOST_NOEXCEPT
|
||||
{
|
||||
return boost::pointer_traits<Pointer>::to_address(p);
|
||||
}
|
||||
|
||||
template <class Traits> struct nonconst_traits;
|
||||
|
||||
template<class ForwardIterator, class Diff, class T, class Alloc>
|
||||
@@ -196,7 +203,7 @@ public:
|
||||
*/
|
||||
template <class Buff, class Traits>
|
||||
struct iterator :
|
||||
public boost::iterator<
|
||||
public std::iterator<
|
||||
std::random_access_iterator_tag,
|
||||
typename Traits::value_type,
|
||||
typename Traits::difference_type,
|
||||
@@ -209,7 +216,7 @@ struct iterator :
|
||||
// Helper types
|
||||
|
||||
//! Base iterator.
|
||||
typedef boost::iterator<
|
||||
typedef std::iterator<
|
||||
std::random_access_iterator_tag,
|
||||
typename Traits::value_type,
|
||||
typename Traits::difference_type,
|
||||
@@ -436,10 +443,10 @@ inline ForwardIterator uninitialized_copy(InputIterator first, InputIterator las
|
||||
ForwardIterator next = dest;
|
||||
BOOST_TRY {
|
||||
for (; first != last; ++first, ++dest)
|
||||
boost::container::allocator_traits<Alloc>::construct(a, boost::addressof(*dest), *first);
|
||||
boost::container::allocator_traits<Alloc>::construct(a, cb_details::to_address(dest), *first);
|
||||
} BOOST_CATCH(...) {
|
||||
for (; next != dest; ++next)
|
||||
boost::container::allocator_traits<Alloc>::destroy(a, boost::addressof(*next));
|
||||
boost::container::allocator_traits<Alloc>::destroy(a, cb_details::to_address(next));
|
||||
BOOST_RETHROW
|
||||
}
|
||||
BOOST_CATCH_END
|
||||
@@ -450,7 +457,7 @@ template<class InputIterator, class ForwardIterator, class Alloc>
|
||||
ForwardIterator uninitialized_move_if_noexcept_impl(InputIterator first, InputIterator last, ForwardIterator dest, Alloc& a,
|
||||
true_type) {
|
||||
for (; first != last; ++first, ++dest)
|
||||
boost::container::allocator_traits<Alloc>::construct(a, boost::addressof(*dest), boost::move(*first));
|
||||
boost::container::allocator_traits<Alloc>::construct(a, cb_details::to_address(dest), boost::move(*first));
|
||||
return dest;
|
||||
}
|
||||
|
||||
@@ -479,10 +486,10 @@ inline void uninitialized_fill_n_with_alloc(ForwardIterator first, Diff n, const
|
||||
ForwardIterator next = first;
|
||||
BOOST_TRY {
|
||||
for (; n > 0; ++first, --n)
|
||||
boost::container::allocator_traits<Alloc>::construct(alloc, boost::addressof(*first), item);
|
||||
boost::container::allocator_traits<Alloc>::construct(alloc, cb_details::to_address(first), item);
|
||||
} BOOST_CATCH(...) {
|
||||
for (; next != first; ++next)
|
||||
boost::container::allocator_traits<Alloc>::destroy(alloc, boost::addressof(*next));
|
||||
boost::container::allocator_traits<Alloc>::destroy(alloc, cb_details::to_address(next));
|
||||
BOOST_RETHROW
|
||||
}
|
||||
BOOST_CATCH_END
|
||||
|
||||
@@ -740,7 +740,7 @@ public:
|
||||
\par Iterator Invalidation
|
||||
Invalidates all iterators of both <code>circular_buffer_space_optimized</code> containers. (On the other
|
||||
hand the iterators still point to the same elements but within another container. If you want to rely on
|
||||
this feature you have to turn the __debug_support off by defining macro BOOST_CB_DISABLE_DEBUG,
|
||||
this feature you have to turn the __debug_support off,
|
||||
otherwise an assertion will report an error if such invalidated iterator is used.)
|
||||
\par Complexity
|
||||
Constant (in the size of the <code>circular_buffer_space_optimized</code>).
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#if !defined(BOOST_CIRCULAR_BUFFER_FWD_HPP)
|
||||
#define BOOST_CIRCULAR_BUFFER_FWD_HPP
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1200
|
||||
#if defined(_MSC_VER)
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
|
||||
14
meta/libraries.json
Normal file
14
meta/libraries.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"key": "circular_buffer",
|
||||
"name": "Circular Buffer",
|
||||
"authors": [
|
||||
"Jan Gaspar"
|
||||
],
|
||||
"description": "A STL compliant container also known as ring or cyclic buffer.",
|
||||
"category": [
|
||||
"Containers"
|
||||
],
|
||||
"maintainers": [
|
||||
"Jan Gaspar <jano_gaspar -at- yahoo.com>"
|
||||
]
|
||||
}
|
||||
@@ -6,7 +6,7 @@
|
||||
# accompanying file LICENSE_1_0.txt or copy at
|
||||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
# Added warning supression Paul A. Bristow 25 Nov 2008
|
||||
# Added warning suppression Paul A. Bristow 25 Nov 2008
|
||||
|
||||
# Bring in rules for testing.
|
||||
import testing ;
|
||||
@@ -22,9 +22,11 @@ project
|
||||
;
|
||||
|
||||
test-suite "circular_buffer"
|
||||
: [ run base_test.cpp : <threading>single : ]
|
||||
[ run space_optimized_test.cpp : <threading>single : ]
|
||||
[ run soft_iterator_invalidation.cpp : <threading>single : ]
|
||||
[ run constant_erase_test.cpp : <threading>single : ]
|
||||
: [ run base_test.cpp : : : <threading>single : ]
|
||||
[ run space_optimized_test.cpp : : : <threading>single : ]
|
||||
[ run base_test.cpp : : : <threading>single <define>"BOOST_CB_ENABLE_DEBUG=1" : base_test_dbg ]
|
||||
[ run space_optimized_test.cpp : : : <threading>single <define>"BOOST_CB_ENABLE_DEBUG=1" : space_optimized_test_dbg ]
|
||||
[ run soft_iterator_invalidation.cpp : : : <threading>single : ]
|
||||
[ run constant_erase_test.cpp : : : <threading>single : ]
|
||||
[ compile bounded_buffer_comparison.cpp : <threading>multi : ]
|
||||
;
|
||||
|
||||
@@ -193,7 +193,7 @@ void iterator_comparison_test() {
|
||||
|
||||
void iterator_invalidation_test() {
|
||||
|
||||
#if !defined(NDEBUG) && !defined(BOOST_CB_DISABLE_DEBUG)
|
||||
#if BOOST_CB_ENABLE_DEBUG
|
||||
|
||||
circular_buffer<MyInteger>::iterator it1;
|
||||
circular_buffer<MyInteger>::const_iterator it2;
|
||||
@@ -563,7 +563,7 @@ void iterator_invalidation_test() {
|
||||
BOOST_CHECK(it3.is_valid(&cb16));
|
||||
BOOST_CHECK(!it4.is_valid(&cb16));
|
||||
|
||||
#endif // #if !defined(NDEBUG) && !defined(BOOST_CB_DISABLE_DEBUG)
|
||||
#endif // #if BOOST_CB_ENABLE_DEBUG
|
||||
}
|
||||
|
||||
// basic exception safety test (it is useful to use any memory-leak detection tool)
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#define BOOST_CB_DISABLE_DEBUG
|
||||
|
||||
#include <boost/circular_buffer.hpp>
|
||||
#include <boost/thread/mutex.hpp>
|
||||
#include <boost/thread/condition_variable.hpp>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
// Copyright (c) 2003-2008 Jan Gaspar
|
||||
// Copyright (c) 2013 Antony Polukhin
|
||||
// Copyright (c) 2014 Glen Fernandes // C++11 allocator model support.
|
||||
// Copyright (c) 2014 Glen Joseph Fernandes // C++11 allocator model support.
|
||||
|
||||
// Use, modification, and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -186,6 +186,7 @@ private:
|
||||
pointer_ operator++(int) { pointer_ p = *this; ++hidden_ptr_; return p; }
|
||||
pointer_ operator--(int) { pointer_ p = *this; --hidden_ptr_; return p; }
|
||||
U& operator*() const { return *hidden_ptr_; }
|
||||
U* operator->() const { return hidden_ptr_; }
|
||||
|
||||
U* hidden_ptr_;
|
||||
};
|
||||
@@ -2113,7 +2114,6 @@ void move_container_on_cpp11() {
|
||||
|
||||
|
||||
struct noncopyable_movable_except_t
|
||||
: private boost::noncopyable // required, until there will be no support for is_copy_constructible added to Boost.Move
|
||||
{
|
||||
private:
|
||||
BOOST_MOVABLE_BUT_NOT_COPYABLE(noncopyable_movable_except_t)
|
||||
@@ -2152,7 +2152,6 @@ public:
|
||||
};
|
||||
|
||||
struct noncopyable_movable_noexcept_t
|
||||
: private boost::noncopyable // required, until there will be no support for is_copy_constructible added to Boost.Move
|
||||
{
|
||||
private:
|
||||
BOOST_MOVABLE_BUT_NOT_COPYABLE(noncopyable_movable_noexcept_t)
|
||||
|
||||
@@ -6,8 +6,6 @@
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#define BOOST_CB_DISABLE_DEBUG
|
||||
|
||||
#include "test.hpp"
|
||||
|
||||
int MyInteger::ms_exception_trigger = 0;
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#define BOOST_CB_DISABLE_DEBUG
|
||||
|
||||
#include "test.hpp"
|
||||
|
||||
// test of the example (introduced in the documentation)
|
||||
|
||||
@@ -125,7 +125,7 @@ void shrink_to_fit_test() {
|
||||
|
||||
void iterator_invalidation_test() {
|
||||
|
||||
#if !defined(NDEBUG) && !defined(BOOST_CB_DISABLE_DEBUG)
|
||||
#if BOOST_CB_ENABLE_DEBUG
|
||||
|
||||
cb_space_optimized cb1(10, 1);
|
||||
cb1.push_back(2);
|
||||
@@ -177,7 +177,7 @@ void iterator_invalidation_test() {
|
||||
BOOST_CHECK(!it2.is_valid(&cb1));
|
||||
BOOST_CHECK(!it3.is_valid(&cb1));
|
||||
|
||||
#endif // #if !defined(NDEBUG) && !defined(BOOST_CB_DISABLE_DEBUG)
|
||||
#endif // #if BOOST_CB_ENABLE_DEBUG
|
||||
}
|
||||
|
||||
// test main
|
||||
|
||||
Reference in New Issue
Block a user