#endif
#include <boost/type_traits/is_same.hpp>
-#include <boost/detail/workaround.hpp>
+#include <boost/config/workaround.hpp>
namespace boost {
/*!
\pre Valid range <code>[first, last)</code>.<br>
<code>first</code> and <code>last</code> have to meet the requirements of
- <a href="http://www.sgi.com/tech/stl/InputIterator.html">InputIterator</a>.
+ <a href="https://www.boost.org/sgi/stl/InputIterator.html">InputIterator</a>.
\post <code>capacity().%capacity() == std::distance(first, last) \&\& capacity().min_capacity() == 0 \&\&
full() \&\& (*this)[0]== *first \&\& (*this)[1] == *(first + 1) \&\& ... \&\&
(*this)[std::distance(first, last) - 1] == *(last - 1)</code><br><br>
of allocated memory) filled with a copy of the range.
\pre Valid range <code>[first, last)</code>.<br>
<code>first</code> and <code>last</code> have to meet the requirements of
- <a href="http://www.sgi.com/tech/stl/InputIterator.html">InputIterator</a>.
+ <a href="https://www.boost.org/sgi/stl/InputIterator.html">InputIterator</a>.
\post <code>capacity() == capacity_ctrl \&\& size() \<= std::distance(first, last) \&\& (*this)[0]==
*(last - capacity_ctrl.%capacity()) \&\& (*this)[1] == *(last - capacity_ctrl.%capacity() + 1) \&\& ...
\&\& (*this)[capacity_ctrl.%capacity() - 1] == *(last - 1)</code><br><br>
\par Complexity
Linear (in <code>std::distance(first, last)</code>; in
<code>min[capacity_ctrl.%capacity(), std::distance(first, last)]</code> if the <code>InputIterator</code>
- is a <a href="http://www.sgi.com/tech/stl/RandomAccessIterator.html">RandomAccessIterator</a>).
+ is a <a href="https://www.boost.org/sgi/stl/RandomAccessIterator.html">RandomAccessIterator</a>).
*/
template <class InputIterator>
circular_buffer_space_optimized(capacity_type capacity_ctrl, InputIterator first, InputIterator last,
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 std::iterator_traits<InputIterator>::iterator_category, std::input_iterator_tag >());
}
#if defined(BOOST_CB_NEVER_DEFINED)
*/
circular_buffer_space_optimized<T, Alloc>& operator = (circular_buffer_space_optimized<T, Alloc>&& cb) BOOST_NOEXCEPT {
cb.swap(*this); // now `this` holds `cb`
- circular_buffer<T, Alloc>(get_allocator()) // temprary that holds initial `cb` allocator
+ circular_buffer<T, Alloc>(get_allocator()) // temporary that holds initial `cb` allocator
.swap(cb); // makes `cb` empty
return *this;
}
elements from the specified range.
\pre Valid range <code>[first, last)</code>.<br>
<code>first</code> and <code>last</code> have to meet the requirements of
- <a href="http://www.sgi.com/tech/stl/InputIterator.html">InputIterator</a>.
+ <a href="https://www.boost.org/sgi/stl/InputIterator.html">InputIterator</a>.
\post <code>capacity().%capacity() == std::distance(first, last) \&\& capacity().min_capacity() == 0 \&\&
size() == std::distance(first, last) \&\& (*this)[0]== *first \&\& (*this)[1] == *(first + 1) \&\& ...
\&\& (*this)[std::distance(first, last) - 1] == *(last - 1)</code><br><br>
elements from the specified range.
\pre Valid range <code>[first, last)</code>.<br>
<code>first</code> and <code>last</code> have to meet the requirements of
- <a href="http://www.sgi.com/tech/stl/InputIterator.html">InputIterator</a>.
+ <a href="https://www.boost.org/sgi/stl/InputIterator.html">InputIterator</a>.
\post <code>capacity() == capacity_ctrl \&\& size() \<= std::distance(first, last) \&\&
(*this)[0]== *(last - capacity) \&\& (*this)[1] == *(last - capacity + 1) \&\& ... \&\&
(*this)[capacity - 1] == *(last - 1)</code><br><br>
\par Complexity
Linear (in <code>std::distance(first, last)</code>; in
<code>min[capacity_ctrl.%capacity(), std::distance(first, last)]</code> if the <code>InputIterator</code>
- is a <a href="http://www.sgi.com/tech/stl/RandomAccessIterator.html">RandomAccessIterator</a>).
+ is a <a href="https://www.boost.org/sgi/stl/RandomAccessIterator.html">RandomAccessIterator</a>).
\sa <code>\link operator=(const circular_buffer_space_optimized&) operator=\endlink</code>,
<code>\link assign(size_type, param_value_type) assign(size_type, const_reference)\endlink</code>,
<code>\link assign(capacity_type, size_type, param_value_type)
/*!
\pre <code>pos</code> is a valid iterator pointing to the <code>circular_buffer_space_optimized</code> or its
end.<br>Valid range <code>[first, last)</code> where <code>first</code> and <code>last</code> meet the
- requirements of an <a href="http://www.sgi.com/tech/stl/InputIterator.html">InputIterator</a>.
+ requirements of an <a href="https://www.boost.org/sgi/stl/InputIterator.html">InputIterator</a>.
\post Elements from the range
<code>[first + max[0, distance(first, last) - (pos - begin()) - reserve()], last)</code> will be
inserted at the position <code>pos</code>.<br>The number of <code>min[pos - begin(), max[0,
Linear (in <code>[size() + std::distance(first, last)]</code>; in
<code>min[capacity().%capacity(), size() + std::distance(first, last)]</code> if the
<code>InputIterator</code> is a
- <a href="http://www.sgi.com/tech/stl/RandomAccessIterator.html">RandomAccessIterator</a>).
+ <a href="https://www.boost.org/sgi/stl/RandomAccessIterator.html">RandomAccessIterator</a>).
\par Example
Consider a <code>circular_buffer_space_optimized</code> with the capacity of 6 and the size of 4. Its
internal buffer may look like the one below.<br><br>
\pre <code>pos</code> is a valid iterator pointing to the <code>circular_buffer_space_optimized</code> or its
end.<br>
Valid range <code>[first, last)</code> where <code>first</code> and <code>last</code> meet the
- requirements of an <a href="http://www.sgi.com/tech/stl/InputIterator.html">InputIterator</a>.
+ requirements of an <a href="https://www.boost.org/sgi/stl/InputIterator.html">InputIterator</a>.
\post Elements from the range
<code>[first, last - max[0, distance(first, last) - (end() - pos) - reserve()])</code> will be inserted
before the position <code>pos</code>.<br>The number of <code>min[end() - pos, max[0,
Linear (in <code>[size() + std::distance(first, last)]</code>; in
<code>min[capacity().%capacity(), size() + std::distance(first, last)]</code> if the
<code>InputIterator</code> is a
- <a href="http://www.sgi.com/tech/stl/RandomAccessIterator.html">RandomAccessIterator</a>).
+ <a href="https://www.boost.org/sgi/stl/RandomAccessIterator.html">RandomAccessIterator</a>).
\par Example
Consider a <code>circular_buffer_space_optimized</code> with the capacity of 6 and the size of 4. Its
internal buffer may look like the one below.<br><br>
private:
// Helper methods
- //! Adjust the amount of allocated memory.
+ /*! INTERNAL ONLY */
void adjust_min_capacity() {
if (m_capacity_ctrl.min_capacity() > circular_buffer<T, Alloc>::capacity())
circular_buffer<T, Alloc>::set_capacity(m_capacity_ctrl.min_capacity());
check_high_capacity();
}
- //! Ensure the reserve for possible growth up.
+ /*! INTERNAL ONLY */
size_type ensure_reserve(size_type new_capacity, size_type buffer_size) const {
if (buffer_size + new_capacity / 5 >= new_capacity)
new_capacity *= 2; // ensure at least 20% reserve
return new_capacity;
}
- //! Check for low capacity.
- /*
- \post If the capacity is low it will be increased.
- */
+ /*! INTERNAL ONLY */
void check_low_capacity(size_type n = 1) {
size_type new_size = size() + n;
size_type new_capacity = circular_buffer<T, Alloc>::capacity();
#endif
}
- //! Check for high capacity.
- /*
- \post If the capacity is high it will be decreased.
- */
+ /*! INTERNAL ONLY */
void check_high_capacity() {
size_type new_capacity = circular_buffer<T, Alloc>::capacity();
while (new_capacity / 3 >= size()) { // (new_capacity / 3) -> avoid oscillations
#endif
}
- //! Specialized method for reducing the capacity.
+ /*! INTERNAL ONLY */
void reduce_capacity(const true_type&) {
circular_buffer<T, Alloc>::set_capacity((std::max)(m_capacity_ctrl.min_capacity(), size()));
}
- //! Specialized method for reducing the capacity.
+ /*! INTERNAL ONLY */
void reduce_capacity(const false_type&) {}
- //! Determine the initial capacity.
+ /*! INTERNAL ONLY */
static size_type init_capacity(const capacity_type& capacity_ctrl, size_type n) {
BOOST_CB_ASSERT(capacity_ctrl.capacity() >= n); // check for capacity lower than n
return (std::max)(capacity_ctrl.min_capacity(), n);
}
- //! Specialized method for determining the initial capacity.
+ /*! INTERNAL ONLY */
template <class IntegralType>
static size_type init_capacity(const capacity_type& capacity_ctrl, IntegralType n, IntegralType,
const true_type&) {
return init_capacity(capacity_ctrl, static_cast<size_type>(n));
}
- //! Specialized method for determining the initial capacity.
+ /*! INTERNAL ONLY */
template <class Iterator>
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
#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, std::iterator_traits<Iterator>::iterator_category());
#else
return init_capacity(
- capacity_ctrl, first, last, BOOST_DEDUCED_TYPENAME iterator_category<Iterator>::type());
+ capacity_ctrl, first, last, BOOST_DEDUCED_TYPENAME std::iterator_traits<Iterator>::iterator_category());
#endif
}
- //! Specialized method for determining the initial capacity.
+ /*! INTERNAL ONLY */
template <class InputIterator>
static size_type init_capacity(const capacity_type& capacity_ctrl, InputIterator, InputIterator,
const std::input_iterator_tag&) {
return capacity_ctrl.capacity();
}
- //! Specialized method for determining the initial capacity.
+ /*! INTERNAL ONLY */
template <class ForwardIterator>
static size_type init_capacity(const capacity_type& capacity_ctrl, ForwardIterator first, ForwardIterator last,
const std::forward_iterator_tag&) {
(std::min)(capacity_ctrl.capacity(), static_cast<size_type>(std::distance(first, last))));
}
- //! Specialized insert method.
+ /*! INTERNAL ONLY */
template <class IntegralType>
void insert(const iterator& pos, IntegralType n, IntegralType item, const true_type&) {
insert(pos, static_cast<size_type>(n), static_cast<value_type>(item));
}
- //! Specialized insert method.
+ /*! INTERNAL ONLY */
template <class Iterator>
void insert(const iterator& pos, Iterator first, Iterator last, const false_type&) {
size_type index = pos - begin();
circular_buffer<T, Alloc>::insert(begin() + index, first, last);
}
- //! Specialized rinsert method.
+ /*! INTERNAL ONLY */
template <class IntegralType>
void rinsert(const iterator& pos, IntegralType n, IntegralType item, const true_type&) {
rinsert(pos, static_cast<size_type>(n), static_cast<value_type>(item));
}
- //! Specialized rinsert method.
+ /*! INTERNAL ONLY */
template <class Iterator>
void rinsert(const iterator& pos, Iterator first, Iterator last, const false_type&) {
size_type index = pos - begin();