mirror of
https://github.com/boostorg/circular_buffer.git
synced 2026-02-03 09:02:12 +00:00
Compare commits
25 Commits
20131209-d
...
svn-branch
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b4a767b6cf | ||
|
|
aca434d344 | ||
|
|
90711fb1fe | ||
|
|
6eb5fd4a3d | ||
|
|
6998f28fda | ||
|
|
ed237fa058 | ||
|
|
2bd298dec7 | ||
|
|
65810242ee | ||
|
|
0282b8ee74 | ||
|
|
cde2abac0c | ||
|
|
f2247e1b9b | ||
|
|
d532095822 | ||
|
|
5f566ba7bc | ||
|
|
5aa54f6045 | ||
|
|
8377fd145e | ||
|
|
92c290536e | ||
|
|
8a115a066a | ||
|
|
491fd3d0ff | ||
|
|
6647c9d40f | ||
|
|
fb1828e57a | ||
|
|
c3fcf1a048 | ||
|
|
683ca2a581 | ||
|
|
3ae88fcec8 | ||
|
|
cf49e405d9 | ||
|
|
ee98eb933a |
@@ -307,7 +307,7 @@ This leads us to the following situation:
|
||||
* If `value` has a throwing move constructor and some copy constructor, then method may throw exceptions of copy constructor.
|
||||
* If `value` has no copy constructor, then method may throw exceptions of move constructor.
|
||||
|
||||
`move_if_noexcept(T&)` uses [@boost:libs/move/doc/html/move.html Boost.Move], [@boost:libs/type_traits/doc/html/boost_typetraits/reference/is_copy_constructible.html `is_copy_constructible`], [@boost:libs/type_traits/doc/html/boost_typetraits/reference/is_nothrow_move_assignable.html `is_nothrow_move_assignable`] and [@boost:libs/type_traits/doc/html/boost_typetraits/reference/is_nothrow_move_constructible.html `is_nothrow_move_constructible`] type triats.
|
||||
`move_if_noexcept(T&)` uses [@boost:libs/move/index.html Boost.Move], [@boost:libs/type_traits/doc/html/boost_typetraits/reference/is_copy_constructible.html `is_copy_constructible`], [@boost:libs/type_traits/doc/html/boost_typetraits/reference/is_nothrow_move_assignable.html `is_nothrow_move_assignable`] and [@boost:libs/type_traits/doc/html/boost_typetraits/reference/is_nothrow_move_constructible.html `is_nothrow_move_constructible`] type triats.
|
||||
|
||||
|
||||
[h3 Caveats]
|
||||
|
||||
@@ -11,13 +11,12 @@
|
||||
#if !defined(BOOST_CIRCULAR_BUFFER_HPP)
|
||||
#define BOOST_CIRCULAR_BUFFER_HPP
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1200
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/circular_buffer_fwd.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
// BOOST_CB_ENABLE_DEBUG: Debug support control.
|
||||
#if defined(NDEBUG) || defined(BOOST_CB_DISABLE_DEBUG)
|
||||
@@ -34,20 +33,29 @@
|
||||
#define BOOST_CB_ASSERT(Expr) ((void)0)
|
||||
#endif
|
||||
|
||||
// BOOST_CB_STATIC_ASSERT: Compile time assertion.
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||
#define BOOST_CB_STATIC_ASSERT(Expr) ((void)0)
|
||||
#else
|
||||
#include <boost/static_assert.hpp>
|
||||
#define BOOST_CB_STATIC_ASSERT(Expr) BOOST_STATIC_ASSERT(Expr)
|
||||
#endif
|
||||
|
||||
// BOOST_CB_IS_CONVERTIBLE: Check if Iterator::value_type is convertible to Type.
|
||||
#if BOOST_WORKAROUND(__BORLANDC__, <= 0x0550) || BOOST_WORKAROUND(__MWERKS__, <= 0x2407)
|
||||
#if BOOST_WORKAROUND(__BORLANDC__, <= 0x0550) || BOOST_WORKAROUND(__MWERKS__, <= 0x2407) || \
|
||||
BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||
#define BOOST_CB_IS_CONVERTIBLE(Iterator, Type) ((void)0)
|
||||
#else
|
||||
#include <boost/detail/iterator.hpp>
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
#define BOOST_CB_IS_CONVERTIBLE(Iterator, Type) \
|
||||
BOOST_STATIC_ASSERT((is_convertible<typename detail::iterator_traits<Iterator>::value_type, Type>::value))
|
||||
BOOST_CB_STATIC_ASSERT((is_convertible<typename detail::iterator_traits<Iterator>::value_type, Type>::value))
|
||||
#endif
|
||||
|
||||
// BOOST_CB_ASSERT_TEMPLATED_ITERATOR_CONSTRUCTORS:
|
||||
// Check if the STL provides templated iterator constructors for its containers.
|
||||
#if defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS)
|
||||
#define BOOST_CB_ASSERT_TEMPLATED_ITERATOR_CONSTRUCTORS BOOST_STATIC_ASSERT(false);
|
||||
#define BOOST_CB_ASSERT_TEMPLATED_ITERATOR_CONSTRUCTORS BOOST_CB_STATIC_ASSERT(false);
|
||||
#else
|
||||
#define BOOST_CB_ASSERT_TEMPLATED_ITERATOR_CONSTRUCTORS ((void)0);
|
||||
#endif
|
||||
@@ -59,6 +67,7 @@
|
||||
|
||||
#undef BOOST_CB_ASSERT_TEMPLATED_ITERATOR_CONSTRUCTORS
|
||||
#undef BOOST_CB_IS_CONVERTIBLE
|
||||
#undef BOOST_CB_STATIC_ASSERT
|
||||
#undef BOOST_CB_ASSERT
|
||||
#undef BOOST_CB_ENABLE_DEBUG
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#if !defined(BOOST_CIRCULAR_BUFFER_BASE_HPP)
|
||||
#define BOOST_CIRCULAR_BUFFER_BASE_HPP
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1200
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
@@ -1150,6 +1150,25 @@ public:
|
||||
}
|
||||
#endif // BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||
|
||||
/*! \cond */
|
||||
template <class InputIterator>
|
||||
circular_buffer(InputIterator first, InputIterator last)
|
||||
: m_alloc(allocator_type()) {
|
||||
initialize(first, last, is_integral<InputIterator>());
|
||||
}
|
||||
|
||||
template <class InputIterator>
|
||||
circular_buffer(capacity_type capacity, InputIterator first, InputIterator last)
|
||||
: m_alloc(allocator_type()) {
|
||||
initialize(capacity, first, last, is_integral<InputIterator>());
|
||||
}
|
||||
/*! \endcond */
|
||||
|
||||
#else
|
||||
|
||||
//! Create a full <code>circular_buffer</code> filled with a copy of the range.
|
||||
/*!
|
||||
\pre Valid range <code>[first, last)</code>.<br>
|
||||
@@ -1202,6 +1221,8 @@ public:
|
||||
initialize(buffer_capacity, first, last, is_integral<InputIterator>());
|
||||
}
|
||||
|
||||
#endif // #if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||
|
||||
//! The destructor.
|
||||
/*!
|
||||
Destroys the <code>circular_buffer</code>.
|
||||
@@ -2533,9 +2554,9 @@ private:
|
||||
void initialize(Iterator first, Iterator last, const false_type&) {
|
||||
BOOST_CB_IS_CONVERTIBLE(Iterator, value_type); // check for invalid iterator type
|
||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x581))
|
||||
initialize(first, last, iterator_category<Iterator>::type());
|
||||
initialize(first, last, BOOST_ITERATOR_CATEGORY<Iterator>::type());
|
||||
#else
|
||||
initialize(first, last, BOOST_DEDUCED_TYPENAME iterator_category<Iterator>::type());
|
||||
initialize(first, last, BOOST_DEDUCED_TYPENAME BOOST_ITERATOR_CATEGORY<Iterator>::type());
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -2572,9 +2593,9 @@ private:
|
||||
void initialize(capacity_type buffer_capacity, Iterator first, Iterator last, const false_type&) {
|
||||
BOOST_CB_IS_CONVERTIBLE(Iterator, value_type); // check for invalid iterator type
|
||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x581))
|
||||
initialize(buffer_capacity, first, last, iterator_category<Iterator>::type());
|
||||
initialize(buffer_capacity, first, last, BOOST_ITERATOR_CATEGORY<Iterator>::type());
|
||||
#else
|
||||
initialize(buffer_capacity, first, last, BOOST_DEDUCED_TYPENAME iterator_category<Iterator>::type());
|
||||
initialize(buffer_capacity, first, last, BOOST_DEDUCED_TYPENAME BOOST_ITERATOR_CATEGORY<Iterator>::type());
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -2666,9 +2687,9 @@ private:
|
||||
void assign(Iterator first, Iterator last, const false_type&) {
|
||||
BOOST_CB_IS_CONVERTIBLE(Iterator, value_type); // check for invalid iterator type
|
||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x581))
|
||||
assign(first, last, iterator_category<Iterator>::type());
|
||||
assign(first, last, BOOST_ITERATOR_CATEGORY<Iterator>::type());
|
||||
#else
|
||||
assign(first, last, BOOST_DEDUCED_TYPENAME iterator_category<Iterator>::type());
|
||||
assign(first, last, BOOST_DEDUCED_TYPENAME BOOST_ITERATOR_CATEGORY<Iterator>::type());
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -2703,9 +2724,9 @@ private:
|
||||
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
|
||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x581))
|
||||
assign(new_capacity, first, last, iterator_category<Iterator>::type());
|
||||
assign(new_capacity, first, last, BOOST_ITERATOR_CATEGORY<Iterator>::type());
|
||||
#else
|
||||
assign(new_capacity, first, last, BOOST_DEDUCED_TYPENAME iterator_category<Iterator>::type());
|
||||
assign(new_capacity, first, last, BOOST_DEDUCED_TYPENAME BOOST_ITERATOR_CATEGORY<Iterator>::type());
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -2716,7 +2737,12 @@ private:
|
||||
clear();
|
||||
insert(begin(), first, last);
|
||||
} else {
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||
circular_buffer<value_type, allocator_type> tmp(new_capacity, m_alloc);
|
||||
tmp.insert(begin(), first, last);
|
||||
#else
|
||||
circular_buffer<value_type, allocator_type> tmp(new_capacity, first, last, m_alloc);
|
||||
#endif
|
||||
tmp.swap(*this);
|
||||
}
|
||||
}
|
||||
@@ -2812,9 +2838,9 @@ private:
|
||||
void insert(const iterator& pos, Iterator first, Iterator last, const false_type&) {
|
||||
BOOST_CB_IS_CONVERTIBLE(Iterator, value_type); // check for invalid iterator type
|
||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x581))
|
||||
insert(pos, first, last, iterator_category<Iterator>::type());
|
||||
insert(pos, first, last, BOOST_ITERATOR_CATEGORY<Iterator>::type());
|
||||
#else
|
||||
insert(pos, first, last, BOOST_DEDUCED_TYPENAME iterator_category<Iterator>::type());
|
||||
insert(pos, first, last, BOOST_DEDUCED_TYPENAME BOOST_ITERATOR_CATEGORY<Iterator>::type());
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -2903,9 +2929,9 @@ private:
|
||||
void rinsert(const iterator& pos, Iterator first, Iterator last, const false_type&) {
|
||||
BOOST_CB_IS_CONVERTIBLE(Iterator, value_type); // check for invalid iterator type
|
||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x581))
|
||||
rinsert(pos, first, last, iterator_category<Iterator>::type());
|
||||
rinsert(pos, first, last, BOOST_ITERATOR_CATEGORY<Iterator>::type());
|
||||
#else
|
||||
rinsert(pos, first, last, BOOST_DEDUCED_TYPENAME iterator_category<Iterator>::type());
|
||||
rinsert(pos, first, last, BOOST_DEDUCED_TYPENAME BOOST_ITERATOR_CATEGORY<Iterator>::type());
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#if !defined(BOOST_CIRCULAR_BUFFER_DEBUG_HPP)
|
||||
#define BOOST_CIRCULAR_BUFFER_DEBUG_HPP
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1200
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#if !defined(BOOST_CIRCULAR_BUFFER_DETAILS_HPP)
|
||||
#define BOOST_CIRCULAR_BUFFER_DETAILS_HPP
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1200
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#if !defined(BOOST_CIRCULAR_BUFFER_SPACE_OPTIMIZED_HPP)
|
||||
#define BOOST_CIRCULAR_BUFFER_SPACE_OPTIMIZED_HPP
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1200
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
@@ -416,6 +416,31 @@ public:
|
||||
: circular_buffer<T, Alloc>(init_capacity(capacity_ctrl, n), n, item, alloc)
|
||||
, m_capacity_ctrl(capacity_ctrl) {}
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||
|
||||
/*! \cond */
|
||||
circular_buffer_space_optimized(const circular_buffer_space_optimized<T, Alloc>& cb)
|
||||
: circular_buffer<T, Alloc>(cb.begin(), cb.end())
|
||||
, m_capacity_ctrl(cb.m_capacity_ctrl) {}
|
||||
|
||||
template <class InputIterator>
|
||||
circular_buffer_space_optimized(InputIterator first, InputIterator last)
|
||||
: circular_buffer<T, Alloc>(first, last)
|
||||
, m_capacity_ctrl(circular_buffer<T, Alloc>::capacity()) {}
|
||||
|
||||
template <class InputIterator>
|
||||
circular_buffer_space_optimized(capacity_type capacity_ctrl, InputIterator first, InputIterator last)
|
||||
: circular_buffer<T, Alloc>(
|
||||
init_capacity(capacity_ctrl, first, last, is_integral<InputIterator>()),
|
||||
first, last)
|
||||
, m_capacity_ctrl(capacity_ctrl) {
|
||||
reduce_capacity(
|
||||
is_same< BOOST_DEDUCED_TYPENAME BOOST_ITERATOR_CATEGORY<InputIterator>::type, std::input_iterator_tag >());
|
||||
}
|
||||
/*! \endcond */
|
||||
|
||||
#else
|
||||
|
||||
//! The copy constructor.
|
||||
/*!
|
||||
Creates a copy of the specified <code>circular_buffer_space_optimized</code>.
|
||||
@@ -509,9 +534,11 @@ public:
|
||||
first, last, alloc)
|
||||
, m_capacity_ctrl(capacity_ctrl) {
|
||||
reduce_capacity(
|
||||
is_same< BOOST_DEDUCED_TYPENAME iterator_category<InputIterator>::type, std::input_iterator_tag >());
|
||||
is_same< BOOST_DEDUCED_TYPENAME BOOST_ITERATOR_CATEGORY<InputIterator>::type, std::input_iterator_tag >());
|
||||
}
|
||||
|
||||
#endif // #if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||
|
||||
#if defined(BOOST_CB_NEVER_DEFINED)
|
||||
// This section will never be compiled - the default destructor will be generated instead.
|
||||
// Declared only for documentation purpose.
|
||||
@@ -1605,10 +1632,10 @@ private:
|
||||
const false_type&) {
|
||||
BOOST_CB_IS_CONVERTIBLE(Iterator, value_type); // check for invalid iterator type
|
||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x581))
|
||||
return init_capacity(capacity_ctrl, first, last, iterator_category<Iterator>::type());
|
||||
return init_capacity(capacity_ctrl, first, last, BOOST_ITERATOR_CATEGORY<Iterator>::type());
|
||||
#else
|
||||
return init_capacity(
|
||||
capacity_ctrl, first, last, BOOST_DEDUCED_TYPENAME iterator_category<Iterator>::type());
|
||||
capacity_ctrl, first, last, BOOST_DEDUCED_TYPENAME BOOST_ITERATOR_CATEGORY<Iterator>::type());
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#if !defined(BOOST_CIRCULAR_BUFFER_FWD_HPP)
|
||||
#define BOOST_CIRCULAR_BUFFER_FWD_HPP
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1200
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user