forked from boostorg/container
Trailing whitespaces
[SVN r78518]
This commit is contained in:
@@ -66,10 +66,10 @@ struct allocator_traits
|
||||
|
||||
#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
|
||||
//! Alloc::pointer if such a type exists; otherwise, value_type*
|
||||
//!
|
||||
//!
|
||||
typedef unspecified pointer;
|
||||
//! Alloc::const_pointer if such a type exists ; otherwise, pointer_traits<pointer>::rebind<const
|
||||
//!
|
||||
//!
|
||||
typedef unspecified const_pointer;
|
||||
//! Non-standard extension
|
||||
//! Alloc::reference if such a type exists; otherwise, value_type&
|
||||
@@ -78,16 +78,16 @@ struct allocator_traits
|
||||
//! Alloc::const_reference if such a type exists ; otherwise, const value_type&
|
||||
typedef unspecified const_reference;
|
||||
//! Alloc::void_pointer if such a type exists ; otherwise, pointer_traits<pointer>::rebind<void>.
|
||||
//!
|
||||
//!
|
||||
typedef unspecified void_pointer;
|
||||
//! Alloc::const_void_pointer if such a type exists ; otherwis e, pointer_traits<pointer>::rebind<const
|
||||
//!
|
||||
//!
|
||||
typedef unspecified const_void_pointer;
|
||||
//! Alloc::difference_type if such a type exists ; otherwise, pointer_traits<pointer>::difference_type.
|
||||
//!
|
||||
//!
|
||||
typedef unspecified difference_type;
|
||||
//! Alloc::size_type if such a type exists ; otherwise, make_unsigned<difference_type>::type
|
||||
//!
|
||||
//!
|
||||
typedef unspecified size_type;
|
||||
//! Alloc::propagate_on_container_copy_assignment if such a type exists, otherwise an integral_constant
|
||||
//! type with internal constant static member `value` == false.
|
||||
@@ -99,9 +99,9 @@ struct allocator_traits
|
||||
//! type with internal constant static member `value` == false.
|
||||
typedef unspecified propagate_on_container_swap;
|
||||
//! Defines an allocator: Alloc::rebind<T>::other if such a type exists; otherwise, Alloc<T, Args>
|
||||
//! if Alloc is a class template instantiation of the form Alloc<U, Args>, where Args is zero or
|
||||
//! if Alloc is a class template instantiation of the form Alloc<U, Args>, where Args is zero or
|
||||
//! more type arguments ; otherwise, the instantiation of rebind_alloc is ill-formed.
|
||||
//!
|
||||
//!
|
||||
//! In C++03 compilers `rebind_alloc` is a struct derived from an allocator
|
||||
//! deduced by previously detailed rules.
|
||||
template <class T> using rebind_alloc = unspecified;
|
||||
@@ -122,7 +122,7 @@ struct allocator_traits
|
||||
pointer, value_type*)
|
||||
pointer;
|
||||
//const_pointer
|
||||
typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_EVAL_DEFAULT(boost::container::container_detail::, Alloc,
|
||||
typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_EVAL_DEFAULT(boost::container::container_detail::, Alloc,
|
||||
const_pointer, typename boost::intrusive::pointer_traits<pointer>::template
|
||||
rebind_pointer<const value_type>)
|
||||
const_pointer;
|
||||
@@ -131,11 +131,11 @@ struct allocator_traits
|
||||
reference, typename container_detail::unvoid<value_type>::type&)
|
||||
reference;
|
||||
//const_reference
|
||||
typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc,
|
||||
typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc,
|
||||
const_reference, const typename container_detail::unvoid<value_type>::type&)
|
||||
const_reference;
|
||||
//void_pointer
|
||||
typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_EVAL_DEFAULT(boost::container::container_detail::, Alloc,
|
||||
typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_EVAL_DEFAULT(boost::container::container_detail::, Alloc,
|
||||
void_pointer, typename boost::intrusive::pointer_traits<pointer>::template
|
||||
rebind_pointer<void>)
|
||||
void_pointer;
|
||||
@@ -203,12 +203,12 @@ struct allocator_traits
|
||||
#endif //BOOST_CONTAINER_DOXYGEN_INVOKED
|
||||
|
||||
//! <b>Returns</b>: `a.allocate(n)`
|
||||
//!
|
||||
//!
|
||||
static pointer allocate(Alloc &a, size_type n)
|
||||
{ return a.allocate(n); }
|
||||
|
||||
//! <b>Returns</b>: `a.deallocate(p, n)`
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing
|
||||
static void deallocate(Alloc &a, pointer p, size_type n)
|
||||
{ return a.deallocate(p, n); }
|
||||
@@ -260,7 +260,7 @@ struct allocator_traits
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
|
||||
//! <b>Effects</b>: calls `a.construct(p, std::forward<Args>(args)...)` if that call is well-formed;
|
||||
//! <b>Effects</b>: calls `a.construct(p, std::forward<Args>(args)...)` if that call is well-formed;
|
||||
//! otherwise, invokes `::new (static_cast<void*>(p)) T(std::forward<Args>(args)...)`
|
||||
template <class T, class ...Args>
|
||||
static void construct(Alloc & a, T* p, BOOST_FWD_REF(Args)... args)
|
||||
@@ -300,8 +300,8 @@ struct allocator_traits
|
||||
|
||||
#if !defined(BOOST_NO_VARIADIC_TEMPLATES)
|
||||
template<class T, class ...Args>
|
||||
static void priv_construct(boost::false_type, Alloc &a, T *p, BOOST_FWD_REF(Args) ...args)
|
||||
{
|
||||
static void priv_construct(boost::false_type, Alloc &a, T *p, BOOST_FWD_REF(Args) ...args)
|
||||
{
|
||||
const bool value = boost::container::container_detail::
|
||||
has_member_function_callable_with_construct
|
||||
< Alloc, T*, Args... >::value;
|
||||
@@ -336,7 +336,7 @@ struct allocator_traits
|
||||
//
|
||||
#define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
|
||||
#include BOOST_PP_LOCAL_ITERATE()
|
||||
|
||||
|
||||
private:
|
||||
#define BOOST_PP_LOCAL_MACRO(n) \
|
||||
template<class T BOOST_PP_ENUM_TRAILING_PARAMS(n, class P) > \
|
||||
|
@@ -21,8 +21,8 @@
|
||||
|
||||
/// @cond
|
||||
|
||||
namespace boost{
|
||||
namespace intrusive{
|
||||
namespace boost{
|
||||
namespace intrusive{
|
||||
//Create namespace to avoid compilation errors
|
||||
}}
|
||||
|
||||
@@ -32,9 +32,9 @@ namespace bi = boost::intrusive;
|
||||
|
||||
}}}
|
||||
|
||||
#include <utility>
|
||||
#include <memory>
|
||||
#include <functional>
|
||||
#include <utility>
|
||||
#include <memory>
|
||||
#include <functional>
|
||||
#include <iosfwd>
|
||||
#include <string>
|
||||
|
||||
@@ -127,7 +127,7 @@ class flat_multimap;
|
||||
//basic_string class
|
||||
template <class CharT
|
||||
,class Traits = std::char_traits<CharT>
|
||||
,class A = std::allocator<CharT> >
|
||||
,class A = std::allocator<CharT> >
|
||||
class basic_string;
|
||||
|
||||
//! Type used to tag that the input range is
|
||||
|
@@ -90,7 +90,7 @@ struct deque_value_traits
|
||||
|
||||
// Note: this function is simply a kludge to work around several compilers'
|
||||
// bugs in handling constant expressions.
|
||||
inline std::size_t deque_buf_size(std::size_t size)
|
||||
inline std::size_t deque_buf_size(std::size_t size)
|
||||
{ return size < 512 ? std::size_t(512 / size) : std::size_t(1); }
|
||||
|
||||
// Deque base class. It has two purposes. First, its constructor
|
||||
@@ -128,16 +128,16 @@ class deque_base
|
||||
|
||||
static size_type s_buffer_size() { return deque_buf_size(sizeof(T)); }
|
||||
|
||||
val_alloc_ptr priv_allocate_node()
|
||||
val_alloc_ptr priv_allocate_node()
|
||||
{ return this->alloc().allocate(s_buffer_size()); }
|
||||
|
||||
void priv_deallocate_node(val_alloc_ptr p)
|
||||
void priv_deallocate_node(val_alloc_ptr p)
|
||||
{ this->alloc().deallocate(p, s_buffer_size()); }
|
||||
|
||||
ptr_alloc_ptr priv_allocate_map(size_type n)
|
||||
ptr_alloc_ptr priv_allocate_map(size_type n)
|
||||
{ return this->ptr_alloc().allocate(n); }
|
||||
|
||||
void priv_deallocate_map(ptr_alloc_ptr p, size_type n)
|
||||
void priv_deallocate_map(ptr_alloc_ptr p, size_type n)
|
||||
{ this->ptr_alloc().deallocate(p, n); }
|
||||
|
||||
public:
|
||||
@@ -145,7 +145,7 @@ class deque_base
|
||||
// For any nonsingular iterator i:
|
||||
// i.node is the address of an element in the map array. The
|
||||
// contents of i.node is a pointer to the beginning of a node.
|
||||
// i.first == //(i.node)
|
||||
// i.first == //(i.node)
|
||||
// i.last == i.first + node_size
|
||||
// i.cur is a pointer in the range [i.first, i.last). NOTE:
|
||||
// the implication of this is that i.cur is always a dereferenceable
|
||||
@@ -160,14 +160,14 @@ class deque_base
|
||||
// [start.cur, start.last) and [finish.first, finish.cur) are initialized
|
||||
// objects, and [start.first, start.cur) and [finish.cur, finish.last)
|
||||
// are uninitialized storage.
|
||||
// [map, map + map_size) is a valid, non-empty range.
|
||||
// [start.node, finish.node] is a valid range contained within
|
||||
// [map, map + map_size).
|
||||
// [map, map + map_size) is a valid, non-empty range.
|
||||
// [start.node, finish.node] is a valid range contained within
|
||||
// [map, map + map_size).
|
||||
// A pointer in the range [map, map + map_size) points to an allocated node
|
||||
// if and only if the pointer is in the range [start.node, finish.node].
|
||||
class const_iterator
|
||||
: public std::iterator<std::random_access_iterator_tag,
|
||||
val_alloc_val, val_alloc_diff,
|
||||
class const_iterator
|
||||
: public std::iterator<std::random_access_iterator_tag,
|
||||
val_alloc_val, val_alloc_diff,
|
||||
val_alloc_cptr, val_alloc_cref>
|
||||
{
|
||||
public:
|
||||
@@ -185,30 +185,30 @@ class deque_base
|
||||
friend class deque<T, A>;
|
||||
friend class deque_base<T, A>;
|
||||
|
||||
protected:
|
||||
protected:
|
||||
val_alloc_ptr m_cur;
|
||||
val_alloc_ptr m_first;
|
||||
val_alloc_ptr m_last;
|
||||
index_pointer m_node;
|
||||
|
||||
public:
|
||||
const_iterator(val_alloc_ptr x, index_pointer y)
|
||||
public:
|
||||
const_iterator(val_alloc_ptr x, index_pointer y)
|
||||
: m_cur(x), m_first(*y),
|
||||
m_last(*y + s_buffer_size()), m_node(y) {}
|
||||
|
||||
const_iterator() : m_cur(0), m_first(0), m_last(0), m_node(0) {}
|
||||
|
||||
const_iterator(const const_iterator& x)
|
||||
: m_cur(x.m_cur), m_first(x.m_first),
|
||||
: m_cur(x.m_cur), m_first(x.m_first),
|
||||
m_last(x.m_last), m_node(x.m_node) {}
|
||||
|
||||
reference operator*() const
|
||||
reference operator*() const
|
||||
{ return *this->m_cur; }
|
||||
|
||||
pointer operator->() const
|
||||
pointer operator->() const
|
||||
{ return this->m_cur; }
|
||||
|
||||
difference_type operator-(const self_t& x) const
|
||||
difference_type operator-(const self_t& x) const
|
||||
{
|
||||
if(!this->m_cur && !x.m_cur){
|
||||
return 0;
|
||||
@@ -217,24 +217,24 @@ class deque_base
|
||||
(this->m_cur - this->m_first) + (x.m_last - x.m_cur);
|
||||
}
|
||||
|
||||
self_t& operator++()
|
||||
self_t& operator++()
|
||||
{
|
||||
++this->m_cur;
|
||||
if (this->m_cur == this->m_last) {
|
||||
this->priv_set_node(this->m_node + 1);
|
||||
this->m_cur = this->m_first;
|
||||
}
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
|
||||
self_t operator++(int)
|
||||
self_t operator++(int)
|
||||
{
|
||||
self_t tmp = *this;
|
||||
++*this;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
self_t& operator--()
|
||||
self_t& operator--()
|
||||
{
|
||||
if (this->m_cur == this->m_first) {
|
||||
this->priv_set_node(this->m_node - 1);
|
||||
@@ -244,7 +244,7 @@ class deque_base
|
||||
return *this;
|
||||
}
|
||||
|
||||
self_t operator--(int)
|
||||
self_t operator--(int)
|
||||
{
|
||||
self_t tmp = *this;
|
||||
--*this;
|
||||
@@ -261,7 +261,7 @@ class deque_base
|
||||
offset > 0 ? offset / difference_type(this->s_buffer_size())
|
||||
: -difference_type((-offset - 1) / this->s_buffer_size()) - 1;
|
||||
this->priv_set_node(this->m_node + node_offset);
|
||||
this->m_cur = this->m_first +
|
||||
this->m_cur = this->m_first +
|
||||
(offset - node_offset * difference_type(this->s_buffer_size()));
|
||||
}
|
||||
return *this;
|
||||
@@ -270,37 +270,37 @@ class deque_base
|
||||
self_t operator+(difference_type n) const
|
||||
{ self_t tmp = *this; return tmp += n; }
|
||||
|
||||
self_t& operator-=(difference_type n)
|
||||
self_t& operator-=(difference_type n)
|
||||
{ return *this += -n; }
|
||||
|
||||
self_t operator-(difference_type n) const
|
||||
|
||||
self_t operator-(difference_type n) const
|
||||
{ self_t tmp = *this; return tmp -= n; }
|
||||
|
||||
reference operator[](difference_type n) const
|
||||
reference operator[](difference_type n) const
|
||||
{ return *(*this + n); }
|
||||
|
||||
bool operator==(const self_t& x) const
|
||||
bool operator==(const self_t& x) const
|
||||
{ return this->m_cur == x.m_cur; }
|
||||
|
||||
bool operator!=(const self_t& x) const
|
||||
bool operator!=(const self_t& x) const
|
||||
{ return !(*this == x); }
|
||||
|
||||
bool operator<(const self_t& x) const
|
||||
bool operator<(const self_t& x) const
|
||||
{
|
||||
return (this->m_node == x.m_node) ?
|
||||
return (this->m_node == x.m_node) ?
|
||||
(this->m_cur < x.m_cur) : (this->m_node < x.m_node);
|
||||
}
|
||||
|
||||
bool operator>(const self_t& x) const
|
||||
bool operator>(const self_t& x) const
|
||||
{ return x < *this; }
|
||||
|
||||
bool operator<=(const self_t& x) const
|
||||
bool operator<=(const self_t& x) const
|
||||
{ return !(x < *this); }
|
||||
|
||||
bool operator>=(const self_t& x) const
|
||||
bool operator>=(const self_t& x) const
|
||||
{ return !(*this < x); }
|
||||
|
||||
void priv_set_node(index_pointer new_node)
|
||||
void priv_set_node(index_pointer new_node)
|
||||
{
|
||||
this->m_node = new_node;
|
||||
this->m_first = *new_node;
|
||||
@@ -343,12 +343,12 @@ class deque_base
|
||||
reference operator[](difference_type n) const { return *(*this + n); }
|
||||
|
||||
//Increment / Decrement
|
||||
iterator& operator++()
|
||||
iterator& operator++()
|
||||
{ this->const_iterator::operator++(); return *this; }
|
||||
|
||||
iterator operator++(int)
|
||||
{ iterator tmp = *this; ++*this; return tmp; }
|
||||
|
||||
|
||||
iterator& operator--()
|
||||
{ this->const_iterator::operator--(); return *this; }
|
||||
|
||||
@@ -379,7 +379,7 @@ class deque_base
|
||||
: members_(a)
|
||||
{ this->priv_initialize_map(num_elements); }
|
||||
|
||||
explicit deque_base(const allocator_type& a)
|
||||
explicit deque_base(const allocator_type& a)
|
||||
: members_(a)
|
||||
{}
|
||||
|
||||
@@ -402,7 +402,7 @@ class deque_base
|
||||
|
||||
private:
|
||||
deque_base(const deque_base&);
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
void swap_members(deque_base &x)
|
||||
@@ -423,7 +423,7 @@ class deque_base
|
||||
|
||||
ptr_alloc_ptr nstart = this->members_.m_map + (this->members_.m_map_size - num_nodes) / 2;
|
||||
ptr_alloc_ptr nfinish = nstart + num_nodes;
|
||||
|
||||
|
||||
BOOST_TRY {
|
||||
this->priv_create_nodes(nstart, nfinish);
|
||||
}
|
||||
@@ -508,16 +508,16 @@ class deque_base
|
||||
iterator m_finish;
|
||||
} members_;
|
||||
|
||||
ptr_alloc_t &ptr_alloc()
|
||||
ptr_alloc_t &ptr_alloc()
|
||||
{ return members_; }
|
||||
|
||||
const ptr_alloc_t &ptr_alloc() const
|
||||
|
||||
const ptr_alloc_t &ptr_alloc() const
|
||||
{ return members_; }
|
||||
|
||||
allocator_type &alloc()
|
||||
allocator_type &alloc()
|
||||
{ return members_; }
|
||||
|
||||
const allocator_type &alloc() const
|
||||
|
||||
const allocator_type &alloc() const
|
||||
{ return members_; }
|
||||
};
|
||||
/// @endcond
|
||||
@@ -574,7 +574,7 @@ class deque : protected deque_base<T, A>
|
||||
private: // Internal typedefs
|
||||
BOOST_COPYABLE_AND_MOVABLE(deque)
|
||||
typedef ptr_alloc_ptr index_pointer;
|
||||
static size_type s_buffer_size()
|
||||
static size_type s_buffer_size()
|
||||
{ return Base::s_buffer_size(); }
|
||||
typedef container_detail::advanced_insert_aux_int<iterator> advanced_insert_aux_int_t;
|
||||
typedef repeat_iterator<T, difference_type> r_iterator;
|
||||
@@ -586,175 +586,175 @@ class deque : protected deque_base<T, A>
|
||||
public:
|
||||
|
||||
//! <b>Effects</b>: Returns a copy of the internal allocator.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: If allocator's copy constructor throws.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
allocator_type get_allocator() const BOOST_CONTAINER_NOEXCEPT
|
||||
{ return Base::alloc(); }
|
||||
|
||||
//! <b>Effects</b>: Returns a reference to the internal allocator.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
//!
|
||||
//!
|
||||
//! <b>Note</b>: Non-standard extension.
|
||||
const stored_allocator_type &get_stored_allocator() const BOOST_CONTAINER_NOEXCEPT
|
||||
{ return Base::alloc(); }
|
||||
|
||||
//! <b>Effects</b>: Returns a reference to the internal allocator.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
//!
|
||||
//!
|
||||
//! <b>Note</b>: Non-standard extension.
|
||||
stored_allocator_type &get_stored_allocator() BOOST_CONTAINER_NOEXCEPT
|
||||
{ return Base::alloc(); }
|
||||
|
||||
//! <b>Effects</b>: Returns an iterator to the first element contained in the deque.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
iterator begin() BOOST_CONTAINER_NOEXCEPT
|
||||
{ return this->members_.m_start; }
|
||||
|
||||
//! <b>Effects</b>: Returns an iterator to the end of the deque.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
iterator end() BOOST_CONTAINER_NOEXCEPT
|
||||
{ return this->members_.m_finish; }
|
||||
|
||||
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the deque.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_iterator begin() const BOOST_CONTAINER_NOEXCEPT
|
||||
{ return this->members_.m_start; }
|
||||
|
||||
//! <b>Effects</b>: Returns a const_iterator to the end of the deque.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_iterator end() const BOOST_CONTAINER_NOEXCEPT
|
||||
{ return this->members_.m_finish; }
|
||||
|
||||
//! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning
|
||||
//! of the reversed deque.
|
||||
//!
|
||||
//! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning
|
||||
//! of the reversed deque.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
reverse_iterator rbegin() BOOST_CONTAINER_NOEXCEPT
|
||||
{ return reverse_iterator(this->members_.m_finish); }
|
||||
|
||||
//! <b>Effects</b>: Returns a reverse_iterator pointing to the end
|
||||
//! of the reversed deque.
|
||||
//!
|
||||
//! of the reversed deque.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
reverse_iterator rend() BOOST_CONTAINER_NOEXCEPT
|
||||
{ return reverse_iterator(this->members_.m_start); }
|
||||
|
||||
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
|
||||
//! of the reversed deque.
|
||||
//!
|
||||
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
|
||||
//! of the reversed deque.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_reverse_iterator rbegin() const BOOST_CONTAINER_NOEXCEPT
|
||||
{ return const_reverse_iterator(this->members_.m_finish); }
|
||||
|
||||
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
|
||||
//! of the reversed deque.
|
||||
//!
|
||||
//! of the reversed deque.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_reverse_iterator rend() const BOOST_CONTAINER_NOEXCEPT
|
||||
{ return const_reverse_iterator(this->members_.m_start); }
|
||||
|
||||
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the deque.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_iterator cbegin() const BOOST_CONTAINER_NOEXCEPT
|
||||
{ return this->members_.m_start; }
|
||||
|
||||
//! <b>Effects</b>: Returns a const_iterator to the end of the deque.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_iterator cend() const BOOST_CONTAINER_NOEXCEPT
|
||||
{ return this->members_.m_finish; }
|
||||
|
||||
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
|
||||
//! of the reversed deque.
|
||||
//!
|
||||
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
|
||||
//! of the reversed deque.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_reverse_iterator crbegin() const BOOST_CONTAINER_NOEXCEPT
|
||||
{ return const_reverse_iterator(this->members_.m_finish); }
|
||||
|
||||
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
|
||||
//! of the reversed deque.
|
||||
//!
|
||||
//! of the reversed deque.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_reverse_iterator crend() const BOOST_CONTAINER_NOEXCEPT
|
||||
{ return const_reverse_iterator(this->members_.m_start); }
|
||||
|
||||
//! <b>Requires</b>: size() > n.
|
||||
//!
|
||||
//! <b>Effects</b>: Returns a reference to the nth element
|
||||
//! <b>Effects</b>: Returns a reference to the nth element
|
||||
//! from the beginning of the container.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
reference operator[](size_type n) BOOST_CONTAINER_NOEXCEPT
|
||||
{ return this->members_.m_start[difference_type(n)]; }
|
||||
|
||||
//! <b>Requires</b>: size() > n.
|
||||
//!
|
||||
//! <b>Effects</b>: Returns a const reference to the nth element
|
||||
//! <b>Effects</b>: Returns a const reference to the nth element
|
||||
//! from the beginning of the container.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_reference operator[](size_type n) const BOOST_CONTAINER_NOEXCEPT
|
||||
{ return this->members_.m_start[difference_type(n)]; }
|
||||
|
||||
//! <b>Requires</b>: size() > n.
|
||||
//!
|
||||
//! <b>Effects</b>: Returns a reference to the nth element
|
||||
//! <b>Effects</b>: Returns a reference to the nth element
|
||||
//! from the beginning of the container.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: std::range_error if n >= size()
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
reference at(size_type n)
|
||||
{ this->priv_range_check(n); return (*this)[n]; }
|
||||
|
||||
//! <b>Requires</b>: size() > n.
|
||||
//!
|
||||
//! <b>Effects</b>: Returns a const reference to the nth element
|
||||
//! <b>Effects</b>: Returns a const reference to the nth element
|
||||
//! from the beginning of the container.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: std::range_error if n >= size()
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_reference at(size_type n) const
|
||||
{ this->priv_range_check(n); return (*this)[n]; }
|
||||
@@ -763,20 +763,20 @@ class deque : protected deque_base<T, A>
|
||||
//!
|
||||
//! <b>Effects</b>: Returns a reference to the first
|
||||
//! element of the container.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
reference front() BOOST_CONTAINER_NOEXCEPT
|
||||
{ return *this->members_.m_start; }
|
||||
|
||||
//! <b>Requires</b>: !empty()
|
||||
//!
|
||||
//! <b>Effects</b>: Returns a const reference to the first element
|
||||
//! <b>Effects</b>: Returns a const reference to the first element
|
||||
//! from the beginning of the container.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_reference front() const BOOST_CONTAINER_NOEXCEPT
|
||||
{ return *this->members_.m_start; }
|
||||
@@ -785,9 +785,9 @@ class deque : protected deque_base<T, A>
|
||||
//!
|
||||
//! <b>Effects</b>: Returns a reference to the last
|
||||
//! element of the container.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
reference back() BOOST_CONTAINER_NOEXCEPT
|
||||
{ return *(end()-1); }
|
||||
@@ -796,52 +796,52 @@ class deque : protected deque_base<T, A>
|
||||
//!
|
||||
//! <b>Effects</b>: Returns a const reference to the last
|
||||
//! element of the container.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_reference back() const BOOST_CONTAINER_NOEXCEPT
|
||||
{ return *(cend()-1); }
|
||||
|
||||
//! <b>Effects</b>: Returns the number of the elements contained in the deque.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
size_type size() const BOOST_CONTAINER_NOEXCEPT
|
||||
{ return this->members_.m_finish - this->members_.m_start; }
|
||||
|
||||
//! <b>Effects</b>: Returns the largest possible size of the deque.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
size_type max_size() const BOOST_CONTAINER_NOEXCEPT
|
||||
{ return allocator_traits_type::max_size(this->alloc()); }
|
||||
|
||||
//! <b>Effects</b>: Returns true if the deque contains no elements.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
bool empty() const BOOST_CONTAINER_NOEXCEPT
|
||||
{ return this->members_.m_finish == this->members_.m_start; }
|
||||
|
||||
//! <b>Effects</b>: Default constructors a deque.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: If allocator_type's default constructor throws.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
deque()
|
||||
deque()
|
||||
: Base()
|
||||
{}
|
||||
|
||||
//! <b>Effects</b>: Constructs a deque taking the allocator as parameter.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: If allocator_type's copy constructor throws.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
explicit deque(const allocator_type& a)
|
||||
explicit deque(const allocator_type& a)
|
||||
: Base(a)
|
||||
{}
|
||||
|
||||
@@ -850,7 +850,7 @@ class deque : protected deque_base<T, A>
|
||||
//!
|
||||
//! <b>Throws</b>: If allocator_type's default constructor or copy constructor
|
||||
//! throws or T's default or copy constructor throws.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear to n.
|
||||
explicit deque(size_type n)
|
||||
: Base(n, allocator_type())
|
||||
@@ -865,7 +865,7 @@ class deque : protected deque_base<T, A>
|
||||
//!
|
||||
//! <b>Throws</b>: If allocator_type's default constructor or copy constructor
|
||||
//! throws or T's default or copy constructor throws.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear to n.
|
||||
deque(size_type n, const value_type& value,
|
||||
const allocator_type& a = allocator_type())
|
||||
@@ -875,7 +875,7 @@ class deque : protected deque_base<T, A>
|
||||
//! <b>Effects</b>: Copy constructs a deque.
|
||||
//!
|
||||
//! <b>Postcondition</b>: x == *this.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear to the elements x contains.
|
||||
deque(const deque& x)
|
||||
: Base(allocator_traits_type::select_on_container_copy_construction(x.alloc()))
|
||||
@@ -890,19 +890,19 @@ class deque : protected deque_base<T, A>
|
||||
//! <b>Effects</b>: Move constructor. Moves mx's resources to *this.
|
||||
//!
|
||||
//! <b>Throws</b>: If allocator_type's copy constructor throws.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
deque(BOOST_RV_REF(deque) x)
|
||||
deque(BOOST_RV_REF(deque) x)
|
||||
: Base(boost::move(static_cast<Base&>(x)))
|
||||
{ this->swap_members(x); }
|
||||
|
||||
//! <b>Effects</b>: Copy constructs a vector using the specified allocator.
|
||||
//!
|
||||
//! <b>Postcondition</b>: x == *this.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: If allocation
|
||||
//! throws or T's copy constructor throws.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear to the elements x contains.
|
||||
deque(const deque& x, const allocator_type &a)
|
||||
: Base(a)
|
||||
@@ -919,9 +919,9 @@ class deque : protected deque_base<T, A>
|
||||
//! Otherwise copies values from x to *this.
|
||||
//!
|
||||
//! <b>Throws</b>: If allocation or T's copy constructor throws.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant if a == mx.get_allocator(), linear otherwise.
|
||||
deque(BOOST_RV_REF(deque) mx, const allocator_type &a)
|
||||
deque(BOOST_RV_REF(deque) mx, const allocator_type &a)
|
||||
: Base(a)
|
||||
{
|
||||
if(mx.alloc() == a){
|
||||
@@ -945,7 +945,7 @@ class deque : protected deque_base<T, A>
|
||||
//! <b>Complexity</b>: Linear to the range [first, last).
|
||||
template <class InpIt>
|
||||
deque(InpIt first, InpIt last, const allocator_type& a = allocator_type())
|
||||
: Base(a)
|
||||
: Base(a)
|
||||
{
|
||||
//Dispatch depending on integer/iterator
|
||||
const bool aux_boolean = container_detail::is_convertible<InpIt, size_type>::value;
|
||||
@@ -966,13 +966,13 @@ class deque : protected deque_base<T, A>
|
||||
|
||||
//! <b>Effects</b>: Makes *this contain the same elements as x.
|
||||
//!
|
||||
//! <b>Postcondition</b>: this->size() == x.size(). *this contains a copy
|
||||
//! of each of x's elements.
|
||||
//! <b>Postcondition</b>: this->size() == x.size(). *this contains a copy
|
||||
//! of each of x's elements.
|
||||
//!
|
||||
//! <b>Throws</b>: If memory allocation throws or T's copy constructor throws.
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear to the number of elements in x.
|
||||
deque& operator= (BOOST_COPY_ASSIGN_REF(deque) x)
|
||||
deque& operator= (BOOST_COPY_ASSIGN_REF(deque) x)
|
||||
{
|
||||
if (&x != this){
|
||||
allocator_type &this_alloc = this->alloc();
|
||||
@@ -1132,7 +1132,7 @@ class deque : protected deque_base<T, A>
|
||||
);
|
||||
++this->members_.m_start.m_cur;
|
||||
}
|
||||
else
|
||||
else
|
||||
this->priv_pop_front_aux();
|
||||
}
|
||||
|
||||
@@ -1180,7 +1180,7 @@ class deque : protected deque_base<T, A>
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear to std::distance [first, last).
|
||||
template <class InpIt>
|
||||
void insert(const_iterator pos, InpIt first, InpIt last)
|
||||
void insert(const_iterator pos, InpIt first, InpIt last)
|
||||
{
|
||||
//Dispatch depending on integer/iterator
|
||||
const bool aux_boolean = container_detail::is_convertible<InpIt, size_type>::value;
|
||||
@@ -1340,10 +1340,10 @@ class deque : protected deque_base<T, A>
|
||||
//! <b>Throws</b>: If memory allocation throws, or T's copy constructor throws.
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear to the difference between size() and new_size.
|
||||
void resize(size_type new_size, const value_type& x)
|
||||
void resize(size_type new_size, const value_type& x)
|
||||
{
|
||||
const size_type len = size();
|
||||
if (new_size < len)
|
||||
if (new_size < len)
|
||||
this->erase(this->members_.m_start + new_size, this->members_.m_finish);
|
||||
else
|
||||
this->insert(this->members_.m_finish, new_size - len, x);
|
||||
@@ -1355,10 +1355,10 @@ class deque : protected deque_base<T, A>
|
||||
//! <b>Throws</b>: If memory allocation throws, or T's copy constructor throws.
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear to the difference between size() and new_size.
|
||||
void resize(size_type new_size)
|
||||
void resize(size_type new_size)
|
||||
{
|
||||
const size_type len = size();
|
||||
if (new_size < len)
|
||||
if (new_size < len)
|
||||
this->priv_erase_last_n(len - new_size);
|
||||
else{
|
||||
size_type n = new_size - this->size();
|
||||
@@ -1371,7 +1371,7 @@ class deque : protected deque_base<T, A>
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear to the elements between pos and the
|
||||
//! <b>Complexity</b>: Linear to the elements between pos and the
|
||||
//! last element (if pos is near the end) or the first element
|
||||
//! if(pos is near the beginning).
|
||||
//! Constant if pos is the first or the last element.
|
||||
@@ -1396,7 +1396,7 @@ class deque : protected deque_base<T, A>
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear to the distance between first and
|
||||
//! last plus the elements between pos and the
|
||||
//! last plus the elements between pos and the
|
||||
//! last element (if pos is near the end) or the first element
|
||||
//! if(pos is near the beginning).
|
||||
iterator erase(const_iterator first, const_iterator last) BOOST_CONTAINER_NOEXCEPT
|
||||
@@ -1486,10 +1486,10 @@ class deque : protected deque_base<T, A>
|
||||
|
||||
/// @cond
|
||||
private:
|
||||
void priv_range_check(size_type n) const
|
||||
void priv_range_check(size_type n) const
|
||||
{ if (n >= this->size()) BOOST_RETHROW std::out_of_range("deque"); }
|
||||
|
||||
iterator priv_insert(const_iterator position, const value_type &x)
|
||||
iterator priv_insert(const_iterator position, const value_type &x)
|
||||
{
|
||||
if (position == cbegin()){
|
||||
this->push_front(x);
|
||||
@@ -1506,7 +1506,7 @@ class deque : protected deque_base<T, A>
|
||||
}
|
||||
}
|
||||
|
||||
iterator priv_insert(const_iterator position, BOOST_RV_REF(value_type) mx)
|
||||
iterator priv_insert(const_iterator position, BOOST_RV_REF(value_type) mx)
|
||||
{
|
||||
if (position == cbegin()) {
|
||||
this->push_front(boost::move(mx));
|
||||
@@ -1609,7 +1609,7 @@ class deque : protected deque_base<T, A>
|
||||
}
|
||||
|
||||
template <class FwdIt>
|
||||
void priv_insert_aux(const_iterator pos, FwdIt first, FwdIt last, std::forward_iterator_tag)
|
||||
void priv_insert_aux(const_iterator pos, FwdIt first, FwdIt last, std::forward_iterator_tag)
|
||||
{ this->priv_insert_aux(pos, first, last); }
|
||||
|
||||
// assign(), a generalized assignment member function. Two
|
||||
@@ -1629,14 +1629,14 @@ class deque : protected deque_base<T, A>
|
||||
}
|
||||
|
||||
template <class Integer>
|
||||
void priv_initialize_dispatch(Integer n, Integer x, container_detail::true_)
|
||||
void priv_initialize_dispatch(Integer n, Integer x, container_detail::true_)
|
||||
{
|
||||
this->priv_initialize_map(n);
|
||||
this->priv_fill_initialize(x);
|
||||
}
|
||||
|
||||
template <class InpIt>
|
||||
void priv_initialize_dispatch(InpIt first, InpIt last, container_detail::false_)
|
||||
void priv_initialize_dispatch(InpIt first, InpIt last, container_detail::false_)
|
||||
{
|
||||
typedef typename std::iterator_traits<InpIt>::iterator_category ItCat;
|
||||
this->priv_range_initialize(first, last, ItCat());
|
||||
@@ -1667,7 +1667,7 @@ class deque : protected deque_base<T, A>
|
||||
{ this->priv_fill_assign((size_type) n, (value_type)val); }
|
||||
|
||||
template <class InpIt>
|
||||
void priv_assign_dispatch(InpIt first, InpIt last, container_detail::false_)
|
||||
void priv_assign_dispatch(InpIt first, InpIt last, container_detail::false_)
|
||||
{
|
||||
typedef typename std::iterator_traits<InpIt>::iterator_category ItCat;
|
||||
this->priv_assign_aux(first, last, ItCat());
|
||||
@@ -1700,11 +1700,11 @@ class deque : protected deque_base<T, A>
|
||||
}
|
||||
|
||||
template <class Integer>
|
||||
void priv_insert_dispatch(const_iterator pos, Integer n, Integer x, container_detail::true_)
|
||||
void priv_insert_dispatch(const_iterator pos, Integer n, Integer x, container_detail::true_)
|
||||
{ this->priv_fill_insert(pos, (size_type) n, (value_type)x); }
|
||||
|
||||
template <class InpIt>
|
||||
void priv_insert_dispatch(const_iterator pos,InpIt first, InpIt last, container_detail::false_)
|
||||
void priv_insert_dispatch(const_iterator pos,InpIt first, InpIt last, container_detail::false_)
|
||||
{
|
||||
typedef typename std::iterator_traits<InpIt>::iterator_category ItCat;
|
||||
this->priv_insert_aux(pos, first, last, ItCat());
|
||||
@@ -1739,7 +1739,7 @@ class deque : protected deque_base<T, A>
|
||||
iterator old_start = this->members_.m_start;
|
||||
pos = this->members_.m_start + elemsbefore;
|
||||
if (elemsbefore >= difference_type(n)) {
|
||||
iterator start_n = this->members_.m_start + difference_type(n);
|
||||
iterator start_n = this->members_.m_start + difference_type(n);
|
||||
::boost::container::uninitialized_move_alloc
|
||||
(this->alloc(), this->members_.m_start, start_n, new_start);
|
||||
this->members_.m_start = new_start;
|
||||
@@ -1760,7 +1760,7 @@ class deque : protected deque_base<T, A>
|
||||
else {
|
||||
iterator new_finish = this->priv_reserve_elements_at_back(n);
|
||||
iterator old_finish = this->members_.m_finish;
|
||||
const difference_type elemsafter =
|
||||
const difference_type elemsafter =
|
||||
difference_type(length) - elemsbefore;
|
||||
pos = this->members_.m_finish - elemsafter;
|
||||
if (elemsafter >= difference_type(n)) {
|
||||
@@ -1814,7 +1814,7 @@ class deque : protected deque_base<T, A>
|
||||
|
||||
// Precondition: this->members_.m_start and this->members_.m_finish have already been initialized,
|
||||
// but none of the deque's elements have yet been constructed.
|
||||
void priv_fill_initialize(const value_type& value)
|
||||
void priv_fill_initialize(const value_type& value)
|
||||
{
|
||||
index_pointer cur;
|
||||
BOOST_TRY {
|
||||
@@ -1856,8 +1856,8 @@ class deque : protected deque_base<T, A>
|
||||
|
||||
index_pointer cur_node;
|
||||
BOOST_TRY {
|
||||
for (cur_node = this->members_.m_start.m_node;
|
||||
cur_node < this->members_.m_finish.m_node;
|
||||
for (cur_node = this->members_.m_start.m_node;
|
||||
cur_node < this->members_.m_finish.m_node;
|
||||
++cur_node) {
|
||||
FwdIt mid = first;
|
||||
std::advance(mid, this->s_buffer_size());
|
||||
@@ -1887,9 +1887,9 @@ class deque : protected deque_base<T, A>
|
||||
);
|
||||
}
|
||||
|
||||
// Called only if this->members_.m_start.m_cur == this->members_.m_start.m_last - 1. Note that
|
||||
// if the deque has at least one element (a precondition for this member
|
||||
// function), and if this->members_.m_start.m_cur == this->members_.m_start.m_last, then the deque
|
||||
// Called only if this->members_.m_start.m_cur == this->members_.m_start.m_last - 1. Note that
|
||||
// if the deque has at least one element (a precondition for this member
|
||||
// function), and if this->members_.m_start.m_cur == this->members_.m_start.m_last, then the deque
|
||||
// must have at least two nodes.
|
||||
void priv_pop_front_aux()
|
||||
{
|
||||
@@ -1900,14 +1900,14 @@ class deque : protected deque_base<T, A>
|
||||
this->priv_deallocate_node(this->members_.m_start.m_first);
|
||||
this->members_.m_start.priv_set_node(this->members_.m_start.m_node + 1);
|
||||
this->members_.m_start.m_cur = this->members_.m_start.m_first;
|
||||
}
|
||||
}
|
||||
|
||||
iterator priv_reserve_elements_at_front(size_type n)
|
||||
iterator priv_reserve_elements_at_front(size_type n)
|
||||
{
|
||||
size_type vacancies = this->members_.m_start.m_cur - this->members_.m_start.m_first;
|
||||
if (n > vacancies){
|
||||
size_type new_elems = n-vacancies;
|
||||
size_type new_nodes = (new_elems + this->s_buffer_size() - 1) /
|
||||
size_type new_nodes = (new_elems + this->s_buffer_size() - 1) /
|
||||
this->s_buffer_size();
|
||||
size_type s = (size_type)(this->members_.m_start.m_node - this->members_.m_map);
|
||||
if (new_nodes > s){
|
||||
@@ -1920,7 +1920,7 @@ class deque : protected deque_base<T, A>
|
||||
}
|
||||
BOOST_CATCH(...) {
|
||||
for (size_type j = 1; j < i; ++j)
|
||||
this->priv_deallocate_node(*(this->members_.m_start.m_node - j));
|
||||
this->priv_deallocate_node(*(this->members_.m_start.m_node - j));
|
||||
BOOST_RETHROW
|
||||
}
|
||||
BOOST_CATCH_END
|
||||
@@ -1928,7 +1928,7 @@ class deque : protected deque_base<T, A>
|
||||
return this->members_.m_start - difference_type(n);
|
||||
}
|
||||
|
||||
iterator priv_reserve_elements_at_back(size_type n)
|
||||
iterator priv_reserve_elements_at_back(size_type n)
|
||||
{
|
||||
size_type vacancies = (this->members_.m_finish.m_last - this->members_.m_finish.m_cur) - 1;
|
||||
if (n > vacancies){
|
||||
@@ -1945,7 +1945,7 @@ class deque : protected deque_base<T, A>
|
||||
}
|
||||
BOOST_CATCH(...) {
|
||||
for (size_type j = 1; j < i; ++j)
|
||||
this->priv_deallocate_node(*(this->members_.m_finish.m_node + j));
|
||||
this->priv_deallocate_node(*(this->members_.m_finish.m_node + j));
|
||||
BOOST_RETHROW
|
||||
}
|
||||
BOOST_CATCH_END
|
||||
@@ -1960,7 +1960,7 @@ class deque : protected deque_base<T, A>
|
||||
|
||||
index_pointer new_nstart;
|
||||
if (this->members_.m_map_size > 2 * new_num_nodes) {
|
||||
new_nstart = this->members_.m_map + (this->members_.m_map_size - new_num_nodes) / 2
|
||||
new_nstart = this->members_.m_map + (this->members_.m_map_size - new_num_nodes) / 2
|
||||
+ (add_at_front ? nodes_to_add : 0);
|
||||
if (new_nstart < this->members_.m_start.m_node)
|
||||
boost::move(this->members_.m_start.m_node, this->members_.m_finish.m_node + 1, new_nstart);
|
||||
@@ -1969,7 +1969,7 @@ class deque : protected deque_base<T, A>
|
||||
(this->members_.m_start.m_node, this->members_.m_finish.m_node + 1, new_nstart + old_num_nodes);
|
||||
}
|
||||
else {
|
||||
size_type new_map_size =
|
||||
size_type new_map_size =
|
||||
this->members_.m_map_size + container_detail::max_value(this->members_.m_map_size, nodes_to_add) + 2;
|
||||
|
||||
index_pointer new_map = this->priv_allocate_map(new_map_size);
|
||||
@@ -1998,29 +1998,29 @@ inline bool operator==(const deque<T, A>& x,
|
||||
|
||||
template <class T, class A>
|
||||
inline bool operator<(const deque<T, A>& x,
|
||||
const deque<T, A>& y)
|
||||
const deque<T, A>& y)
|
||||
{
|
||||
return lexicographical_compare(x.begin(), x.end(), y.begin(), y.end());
|
||||
}
|
||||
|
||||
template <class T, class A>
|
||||
inline bool operator!=(const deque<T, A>& x,
|
||||
const deque<T, A>& y)
|
||||
const deque<T, A>& y)
|
||||
{ return !(x == y); }
|
||||
|
||||
template <class T, class A>
|
||||
inline bool operator>(const deque<T, A>& x,
|
||||
const deque<T, A>& y)
|
||||
const deque<T, A>& y)
|
||||
{ return y < x; }
|
||||
|
||||
template <class T, class A>
|
||||
inline bool operator<=(const deque<T, A>& x,
|
||||
const deque<T, A>& y)
|
||||
const deque<T, A>& y)
|
||||
{ return !(y < x); }
|
||||
|
||||
template <class T, class A>
|
||||
inline bool operator>=(const deque<T, A>& x,
|
||||
const deque<T, A>& y)
|
||||
const deque<T, A>& y)
|
||||
{ return !(x < y); }
|
||||
|
||||
|
||||
|
@@ -51,11 +51,11 @@ struct adaptive_pool_types
|
||||
, bi::optimize_size<true>
|
||||
, bi::constant_time_size<false>
|
||||
, bi::link_mode<bi::normal_link> >::type multiset_hook_t;
|
||||
|
||||
|
||||
typedef hdr_offset_holder_t<SizeType> hdr_offset_holder;
|
||||
|
||||
struct block_info_t
|
||||
:
|
||||
:
|
||||
public hdr_offset_holder,
|
||||
public multiset_hook_t
|
||||
{
|
||||
@@ -89,7 +89,7 @@ inline size_type calculate_alignment
|
||||
const size_type divisor = overhead_percent*real_node_size;
|
||||
const size_type dividend = hdr_offset_size*100;
|
||||
size_type elements_per_subblock = (dividend - 1)/divisor + 1;
|
||||
size_type candidate_power_of_2 =
|
||||
size_type candidate_power_of_2 =
|
||||
upper_power_of_2(elements_per_subblock*real_node_size + hdr_offset_size);
|
||||
bool overhead_satisfied = false;
|
||||
//Now calculate the wors-case overhead for a subblock
|
||||
@@ -228,7 +228,7 @@ class private_adaptive_node_pool_impl
|
||||
{
|
||||
priv_invariants();
|
||||
//If there are no free nodes we allocate a new block
|
||||
if (m_block_multiset.empty()){
|
||||
if (m_block_multiset.empty()){
|
||||
priv_alloc_block(1);
|
||||
}
|
||||
//We take the first free node the multiset can't be empty
|
||||
@@ -248,7 +248,7 @@ class private_adaptive_node_pool_impl
|
||||
priv_invariants();
|
||||
}
|
||||
|
||||
//!Allocates n nodes.
|
||||
//!Allocates n nodes.
|
||||
//!Can throw
|
||||
multiallocation_chain allocate_nodes(const size_type n)
|
||||
{
|
||||
@@ -448,7 +448,7 @@ class private_adaptive_node_pool_impl
|
||||
#undef BOOST_CONTAINER_ADAPTIVE_NODE_POOL_CHECK_INVARIANTS
|
||||
{
|
||||
//We iterate through the block tree to free the memory
|
||||
block_iterator it(m_block_multiset.begin()),
|
||||
block_iterator it(m_block_multiset.begin()),
|
||||
itend(m_block_multiset.end()), to_deallocate;
|
||||
if(it != itend){
|
||||
for(++it; it != itend; ++it){
|
||||
@@ -559,9 +559,9 @@ class private_adaptive_node_pool_impl
|
||||
++m_totally_free_blocks;
|
||||
block_info_t *c_info = new(mem_address)block_info_t();
|
||||
m_block_multiset.insert(m_block_multiset.end(), *c_info);
|
||||
|
||||
|
||||
mem_address += HdrSize;
|
||||
//We initialize all Nodes in Node Block to insert
|
||||
//We initialize all Nodes in Node Block to insert
|
||||
//them in the free Node list
|
||||
typename free_nodes_t::iterator prev_insert_pos = c_info->free_nodes.before_begin();
|
||||
for(size_type i = 0; i < m_real_num_node; ++i){
|
||||
@@ -605,7 +605,7 @@ class private_adaptive_node_pool_impl
|
||||
}
|
||||
{
|
||||
char *pNode = hdr_addr + HdrSize;
|
||||
//We initialize all Nodes in Node Block to insert
|
||||
//We initialize all Nodes in Node Block to insert
|
||||
//them in the free Node list
|
||||
for(size_type i = 0; i < hdr_subblock_elements; ++i){
|
||||
prev_insert_pos = c_info->free_nodes.insert_after(prev_insert_pos, *new (pNode) node_t);
|
||||
|
@@ -183,7 +183,7 @@ namespace container {
|
||||
namespace container_detail {
|
||||
|
||||
|
||||
//This class template will adapt emplace construction insertions of movable types
|
||||
//This class template will adapt emplace construction insertions of movable types
|
||||
//to advanced_insert_aux_int
|
||||
template<class A, class Iterator, class ...Args>
|
||||
struct advanced_insert_aux_non_movable_emplace
|
||||
@@ -254,7 +254,7 @@ struct advanced_insert_aux_non_movable_emplace
|
||||
bool used_;
|
||||
};
|
||||
|
||||
//This class template will adapt emplace construction insertions of movable types
|
||||
//This class template will adapt emplace construction insertions of movable types
|
||||
//to advanced_insert_aux_int
|
||||
template<class A, class Iterator, class ...Args>
|
||||
struct advanced_insert_aux_emplace
|
||||
@@ -323,11 +323,11 @@ struct advanced_insert_aux_emplace
|
||||
|
||||
#else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
|
||||
|
||||
#include <boost/container/detail/preprocessor.hpp>
|
||||
#include <boost/container/detail/preprocessor.hpp>
|
||||
#include <boost/container/detail/value_init.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace container {
|
||||
namespace container {
|
||||
namespace container_detail {
|
||||
|
||||
#define BOOST_PP_LOCAL_MACRO(n) \
|
||||
|
@@ -51,7 +51,7 @@ inline void construct_in_place(A &a, T *dest, emplace_iterator<U, EF, D> ei)
|
||||
ei.construct_in_place(a, dest);
|
||||
}
|
||||
|
||||
} //namespace container {
|
||||
} //namespace container {
|
||||
} //namespace boost {
|
||||
|
||||
#include <boost/container/detail/config_end.hpp>
|
||||
|
@@ -23,7 +23,7 @@ namespace container {
|
||||
|
||||
/// @cond
|
||||
enum allocation_type_v
|
||||
{
|
||||
{
|
||||
// constants for allocation commands
|
||||
allocate_new_v = 0x01,
|
||||
expand_fwd_v = 0x02,
|
||||
|
@@ -24,7 +24,7 @@
|
||||
#include <boost/container/allocator_traits.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace container {
|
||||
namespace container {
|
||||
namespace container_detail {
|
||||
|
||||
//!A deleter for scoped_ptr that deallocates the memory
|
||||
@@ -88,7 +88,7 @@ struct scoped_destructor_n
|
||||
|
||||
void increment_size_backwards(size_type inc)
|
||||
{ m_n += inc; m_p -= inc; }
|
||||
|
||||
|
||||
~scoped_destructor_n()
|
||||
{
|
||||
if(!m_p) return;
|
||||
@@ -185,8 +185,8 @@ class allocator_destroyer
|
||||
};
|
||||
|
||||
|
||||
} //namespace container_detail {
|
||||
} //namespace container {
|
||||
} //namespace container_detail {
|
||||
} //namespace container {
|
||||
} //namespace boost {
|
||||
|
||||
#include <boost/container/detail/config_end.hpp>
|
||||
|
@@ -48,24 +48,24 @@ class flat_tree_value_compare
|
||||
typedef Value first_argument_type;
|
||||
typedef Value second_argument_type;
|
||||
typedef bool return_type;
|
||||
public:
|
||||
public:
|
||||
flat_tree_value_compare()
|
||||
: Compare()
|
||||
{}
|
||||
|
||||
flat_tree_value_compare(const Compare &pred)
|
||||
flat_tree_value_compare(const Compare &pred)
|
||||
: Compare(pred)
|
||||
{}
|
||||
|
||||
bool operator()(const Value& lhs, const Value& rhs) const
|
||||
{
|
||||
{
|
||||
KeyOfValue key_extract;
|
||||
return Compare::operator()(key_extract(lhs), key_extract(rhs));
|
||||
return Compare::operator()(key_extract(lhs), key_extract(rhs));
|
||||
}
|
||||
|
||||
const Compare &get_comp() const
|
||||
{ return *this; }
|
||||
|
||||
|
||||
Compare &get_comp()
|
||||
{ return *this; }
|
||||
};
|
||||
@@ -81,7 +81,7 @@ struct get_flat_tree_iterators
|
||||
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
};
|
||||
|
||||
template <class Key, class Value, class KeyOfValue,
|
||||
template <class Key, class Value, class KeyOfValue,
|
||||
class Compare, class A>
|
||||
class flat_tree
|
||||
{
|
||||
@@ -92,7 +92,7 @@ class flat_tree
|
||||
typedef flat_tree_value_compare<Compare, Value, KeyOfValue> value_compare;
|
||||
|
||||
private:
|
||||
struct Data
|
||||
struct Data
|
||||
//Inherit from value_compare to do EBO
|
||||
: public value_compare
|
||||
{
|
||||
@@ -119,12 +119,12 @@ class flat_tree
|
||||
: value_compare(boost::move(static_cast<value_compare&>(d))), m_vect(boost::move(d.m_vect), a)
|
||||
{}
|
||||
|
||||
Data(const Compare &comp)
|
||||
Data(const Compare &comp)
|
||||
: value_compare(comp), m_vect()
|
||||
{}
|
||||
|
||||
Data(const Compare &comp,
|
||||
const allocator_t &alloc)
|
||||
const allocator_t &alloc)
|
||||
: value_compare(comp), m_vect(alloc)
|
||||
{}
|
||||
|
||||
@@ -191,7 +191,7 @@ class flat_tree
|
||||
: m_data(comp, a)
|
||||
{ }
|
||||
|
||||
flat_tree(const flat_tree& x)
|
||||
flat_tree(const flat_tree& x)
|
||||
: m_data(x.m_data)
|
||||
{ }
|
||||
|
||||
@@ -199,7 +199,7 @@ class flat_tree
|
||||
: m_data(boost::move(x.m_data))
|
||||
{ }
|
||||
|
||||
flat_tree(const flat_tree& x, const allocator_type &a)
|
||||
flat_tree(const flat_tree& x, const allocator_type &a)
|
||||
: m_data(x.m_data, a)
|
||||
{ }
|
||||
|
||||
@@ -223,66 +223,66 @@ class flat_tree
|
||||
flat_tree& operator=(BOOST_RV_REF(flat_tree) mx)
|
||||
{ m_data = boost::move(mx.m_data); return *this; }
|
||||
|
||||
public:
|
||||
public:
|
||||
// accessors:
|
||||
Compare key_comp() const
|
||||
Compare key_comp() const
|
||||
{ return this->m_data.get_comp(); }
|
||||
|
||||
allocator_type get_allocator() const
|
||||
allocator_type get_allocator() const
|
||||
{ return this->m_data.m_vect.get_allocator(); }
|
||||
|
||||
const stored_allocator_type &get_stored_allocator() const
|
||||
const stored_allocator_type &get_stored_allocator() const
|
||||
{ return this->m_data.m_vect.get_stored_allocator(); }
|
||||
|
||||
stored_allocator_type &get_stored_allocator()
|
||||
{ return this->m_data.m_vect.get_stored_allocator(); }
|
||||
|
||||
iterator begin()
|
||||
iterator begin()
|
||||
{ return this->m_data.m_vect.begin(); }
|
||||
|
||||
const_iterator begin() const
|
||||
const_iterator begin() const
|
||||
{ return this->cbegin(); }
|
||||
|
||||
const_iterator cbegin() const
|
||||
const_iterator cbegin() const
|
||||
{ return this->m_data.m_vect.begin(); }
|
||||
|
||||
iterator end()
|
||||
iterator end()
|
||||
{ return this->m_data.m_vect.end(); }
|
||||
|
||||
const_iterator end() const
|
||||
const_iterator end() const
|
||||
{ return this->cend(); }
|
||||
|
||||
const_iterator cend() const
|
||||
const_iterator cend() const
|
||||
{ return this->m_data.m_vect.end(); }
|
||||
|
||||
reverse_iterator rbegin()
|
||||
reverse_iterator rbegin()
|
||||
{ return reverse_iterator(this->end()); }
|
||||
|
||||
const_reverse_iterator rbegin() const
|
||||
const_reverse_iterator rbegin() const
|
||||
{ return this->crbegin(); }
|
||||
|
||||
const_reverse_iterator crbegin() const
|
||||
const_reverse_iterator crbegin() const
|
||||
{ return const_reverse_iterator(this->cend()); }
|
||||
|
||||
reverse_iterator rend()
|
||||
reverse_iterator rend()
|
||||
{ return reverse_iterator(this->begin()); }
|
||||
|
||||
const_reverse_iterator rend() const
|
||||
{ return this->crend(); }
|
||||
const_reverse_iterator rend() const
|
||||
{ return this->crend(); }
|
||||
|
||||
const_reverse_iterator crend() const
|
||||
{ return const_reverse_iterator(this->cbegin()); }
|
||||
const_reverse_iterator crend() const
|
||||
{ return const_reverse_iterator(this->cbegin()); }
|
||||
|
||||
bool empty() const
|
||||
bool empty() const
|
||||
{ return this->m_data.m_vect.empty(); }
|
||||
|
||||
size_type size() const
|
||||
size_type size() const
|
||||
{ return this->m_data.m_vect.size(); }
|
||||
|
||||
size_type max_size() const
|
||||
size_type max_size() const
|
||||
{ return this->m_data.m_vect.max_size(); }
|
||||
|
||||
void swap(flat_tree& other)
|
||||
void swap(flat_tree& other)
|
||||
{ this->m_data.swap(other.m_data); }
|
||||
|
||||
public:
|
||||
@@ -365,7 +365,7 @@ class flat_tree
|
||||
template <class InIt>
|
||||
void insert_equal(InIt first, InIt last)
|
||||
{
|
||||
typedef typename
|
||||
typedef typename
|
||||
std::iterator_traits<InIt>::iterator_category ItCat;
|
||||
this->priv_insert_equal(first, last, ItCat());
|
||||
}
|
||||
@@ -373,11 +373,19 @@ class flat_tree
|
||||
template <class InIt>
|
||||
void insert_equal(ordered_range_t, InIt first, InIt last)
|
||||
{
|
||||
typedef typename
|
||||
typedef typename
|
||||
std::iterator_traits<InIt>::iterator_category ItCat;
|
||||
this->priv_insert_equal(ordered_range_t(), first, last, ItCat());
|
||||
}
|
||||
|
||||
template <class InIt>
|
||||
void insert_unique(ordered_unique_range_t, InIt first, InIt last)
|
||||
{
|
||||
typedef typename
|
||||
std::iterator_traits<InIt>::iterator_category ItCat;
|
||||
this->priv_insert_unique(ordered_unique_range_t(), first, last, ItCat());
|
||||
}
|
||||
|
||||
#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
|
||||
|
||||
template <class... Args>
|
||||
@@ -557,8 +565,8 @@ class flat_tree
|
||||
const Compare &key_comp = this->m_data.get_comp();
|
||||
iterator i = this->lower_bound(k);
|
||||
|
||||
if (i != this->end() && key_comp(k, KeyOfValue()(*i))){
|
||||
i = this->end();
|
||||
if (i != this->end() && key_comp(k, KeyOfValue()(*i))){
|
||||
i = this->end();
|
||||
}
|
||||
return i;
|
||||
}
|
||||
@@ -568,8 +576,8 @@ class flat_tree
|
||||
const Compare &key_comp = this->m_data.get_comp();
|
||||
const_iterator i = this->lower_bound(k);
|
||||
|
||||
if (i != this->end() && key_comp(k, KeyOfValue()(*i))){
|
||||
i = this->end();
|
||||
if (i != this->end() && key_comp(k, KeyOfValue()(*i))){
|
||||
i = this->end();
|
||||
}
|
||||
return i;
|
||||
}
|
||||
@@ -599,10 +607,10 @@ class flat_tree
|
||||
std::pair<const_iterator, const_iterator> equal_range(const key_type& k) const
|
||||
{ return this->priv_equal_range(this->begin(), this->end(), k); }
|
||||
|
||||
size_type capacity() const
|
||||
size_type capacity() const
|
||||
{ return this->m_data.m_vect.capacity(); }
|
||||
|
||||
void reserve(size_type count)
|
||||
void reserve(size_type count)
|
||||
{ this->m_data.m_vect.reserve(count); }
|
||||
|
||||
private:
|
||||
@@ -631,12 +639,12 @@ class flat_tree
|
||||
data.position = pos;
|
||||
}
|
||||
else{
|
||||
data.position =
|
||||
data.position =
|
||||
this->priv_upper_bound(this->cbegin(), pos, KeyOfValue()(val));
|
||||
}
|
||||
}
|
||||
else{
|
||||
data.position =
|
||||
data.position =
|
||||
this->priv_lower_bound(pos, this->cend(), KeyOfValue()(val));
|
||||
}
|
||||
}
|
||||
@@ -756,7 +764,7 @@ class flat_tree
|
||||
}
|
||||
else{
|
||||
first = ++middle;
|
||||
len = len - half - 1;
|
||||
len = len - half - 1;
|
||||
}
|
||||
}
|
||||
return first;
|
||||
@@ -801,28 +809,82 @@ class flat_tree
|
||||
const size_type BurstSize = 16;
|
||||
size_type positions[BurstSize];
|
||||
|
||||
//Prereserve all memory so that iterators are not invalidated
|
||||
this->reserve(this->size()+len);
|
||||
const const_iterator beg(this->cbegin());
|
||||
const_iterator pos(beg);
|
||||
//Loop in burst sizes
|
||||
while(len){
|
||||
const size_type burst = len < BurstSize ? len : BurstSize;
|
||||
const const_iterator cend(this->cend());
|
||||
len -= burst;
|
||||
const iterator beg(this->cbegin());
|
||||
iterator pos;
|
||||
for(size_type i = 0; i != burst; ++i){
|
||||
pos = this->upper_bound(KeyOfValue()(*first));
|
||||
//Get the insertion position for each key
|
||||
pos = const_cast<const flat_tree&>(*this).priv_upper_bound(pos, cend, KeyOfValue()(*first));
|
||||
positions[i] = static_cast<size_type>(pos - beg);
|
||||
++first;
|
||||
}
|
||||
//Insert all in a single step in the precalculated positions
|
||||
this->m_data.m_vect.insert_ordered_at(burst, positions + burst, first);
|
||||
//Next search position updated
|
||||
pos += burst;
|
||||
}
|
||||
}
|
||||
|
||||
template <class BidirIt>
|
||||
void priv_insert_unique(ordered_unique_range_t, BidirIt first, BidirIt last, std::bidirectional_iterator_tag)
|
||||
{
|
||||
size_type len = static_cast<size_type>(std::distance(first, last));
|
||||
const size_type BurstSize = 16;
|
||||
size_type positions[BurstSize];
|
||||
size_type skips[BurstSize];
|
||||
|
||||
//Prereserve all memory so that iterators are not invalidated
|
||||
this->reserve(this->size()+len);
|
||||
const const_iterator beg(this->cbegin());
|
||||
const_iterator pos(beg);
|
||||
const value_compare &value_comp = this->m_data;
|
||||
//Loop in burst sizes
|
||||
while(len){
|
||||
skips[0u] = 0u;
|
||||
const size_type burst = len < BurstSize ? len : BurstSize;
|
||||
size_type unique_burst = 0u;
|
||||
const const_iterator cend(this->cend());
|
||||
while(unique_burst < burst && len > 0){
|
||||
//Get the insertion position for each key
|
||||
const value_type & val = *first++;
|
||||
--len;
|
||||
pos = const_cast<const flat_tree&>(*this).priv_lower_bound(pos, cend, KeyOfValue()(val));
|
||||
//Check if already present
|
||||
if(pos != cend && !value_comp(*pos, val)){
|
||||
++skips[unique_burst];
|
||||
continue;
|
||||
}
|
||||
|
||||
//If not present, calculate position
|
||||
positions[unique_burst] = static_cast<size_type>(pos - beg);
|
||||
if(++unique_burst < burst)
|
||||
skips[unique_burst] = 0u;
|
||||
}
|
||||
//Insert all in a single step in the precalculated positions
|
||||
this->m_data.m_vect.insert_ordered_at(unique_burst, positions + unique_burst, skips + unique_burst, first);
|
||||
//Next search position updated
|
||||
pos += unique_burst;
|
||||
}
|
||||
}
|
||||
/*
|
||||
template <class FwdIt>
|
||||
void priv_insert_equal_forward(ordered_range_t, FwdIt first, FwdIt last, std::forward_iterator_tag)
|
||||
{ this->priv_insert_equal(first, last, std::forward_iterator_tag()); }
|
||||
|
||||
*/
|
||||
template <class InIt>
|
||||
void priv_insert_equal(ordered_range_t, InIt first, InIt last, std::input_iterator_tag)
|
||||
{ this->priv_insert_equal(first, last, std::input_iterator_tag()); }
|
||||
|
||||
template <class InIt>
|
||||
void priv_insert_unique(ordered_unique_range_t, InIt first, InIt last, std::input_iterator_tag)
|
||||
{ this->priv_insert_unique(first, last, std::input_iterator_tag()); }
|
||||
/*
|
||||
template <class FwdIt>
|
||||
void priv_insert_equal_forward(FwdIt first, FwdIt last, std::forward_iterator_tag)
|
||||
{
|
||||
@@ -830,7 +892,7 @@ class flat_tree
|
||||
this->reserve(this->size()+len);
|
||||
this->priv_insert_equal(first, last, std::input_iterator_tag());
|
||||
}
|
||||
|
||||
*/
|
||||
template <class InIt>
|
||||
void priv_insert_equal(InIt first, InIt last, std::input_iterator_tag)
|
||||
{
|
||||
@@ -839,59 +901,59 @@ class flat_tree
|
||||
}
|
||||
};
|
||||
|
||||
template <class Key, class Value, class KeyOfValue,
|
||||
template <class Key, class Value, class KeyOfValue,
|
||||
class Compare, class A>
|
||||
inline bool
|
||||
operator==(const flat_tree<Key,Value,KeyOfValue,Compare,A>& x,
|
||||
inline bool
|
||||
operator==(const flat_tree<Key,Value,KeyOfValue,Compare,A>& x,
|
||||
const flat_tree<Key,Value,KeyOfValue,Compare,A>& y)
|
||||
{
|
||||
return x.size() == y.size() &&
|
||||
std::equal(x.begin(), x.end(), y.begin());
|
||||
}
|
||||
|
||||
template <class Key, class Value, class KeyOfValue,
|
||||
template <class Key, class Value, class KeyOfValue,
|
||||
class Compare, class A>
|
||||
inline bool
|
||||
operator<(const flat_tree<Key,Value,KeyOfValue,Compare,A>& x,
|
||||
inline bool
|
||||
operator<(const flat_tree<Key,Value,KeyOfValue,Compare,A>& x,
|
||||
const flat_tree<Key,Value,KeyOfValue,Compare,A>& y)
|
||||
{
|
||||
return std::lexicographical_compare(x.begin(), x.end(),
|
||||
return std::lexicographical_compare(x.begin(), x.end(),
|
||||
y.begin(), y.end());
|
||||
}
|
||||
|
||||
template <class Key, class Value, class KeyOfValue,
|
||||
template <class Key, class Value, class KeyOfValue,
|
||||
class Compare, class A>
|
||||
inline bool
|
||||
operator!=(const flat_tree<Key,Value,KeyOfValue,Compare,A>& x,
|
||||
const flat_tree<Key,Value,KeyOfValue,Compare,A>& y)
|
||||
inline bool
|
||||
operator!=(const flat_tree<Key,Value,KeyOfValue,Compare,A>& x,
|
||||
const flat_tree<Key,Value,KeyOfValue,Compare,A>& y)
|
||||
{ return !(x == y); }
|
||||
|
||||
template <class Key, class Value, class KeyOfValue,
|
||||
template <class Key, class Value, class KeyOfValue,
|
||||
class Compare, class A>
|
||||
inline bool
|
||||
operator>(const flat_tree<Key,Value,KeyOfValue,Compare,A>& x,
|
||||
const flat_tree<Key,Value,KeyOfValue,Compare,A>& y)
|
||||
inline bool
|
||||
operator>(const flat_tree<Key,Value,KeyOfValue,Compare,A>& x,
|
||||
const flat_tree<Key,Value,KeyOfValue,Compare,A>& y)
|
||||
{ return y < x; }
|
||||
|
||||
template <class Key, class Value, class KeyOfValue,
|
||||
template <class Key, class Value, class KeyOfValue,
|
||||
class Compare, class A>
|
||||
inline bool
|
||||
operator<=(const flat_tree<Key,Value,KeyOfValue,Compare,A>& x,
|
||||
const flat_tree<Key,Value,KeyOfValue,Compare,A>& y)
|
||||
inline bool
|
||||
operator<=(const flat_tree<Key,Value,KeyOfValue,Compare,A>& x,
|
||||
const flat_tree<Key,Value,KeyOfValue,Compare,A>& y)
|
||||
{ return !(y < x); }
|
||||
|
||||
template <class Key, class Value, class KeyOfValue,
|
||||
template <class Key, class Value, class KeyOfValue,
|
||||
class Compare, class A>
|
||||
inline bool
|
||||
operator>=(const flat_tree<Key,Value,KeyOfValue,Compare,A>& x,
|
||||
const flat_tree<Key,Value,KeyOfValue,Compare,A>& y)
|
||||
inline bool
|
||||
operator>=(const flat_tree<Key,Value,KeyOfValue,Compare,A>& x,
|
||||
const flat_tree<Key,Value,KeyOfValue,Compare,A>& y)
|
||||
{ return !(x < y); }
|
||||
|
||||
|
||||
template <class Key, class Value, class KeyOfValue,
|
||||
template <class Key, class Value, class KeyOfValue,
|
||||
class Compare, class A>
|
||||
inline void
|
||||
swap(flat_tree<Key,Value,KeyOfValue,Compare,A>& x,
|
||||
inline void
|
||||
swap(flat_tree<Key,Value,KeyOfValue,Compare,A>& x,
|
||||
flat_tree<Key,Value,KeyOfValue,Compare,A>& y)
|
||||
{ x.swap(y); }
|
||||
|
||||
@@ -901,7 +963,7 @@ swap(flat_tree<Key,Value,KeyOfValue,Compare,A>& x,
|
||||
/*
|
||||
//!has_trivial_destructor_after_move<> == true_type
|
||||
//!specialization for optimizations
|
||||
template <class K, class V, class KOV,
|
||||
template <class K, class V, class KOV,
|
||||
class C, class A>
|
||||
struct has_trivial_destructor_after_move<boost::container::container_detail::flat_tree<K, V, KOV, C, A> >
|
||||
{
|
||||
|
@@ -15,7 +15,7 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright 2007 Alexandre Courpron
|
||||
//
|
||||
// Permission to use, copy, modify, redistribute and sell this software,
|
||||
// Permission to use, copy, modify, redistribute and sell this software,
|
||||
// provided that this copyright notice appears on all copies of the software.
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace function_detector {
|
||||
public : \
|
||||
static const int check = NotFound + (sizeof(Test<T>(0, 0)) - sizeof(NotFoundType));\
|
||||
};\
|
||||
}}} //namespace boost::container::function_detector {
|
||||
}}} //namespace boost::container::function_detector {
|
||||
|
||||
#define BOOST_CONTAINER_DETECT_FUNCTION(Class, InstantiationKey, ReturnType, Identifier, Params) \
|
||||
::boost::container::function_detector::DetectMember_##InstantiationKey_##Identifier< Class,\
|
||||
|
@@ -33,7 +33,7 @@
|
||||
#include <iterator>
|
||||
|
||||
namespace boost {
|
||||
namespace container {
|
||||
namespace container {
|
||||
|
||||
template <class T, class Difference = std::ptrdiff_t>
|
||||
class constant_iterator
|
||||
@@ -50,9 +50,9 @@ class constant_iterator
|
||||
constant_iterator()
|
||||
: m_ptr(0), m_num(0){}
|
||||
|
||||
constant_iterator& operator++()
|
||||
constant_iterator& operator++()
|
||||
{ increment(); return *this; }
|
||||
|
||||
|
||||
constant_iterator operator++(int)
|
||||
{
|
||||
constant_iterator result (*this);
|
||||
@@ -60,9 +60,9 @@ class constant_iterator
|
||||
return result;
|
||||
}
|
||||
|
||||
constant_iterator& operator--()
|
||||
constant_iterator& operator--()
|
||||
{ decrement(); return *this; }
|
||||
|
||||
|
||||
constant_iterator operator--(int)
|
||||
{
|
||||
constant_iterator result (*this);
|
||||
@@ -161,9 +161,9 @@ class default_construct_iterator
|
||||
default_construct_iterator()
|
||||
: m_num(0){}
|
||||
|
||||
default_construct_iterator& operator++()
|
||||
default_construct_iterator& operator++()
|
||||
{ increment(); return *this; }
|
||||
|
||||
|
||||
default_construct_iterator operator++(int)
|
||||
{
|
||||
default_construct_iterator result (*this);
|
||||
@@ -171,9 +171,9 @@ class default_construct_iterator
|
||||
return result;
|
||||
}
|
||||
|
||||
default_construct_iterator& operator--()
|
||||
default_construct_iterator& operator--()
|
||||
{ decrement(); return *this; }
|
||||
|
||||
|
||||
default_construct_iterator operator--(int)
|
||||
{
|
||||
default_construct_iterator result (*this);
|
||||
@@ -247,7 +247,7 @@ class default_construct_iterator
|
||||
{ return other.m_num < m_num; }
|
||||
|
||||
const T & dereference() const
|
||||
{
|
||||
{
|
||||
static T dummy;
|
||||
return dummy;
|
||||
}
|
||||
@@ -273,9 +273,9 @@ class repeat_iterator
|
||||
repeat_iterator()
|
||||
: m_ptr(0), m_num(0){}
|
||||
|
||||
this_type& operator++()
|
||||
this_type& operator++()
|
||||
{ increment(); return *this; }
|
||||
|
||||
|
||||
this_type operator++(int)
|
||||
{
|
||||
this_type result (*this);
|
||||
@@ -283,9 +283,9 @@ class repeat_iterator
|
||||
return result;
|
||||
}
|
||||
|
||||
this_type& operator--()
|
||||
this_type& operator--()
|
||||
{ increment(); return *this; }
|
||||
|
||||
|
||||
this_type operator--(int)
|
||||
{
|
||||
this_type result (*this);
|
||||
@@ -384,9 +384,9 @@ class emplace_iterator
|
||||
emplace_iterator()
|
||||
: m_num(0), m_pe(0){}
|
||||
|
||||
this_type& operator++()
|
||||
this_type& operator++()
|
||||
{ increment(); return *this; }
|
||||
|
||||
|
||||
this_type operator++(int)
|
||||
{
|
||||
this_type result (*this);
|
||||
@@ -394,9 +394,9 @@ class emplace_iterator
|
||||
return result;
|
||||
}
|
||||
|
||||
this_type& operator--()
|
||||
this_type& operator--()
|
||||
{ decrement(); return *this; }
|
||||
|
||||
|
||||
this_type operator--(int)
|
||||
{
|
||||
this_type result (*this);
|
||||
@@ -475,7 +475,7 @@ class emplace_iterator
|
||||
{ return other.m_num < m_num; }
|
||||
|
||||
const T & dereference() const
|
||||
{
|
||||
{
|
||||
static T dummy;
|
||||
return dummy;
|
||||
}
|
||||
@@ -539,7 +539,7 @@ struct emplace_functor
|
||||
|
||||
#endif
|
||||
|
||||
} //namespace container {
|
||||
} //namespace container {
|
||||
} //namespace boost {
|
||||
|
||||
#include <boost/container/detail/config_end.hpp>
|
||||
|
@@ -4,7 +4,7 @@
|
||||
// (C) Copyright Ion Gaztanaga 2007-2012.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/container for documentation.
|
||||
@@ -94,7 +94,7 @@ inline std::size_t floor_log2 (std::size_t x)
|
||||
|
||||
std::size_t n = x;
|
||||
std::size_t log2 = 0;
|
||||
|
||||
|
||||
for(std::size_t shift = Bits >> 1; shift; shift >>= 1){
|
||||
std::size_t tmp = n >> shift;
|
||||
if (tmp)
|
||||
|
@@ -20,7 +20,7 @@
|
||||
#include <cstddef>
|
||||
|
||||
namespace boost {
|
||||
namespace container {
|
||||
namespace container {
|
||||
namespace container_detail {
|
||||
|
||||
template <class T, T val>
|
||||
@@ -109,24 +109,24 @@ struct if_
|
||||
|
||||
|
||||
template <class Pair>
|
||||
struct select1st
|
||||
// : public std::unary_function<Pair, typename Pair::first_type>
|
||||
struct select1st
|
||||
// : public std::unary_function<Pair, typename Pair::first_type>
|
||||
{
|
||||
template<class OtherPair>
|
||||
const typename Pair::first_type& operator()(const OtherPair& x) const
|
||||
const typename Pair::first_type& operator()(const OtherPair& x) const
|
||||
{ return x.first; }
|
||||
|
||||
const typename Pair::first_type& operator()(const typename Pair::first_type& x) const
|
||||
const typename Pair::first_type& operator()(const typename Pair::first_type& x) const
|
||||
{ return x; }
|
||||
};
|
||||
|
||||
// identity is an extension: it is not part of the standard.
|
||||
template <class T>
|
||||
struct identity
|
||||
// : public std::unary_function<T,T>
|
||||
struct identity
|
||||
// : public std::unary_function<T,T>
|
||||
{
|
||||
typedef T type;
|
||||
const T& operator()(const T& x) const
|
||||
const T& operator()(const T& x) const
|
||||
{ return x; }
|
||||
};
|
||||
|
||||
@@ -152,8 +152,8 @@ template <typename T> struct unvoid { typedef T type; };
|
||||
template <> struct unvoid<void> { struct type { }; };
|
||||
template <> struct unvoid<const void> { struct type { }; };
|
||||
|
||||
} //namespace container_detail {
|
||||
} //namespace container {
|
||||
} //namespace container_detail {
|
||||
} //namespace container {
|
||||
} //namespace boost {
|
||||
|
||||
#endif //#ifndef BOOST_CONTAINER_CONTAINER_DETAIL_MPL_HPP
|
||||
|
@@ -189,11 +189,11 @@ struct node_alloc_holder
|
||||
public:
|
||||
|
||||
//Constructors for sequence containers
|
||||
node_alloc_holder()
|
||||
node_alloc_holder()
|
||||
: members_()
|
||||
{}
|
||||
|
||||
explicit node_alloc_holder(const ValAlloc &a)
|
||||
explicit node_alloc_holder(const ValAlloc &a)
|
||||
: members_(a)
|
||||
{}
|
||||
|
||||
@@ -206,7 +206,7 @@ struct node_alloc_holder
|
||||
{ this->icont().swap(x.icont()); }
|
||||
|
||||
//Constructors for associative containers
|
||||
explicit node_alloc_holder(const ValAlloc &a, const Pred &c)
|
||||
explicit node_alloc_holder(const ValAlloc &a, const Pred &c)
|
||||
: members_(a, c)
|
||||
{}
|
||||
|
||||
@@ -224,7 +224,7 @@ struct node_alloc_holder
|
||||
{ this->icont().swap(x.icont()); }
|
||||
|
||||
void copy_assign_alloc(const node_alloc_holder &x)
|
||||
{
|
||||
{
|
||||
container_detail::bool_<allocator_traits_type::propagate_on_container_copy_assignment::value> flag;
|
||||
container_detail::assign_alloc( static_cast<NodeAlloc &>(this->members_)
|
||||
, static_cast<const NodeAlloc &>(x.members_), flag);
|
||||
|
@@ -86,12 +86,12 @@ class private_node_pool_impl
|
||||
|
||||
void *allocate_node()
|
||||
{ return priv_alloc_node(); }
|
||||
|
||||
|
||||
//!Deallocates an array pointed by ptr. Never throws
|
||||
void deallocate_node(void *ptr)
|
||||
{ priv_dealloc_node(ptr); }
|
||||
|
||||
//!Allocates a singly linked list of n nodes ending in null pointer.
|
||||
//!Allocates a singly linked list of n nodes ending in null pointer.
|
||||
multiallocation_chain allocate_nodes(const size_type n)
|
||||
{
|
||||
//Preallocate all needed blocks to fulfill the request
|
||||
@@ -238,7 +238,7 @@ class private_node_pool_impl
|
||||
push_in_list(free_nodes_t &l, typename free_nodes_t::iterator &it)
|
||||
: slist_(l), last_it_(it)
|
||||
{}
|
||||
|
||||
|
||||
void operator()(typename free_nodes_t::pointer p) const
|
||||
{
|
||||
slist_.push_front(*p);
|
||||
@@ -258,10 +258,10 @@ class private_node_pool_impl
|
||||
is_between(const void *addr, std::size_t size)
|
||||
: beg_(static_cast<const char *>(addr)), end_(beg_+size)
|
||||
{}
|
||||
|
||||
|
||||
bool operator()(typename free_nodes_t::const_reference v) const
|
||||
{
|
||||
return (beg_ <= reinterpret_cast<const char *>(&v) &&
|
||||
return (beg_ <= reinterpret_cast<const char *>(&v) &&
|
||||
end_ > reinterpret_cast<const char *>(&v));
|
||||
}
|
||||
private:
|
||||
@@ -299,7 +299,7 @@ class private_node_pool_impl
|
||||
{
|
||||
if(!num_blocks)
|
||||
return;
|
||||
size_type blocksize =
|
||||
size_type blocksize =
|
||||
get_rounded_size(m_real_node_size*m_nodes_per_block, (size_type)alignment_of<node_t>::value);
|
||||
|
||||
try{
|
||||
@@ -311,7 +311,7 @@ class private_node_pool_impl
|
||||
char *pBlock = pNode;
|
||||
m_blocklist.push_front(get_block_hook(pBlock, blocksize));
|
||||
|
||||
//We initialize all Nodes in Node Block to insert
|
||||
//We initialize all Nodes in Node Block to insert
|
||||
//them in the free Node list
|
||||
for(size_type i = 0; i < m_nodes_per_block; ++i, pNode += m_real_node_size){
|
||||
m_freelist.push_front(*new (pNode) node_t);
|
||||
@@ -335,13 +335,13 @@ class private_node_pool_impl
|
||||
private:
|
||||
//!Returns a reference to the block hook placed in the end of the block
|
||||
static node_t & get_block_hook (void *block, size_type blocksize)
|
||||
{
|
||||
return *reinterpret_cast<node_t*>(reinterpret_cast<char*>(block) + blocksize);
|
||||
{
|
||||
return *reinterpret_cast<node_t*>(reinterpret_cast<char*>(block) + blocksize);
|
||||
}
|
||||
|
||||
//!Returns the starting address of the block reference to the block hook placed in the end of the block
|
||||
void *get_block_from_hook (node_t *hook, size_type blocksize)
|
||||
{
|
||||
{
|
||||
return (reinterpret_cast<char*>(hook) - blocksize);
|
||||
}
|
||||
|
||||
|
@@ -35,7 +35,7 @@
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace container {
|
||||
namespace container {
|
||||
namespace container_detail {
|
||||
|
||||
template <class T1, class T2>
|
||||
@@ -313,8 +313,8 @@ inline void swap(pair<T1, T2>& x, pair<T1, T2>& y)
|
||||
swap(x.second, y.second);
|
||||
}
|
||||
|
||||
} //namespace container_detail {
|
||||
} //namespace container {
|
||||
} //namespace container_detail {
|
||||
} //namespace container {
|
||||
|
||||
|
||||
//Without this specialization recursive flat_(multi)map instantiation fails
|
||||
|
@@ -27,7 +27,7 @@
|
||||
//#error "This file is not needed when perfect forwarding is available"
|
||||
#endif //BOOST_CONTAINER_PERFECT_FORWARDING
|
||||
|
||||
#include <boost/preprocessor/iteration/local.hpp>
|
||||
#include <boost/preprocessor/iteration/local.hpp>
|
||||
#include <boost/preprocessor/punctuation/paren_if.hpp>
|
||||
#include <boost/preprocessor/punctuation/comma_if.hpp>
|
||||
#include <boost/preprocessor/control/expr_if.hpp>
|
||||
|
@@ -24,7 +24,7 @@
|
||||
#include <iterator>
|
||||
|
||||
namespace boost {
|
||||
namespace container {
|
||||
namespace container {
|
||||
|
||||
template <class PseudoReference>
|
||||
struct operator_arrow_proxy
|
||||
@@ -74,7 +74,7 @@ class transform_iterator
|
||||
{}
|
||||
|
||||
//Constructors
|
||||
transform_iterator& operator++()
|
||||
transform_iterator& operator++()
|
||||
{ increment(); return *this; }
|
||||
|
||||
transform_iterator operator++(int)
|
||||
@@ -168,7 +168,7 @@ make_transform_iterator(Iterator it, UnaryFunc fun)
|
||||
return transform_iterator<Iterator, UnaryFunc>(it, fun);
|
||||
}
|
||||
|
||||
} //namespace container {
|
||||
} //namespace container {
|
||||
} //namespace boost {
|
||||
|
||||
#include <boost/container/detail/config_end.hpp>
|
||||
|
@@ -45,7 +45,7 @@ struct value_compare_impl
|
||||
: public KeyCompare
|
||||
{
|
||||
typedef Value value_type;
|
||||
typedef KeyCompare key_compare;
|
||||
typedef KeyCompare key_compare;
|
||||
typedef KeyOfValue key_of_value;
|
||||
typedef Key key_type;
|
||||
|
||||
@@ -203,13 +203,13 @@ struct intrusive_rbtree_type
|
||||
|
||||
namespace container_detail {
|
||||
|
||||
template <class Key, class Value, class KeyOfValue,
|
||||
template <class Key, class Value, class KeyOfValue,
|
||||
class KeyCompare, class A>
|
||||
class rbtree
|
||||
: protected container_detail::node_alloc_holder
|
||||
< A
|
||||
, typename container_detail::intrusive_rbtree_type
|
||||
<A, value_compare_impl<Key, Value, KeyCompare, KeyOfValue>
|
||||
<A, value_compare_impl<Key, Value, KeyCompare, KeyOfValue>
|
||||
>::type
|
||||
, KeyCompare
|
||||
>
|
||||
@@ -218,7 +218,7 @@ class rbtree
|
||||
< A, value_compare_impl
|
||||
<Key, Value, KeyCompare, KeyOfValue>
|
||||
>::type Icont;
|
||||
typedef container_detail::node_alloc_holder
|
||||
typedef container_detail::node_alloc_holder
|
||||
<A, Icont, KeyCompare> AllocHolder;
|
||||
typedef typename AllocHolder::NodePtr NodePtr;
|
||||
typedef rbtree < Key, Value, KeyOfValue
|
||||
@@ -398,17 +398,17 @@ class rbtree
|
||||
{}
|
||||
|
||||
//Pointer like operators
|
||||
const_reference operator*() const
|
||||
const_reference operator*() const
|
||||
{ return m_it->get_data(); }
|
||||
|
||||
const_pointer operator->() const
|
||||
const_pointer operator->() const
|
||||
{ return const_pointer(&m_it->get_data()); }
|
||||
|
||||
//Increment / Decrement
|
||||
const_iterator& operator++()
|
||||
const_iterator& operator++()
|
||||
{ prot_incr(); return *this; }
|
||||
|
||||
const_iterator operator++(int)
|
||||
const_iterator operator++(int)
|
||||
{ iiterator tmp = m_it; ++*this; return const_iterator(tmp); }
|
||||
|
||||
const_iterator& operator--()
|
||||
@@ -432,7 +432,7 @@ class rbtree
|
||||
explicit iterator(iiterator it)
|
||||
: const_iterator(it)
|
||||
{}
|
||||
|
||||
|
||||
iiterator get()
|
||||
{ return this->m_it; }
|
||||
|
||||
@@ -451,12 +451,12 @@ class rbtree
|
||||
{ return boost::intrusive::pointer_traits<pointer>::pointer_to(this->m_it->get_data()); }
|
||||
|
||||
//Increment / Decrement
|
||||
iterator& operator++()
|
||||
iterator& operator++()
|
||||
{ this->prot_incr(); return *this; }
|
||||
|
||||
iterator operator++(int)
|
||||
{ iiterator tmp = this->m_it; ++*this; return iterator(tmp); }
|
||||
|
||||
|
||||
iterator& operator--()
|
||||
{ this->prot_decr(); return *this; }
|
||||
|
||||
@@ -493,18 +493,18 @@ class rbtree
|
||||
priv_create_and_insert_ordered_nodes(first, last, alloc_version(), ItCat());
|
||||
}
|
||||
|
||||
rbtree(const rbtree& x)
|
||||
rbtree(const rbtree& x)
|
||||
: AllocHolder(x, x.key_comp())
|
||||
{
|
||||
this->icont().clone_from
|
||||
(x.icont(), typename AllocHolder::cloner(*this), Destroyer(this->node_alloc()));
|
||||
}
|
||||
|
||||
rbtree(BOOST_RV_REF(rbtree) x)
|
||||
rbtree(BOOST_RV_REF(rbtree) x)
|
||||
: AllocHolder(::boost::move(static_cast<AllocHolder&>(x)), x.key_comp())
|
||||
{}
|
||||
|
||||
rbtree(const rbtree& x, const allocator_type &a)
|
||||
rbtree(const rbtree& x, const allocator_type &a)
|
||||
: AllocHolder(a, x.key_comp())
|
||||
{
|
||||
this->icont().clone_from
|
||||
@@ -593,18 +593,18 @@ class rbtree
|
||||
return *this;
|
||||
}
|
||||
|
||||
public:
|
||||
public:
|
||||
// accessors:
|
||||
value_compare value_comp() const
|
||||
value_compare value_comp() const
|
||||
{ return this->icont().value_comp().value_comp(); }
|
||||
|
||||
key_compare key_comp() const
|
||||
key_compare key_comp() const
|
||||
{ return this->icont().value_comp().value_comp().key_comp(); }
|
||||
|
||||
allocator_type get_allocator() const
|
||||
allocator_type get_allocator() const
|
||||
{ return allocator_type(this->node_alloc()); }
|
||||
|
||||
const stored_allocator_type &get_stored_allocator() const
|
||||
const stored_allocator_type &get_stored_allocator() const
|
||||
{ return this->node_alloc(); }
|
||||
|
||||
stored_allocator_type &get_stored_allocator()
|
||||
@@ -635,46 +635,46 @@ class rbtree
|
||||
{ return this->crend(); }
|
||||
|
||||
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the container.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_iterator cbegin() const
|
||||
const_iterator cbegin() const
|
||||
{ return const_iterator(this->non_const_icont().begin()); }
|
||||
|
||||
//! <b>Effects</b>: Returns a const_iterator to the end of the container.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_iterator cend() const
|
||||
const_iterator cend() const
|
||||
{ return const_iterator(this->non_const_icont().end()); }
|
||||
|
||||
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
|
||||
//! of the reversed container.
|
||||
//!
|
||||
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
|
||||
//! of the reversed container.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_reverse_iterator crbegin() const
|
||||
{ return const_reverse_iterator(cend()); }
|
||||
const_reverse_iterator crbegin() const
|
||||
{ return const_reverse_iterator(cend()); }
|
||||
|
||||
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
|
||||
//! of the reversed container.
|
||||
//!
|
||||
//! of the reversed container.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_reverse_iterator crend() const
|
||||
const_reverse_iterator crend() const
|
||||
{ return const_reverse_iterator(cbegin()); }
|
||||
|
||||
bool empty() const
|
||||
bool empty() const
|
||||
{ return !this->size(); }
|
||||
|
||||
size_type size() const
|
||||
size_type size() const
|
||||
{ return this->icont().size(); }
|
||||
|
||||
size_type max_size() const
|
||||
size_type max_size() const
|
||||
{ return AllocHolder::max_size(); }
|
||||
|
||||
void swap(ThisType& x)
|
||||
@@ -688,7 +688,7 @@ class rbtree
|
||||
std::pair<iterator,bool> insert_unique_check
|
||||
(const key_type& key, insert_commit_data &data)
|
||||
{
|
||||
std::pair<iiterator, bool> ret =
|
||||
std::pair<iiterator, bool> ret =
|
||||
this->icont().insert_unique_check(key, KeyNodeCompare(value_comp()), data);
|
||||
return std::pair<iterator, bool>(iterator(ret.first), ret.second);
|
||||
}
|
||||
@@ -696,7 +696,7 @@ class rbtree
|
||||
std::pair<iterator,bool> insert_unique_check
|
||||
(const_iterator hint, const key_type& key, insert_commit_data &data)
|
||||
{
|
||||
std::pair<iiterator, bool> ret =
|
||||
std::pair<iiterator, bool> ret =
|
||||
this->icont().insert_unique_check(hint.get(), key, KeyNodeCompare(value_comp()), data);
|
||||
return std::pair<iterator, bool>(iterator(ret.first), ret.second);
|
||||
}
|
||||
@@ -915,7 +915,7 @@ class rbtree
|
||||
iterator erase(const_iterator first, const_iterator last)
|
||||
{ return iterator(AllocHolder::erase_range(first.get(), last.get(), alloc_version())); }
|
||||
|
||||
void clear()
|
||||
void clear()
|
||||
{ AllocHolder::clear(alloc_version()); }
|
||||
|
||||
// set operations:
|
||||
@@ -941,14 +941,14 @@ class rbtree
|
||||
{ return const_iterator(this->non_const_icont().upper_bound(k, KeyNodeCompare(value_comp()))); }
|
||||
|
||||
std::pair<iterator,iterator> equal_range(const key_type& k)
|
||||
{
|
||||
{
|
||||
std::pair<iiterator, iiterator> ret =
|
||||
this->icont().equal_range(k, KeyNodeCompare(value_comp()));
|
||||
return std::pair<iterator,iterator>(iterator(ret.first), iterator(ret.second));
|
||||
}
|
||||
|
||||
std::pair<const_iterator, const_iterator> equal_range(const key_type& k) const
|
||||
{
|
||||
{
|
||||
std::pair<iiterator, iiterator> ret =
|
||||
this->non_const_icont().equal_range(k, KeyNodeCompare(value_comp()));
|
||||
return std::pair<const_iterator,const_iterator>
|
||||
@@ -1060,63 +1060,63 @@ class rbtree
|
||||
}
|
||||
};
|
||||
|
||||
template <class Key, class Value, class KeyOfValue,
|
||||
template <class Key, class Value, class KeyOfValue,
|
||||
class KeyCompare, class A>
|
||||
inline bool
|
||||
operator==(const rbtree<Key,Value,KeyOfValue,KeyCompare,A>& x,
|
||||
inline bool
|
||||
operator==(const rbtree<Key,Value,KeyOfValue,KeyCompare,A>& x,
|
||||
const rbtree<Key,Value,KeyOfValue,KeyCompare,A>& y)
|
||||
{
|
||||
return x.size() == y.size() &&
|
||||
std::equal(x.begin(), x.end(), y.begin());
|
||||
}
|
||||
|
||||
template <class Key, class Value, class KeyOfValue,
|
||||
template <class Key, class Value, class KeyOfValue,
|
||||
class KeyCompare, class A>
|
||||
inline bool
|
||||
operator<(const rbtree<Key,Value,KeyOfValue,KeyCompare,A>& x,
|
||||
inline bool
|
||||
operator<(const rbtree<Key,Value,KeyOfValue,KeyCompare,A>& x,
|
||||
const rbtree<Key,Value,KeyOfValue,KeyCompare,A>& y)
|
||||
{
|
||||
return std::lexicographical_compare(x.begin(), x.end(),
|
||||
return std::lexicographical_compare(x.begin(), x.end(),
|
||||
y.begin(), y.end());
|
||||
}
|
||||
|
||||
template <class Key, class Value, class KeyOfValue,
|
||||
template <class Key, class Value, class KeyOfValue,
|
||||
class KeyCompare, class A>
|
||||
inline bool
|
||||
operator!=(const rbtree<Key,Value,KeyOfValue,KeyCompare,A>& x,
|
||||
inline bool
|
||||
operator!=(const rbtree<Key,Value,KeyOfValue,KeyCompare,A>& x,
|
||||
const rbtree<Key,Value,KeyOfValue,KeyCompare,A>& y) {
|
||||
return !(x == y);
|
||||
}
|
||||
|
||||
template <class Key, class Value, class KeyOfValue,
|
||||
template <class Key, class Value, class KeyOfValue,
|
||||
class KeyCompare, class A>
|
||||
inline bool
|
||||
operator>(const rbtree<Key,Value,KeyOfValue,KeyCompare,A>& x,
|
||||
inline bool
|
||||
operator>(const rbtree<Key,Value,KeyOfValue,KeyCompare,A>& x,
|
||||
const rbtree<Key,Value,KeyOfValue,KeyCompare,A>& y) {
|
||||
return y < x;
|
||||
}
|
||||
|
||||
template <class Key, class Value, class KeyOfValue,
|
||||
template <class Key, class Value, class KeyOfValue,
|
||||
class KeyCompare, class A>
|
||||
inline bool
|
||||
operator<=(const rbtree<Key,Value,KeyOfValue,KeyCompare,A>& x,
|
||||
inline bool
|
||||
operator<=(const rbtree<Key,Value,KeyOfValue,KeyCompare,A>& x,
|
||||
const rbtree<Key,Value,KeyOfValue,KeyCompare,A>& y) {
|
||||
return !(y < x);
|
||||
}
|
||||
|
||||
template <class Key, class Value, class KeyOfValue,
|
||||
template <class Key, class Value, class KeyOfValue,
|
||||
class KeyCompare, class A>
|
||||
inline bool
|
||||
operator>=(const rbtree<Key,Value,KeyOfValue,KeyCompare,A>& x,
|
||||
inline bool
|
||||
operator>=(const rbtree<Key,Value,KeyOfValue,KeyCompare,A>& x,
|
||||
const rbtree<Key,Value,KeyOfValue,KeyCompare,A>& y) {
|
||||
return !(x < y);
|
||||
}
|
||||
|
||||
|
||||
template <class Key, class Value, class KeyOfValue,
|
||||
template <class Key, class Value, class KeyOfValue,
|
||||
class KeyCompare, class A>
|
||||
inline void
|
||||
swap(rbtree<Key,Value,KeyOfValue,KeyCompare,A>& x,
|
||||
inline void
|
||||
swap(rbtree<Key,Value,KeyOfValue,KeyCompare,A>& x,
|
||||
rbtree<Key,Value,KeyOfValue,KeyCompare,A>& y)
|
||||
{
|
||||
x.swap(y);
|
||||
@@ -1127,7 +1127,7 @@ swap(rbtree<Key,Value,KeyOfValue,KeyCompare,A>& x,
|
||||
/*
|
||||
//!has_trivial_destructor_after_move<> == true_type
|
||||
//!specialization for optimizations
|
||||
template <class K, class V, class KOV,
|
||||
template <class K, class V, class KOV,
|
||||
class C, class A>
|
||||
struct has_trivial_destructor_after_move
|
||||
<boost::container::container_detail::rbtree<K, V, KOV, C, A> >
|
||||
|
@@ -24,7 +24,7 @@
|
||||
#include <boost/move/move.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace container {
|
||||
namespace container {
|
||||
namespace container_detail {
|
||||
|
||||
struct nat{};
|
||||
@@ -202,7 +202,7 @@ struct remove_ref_const
|
||||
};
|
||||
|
||||
} // namespace container_detail
|
||||
} //namespace container {
|
||||
} //namespace container {
|
||||
} //namespace boost {
|
||||
|
||||
#include <boost/container/detail/config_end.hpp>
|
||||
|
@@ -150,7 +150,7 @@ enum {
|
||||
&& !::boost::is_fundamental<_TypeT>::value
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
*/
|
||||
|
||||
template<class T>
|
||||
@@ -233,7 +233,7 @@ F uninitialized_copy_alloc(A &a, I f, I l, F r)
|
||||
template
|
||||
<typename A,
|
||||
typename F, // F models ForwardIterator
|
||||
typename T>
|
||||
typename T>
|
||||
void uninitialized_fill_alloc(A &a, F f, F l, const T &t)
|
||||
{
|
||||
while (f != l) {
|
||||
|
@@ -21,7 +21,7 @@
|
||||
#include <boost/container/detail/workaround.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace container {
|
||||
namespace container {
|
||||
namespace container_detail {
|
||||
|
||||
template<class T>
|
||||
@@ -36,8 +36,8 @@ struct value_init
|
||||
T m_t;
|
||||
};
|
||||
|
||||
} //namespace container_detail {
|
||||
} //namespace container {
|
||||
} //namespace container_detail {
|
||||
} //namespace container {
|
||||
} //namespace boost {
|
||||
|
||||
#include <boost/container/detail/config_end.hpp>
|
||||
|
@@ -21,7 +21,7 @@
|
||||
#include <cstddef> //std::size_t
|
||||
|
||||
namespace boost {
|
||||
namespace container {
|
||||
namespace container {
|
||||
namespace container_detail {
|
||||
|
||||
template<typename... Values>
|
||||
@@ -136,7 +136,7 @@ struct index_tuple{};
|
||||
template<std::size_t Num, typename Tuple = index_tuple<> >
|
||||
struct build_number_seq;
|
||||
|
||||
template<std::size_t Num, int... Indexes>
|
||||
template<std::size_t Num, int... Indexes>
|
||||
struct build_number_seq<Num, index_tuple<Indexes...> >
|
||||
: build_number_seq<Num - 1, index_tuple<Indexes..., sizeof...(Indexes)> >
|
||||
{};
|
||||
|
@@ -38,7 +38,7 @@ struct version_type
|
||||
|
||||
namespace impl{
|
||||
|
||||
template <class T,
|
||||
template <class T,
|
||||
bool = container_detail::is_convertible<version_type<T, 0>, typename T::version>::value>
|
||||
struct extract_version
|
||||
{
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -32,7 +32,7 @@
|
||||
#if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
|
||||
#else
|
||||
//Preprocessor library to emulate perfect forwarding
|
||||
#include <boost/container/detail/preprocessor.hpp>
|
||||
#include <boost/container/detail/preprocessor.hpp>
|
||||
#endif
|
||||
|
||||
#include <stdexcept>
|
||||
@@ -98,26 +98,26 @@ struct intrusive_list_type
|
||||
/// @endcond
|
||||
|
||||
//! A list is a doubly linked list. That is, it is a Sequence that supports both
|
||||
//! forward and backward traversal, and (amortized) constant time insertion and
|
||||
//! removal of elements at the beginning or the end, or in the middle. Lists have
|
||||
//! the important property that insertion and splicing do not invalidate iterators
|
||||
//! to list elements, and that even removal invalidates only the iterators that point
|
||||
//! to the elements that are removed. The ordering of iterators may be changed
|
||||
//! (that is, list<T>::iterator might have a different predecessor or successor
|
||||
//! after a list operation than it did before), but the iterators themselves will
|
||||
//! not be invalidated or made to point to different elements unless that invalidation
|
||||
//! forward and backward traversal, and (amortized) constant time insertion and
|
||||
//! removal of elements at the beginning or the end, or in the middle. Lists have
|
||||
//! the important property that insertion and splicing do not invalidate iterators
|
||||
//! to list elements, and that even removal invalidates only the iterators that point
|
||||
//! to the elements that are removed. The ordering of iterators may be changed
|
||||
//! (that is, list<T>::iterator might have a different predecessor or successor
|
||||
//! after a list operation than it did before), but the iterators themselves will
|
||||
//! not be invalidated or made to point to different elements unless that invalidation
|
||||
//! or mutation is explicit.
|
||||
#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
|
||||
template <class T, class A = std::allocator<T> >
|
||||
#else
|
||||
template <class T, class A>
|
||||
#endif
|
||||
class list
|
||||
class list
|
||||
: protected container_detail::node_alloc_holder
|
||||
<A, typename container_detail::intrusive_list_type<A>::type>
|
||||
{
|
||||
/// @cond
|
||||
typedef typename
|
||||
typedef typename
|
||||
container_detail::intrusive_list_type<A>::type Icont;
|
||||
typedef list <T, A> ThisType;
|
||||
typedef container_detail::node_alloc_holder<A, Icont> AllocHolder;
|
||||
@@ -192,11 +192,11 @@ class list
|
||||
/// @endcond
|
||||
|
||||
public:
|
||||
//! Const iterator used to iterate through a list.
|
||||
//! Const iterator used to iterate through a list.
|
||||
class const_iterator
|
||||
/// @cond
|
||||
: public std::iterator<std::bidirectional_iterator_tag,
|
||||
value_type, list_difference_type,
|
||||
: public std::iterator<std::bidirectional_iterator_tag,
|
||||
value_type, list_difference_type,
|
||||
list_const_pointer, list_const_reference>
|
||||
{
|
||||
|
||||
@@ -220,17 +220,17 @@ class list
|
||||
{}
|
||||
|
||||
//Pointer like operators
|
||||
const_reference operator*() const
|
||||
const_reference operator*() const
|
||||
{ return m_it->m_data; }
|
||||
|
||||
const_pointer operator->() const
|
||||
const_pointer operator->() const
|
||||
{ return const_pointer(&m_it->m_data); }
|
||||
|
||||
//Increment / Decrement
|
||||
const_iterator& operator++()
|
||||
const_iterator& operator++()
|
||||
{ prot_incr(); return *this; }
|
||||
|
||||
const_iterator operator++(int)
|
||||
const_iterator operator++(int)
|
||||
{ typename Icont::iterator tmp = m_it; ++*this; return const_iterator(tmp); }
|
||||
|
||||
const_iterator& operator--()
|
||||
@@ -259,7 +259,7 @@ class list
|
||||
explicit iterator(typename Icont::iterator it)
|
||||
: const_iterator(it)
|
||||
{}
|
||||
|
||||
|
||||
typename Icont::iterator get()
|
||||
{ return this->m_it; }
|
||||
|
||||
@@ -276,12 +276,12 @@ class list
|
||||
pointer operator->() const { return pointer(&this->m_it->m_data); }
|
||||
|
||||
//Increment / Decrement
|
||||
iterator& operator++()
|
||||
iterator& operator++()
|
||||
{ this->prot_incr(); return *this; }
|
||||
|
||||
iterator operator++(int)
|
||||
{ typename Icont::iterator tmp = this->m_it; ++*this; return iterator(tmp); }
|
||||
|
||||
|
||||
iterator& operator--()
|
||||
{ this->prot_decr(); return *this; }
|
||||
|
||||
@@ -290,24 +290,24 @@ class list
|
||||
};
|
||||
/// @endcond
|
||||
|
||||
//! Iterator used to iterate backwards through a list.
|
||||
//! Iterator used to iterate backwards through a list.
|
||||
typedef std::reverse_iterator<iterator> reverse_iterator;
|
||||
//! Const iterator used to iterate backwards through a list.
|
||||
//! Const iterator used to iterate backwards through a list.
|
||||
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
|
||||
//! <b>Effects</b>: Default constructs a list.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: If allocator_type's default constructor throws.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
list()
|
||||
list()
|
||||
: AllocHolder()
|
||||
{}
|
||||
|
||||
//! <b>Effects</b>: Constructs a list taking the allocator as parameter.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: If allocator_type's copy constructor throws.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
explicit list(const allocator_type &a)
|
||||
: AllocHolder(a)
|
||||
@@ -318,7 +318,7 @@ class list
|
||||
//!
|
||||
//! <b>Throws</b>: If allocator_type's default constructor or copy constructor
|
||||
//! throws or T's default or copy constructor throws.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear to n.
|
||||
explicit list(size_type n)
|
||||
: AllocHolder(A())
|
||||
@@ -329,7 +329,7 @@ class list
|
||||
//!
|
||||
//! <b>Throws</b>: If allocator_type's default constructor or copy constructor
|
||||
//! throws or T's default or copy constructor throws.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear to n.
|
||||
list(size_type n, const T& value, const A& a = A())
|
||||
: AllocHolder(a)
|
||||
@@ -338,18 +338,18 @@ class list
|
||||
//! <b>Effects</b>: Copy constructs a list.
|
||||
//!
|
||||
//! <b>Postcondition</b>: x == *this.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: If allocator_type's default constructor or copy constructor throws.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear to the elements x contains.
|
||||
list(const list& x)
|
||||
list(const list& x)
|
||||
: AllocHolder(x)
|
||||
{ this->insert(this->cbegin(), x.begin(), x.end()); }
|
||||
|
||||
//! <b>Effects</b>: Move constructor. Moves mx's resources to *this.
|
||||
//!
|
||||
//! <b>Throws</b>: If allocator_type's copy constructor throws.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
list(BOOST_RV_REF(list) x)
|
||||
: AllocHolder(boost::move(static_cast<AllocHolder&>(x)))
|
||||
@@ -358,11 +358,11 @@ class list
|
||||
//! <b>Effects</b>: Copy constructs a list using the specified allocator.
|
||||
//!
|
||||
//! <b>Postcondition</b>: x == *this.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: If allocator_type's default constructor or copy constructor throws.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear to the elements x contains.
|
||||
list(const list& x, const allocator_type &a)
|
||||
list(const list& x, const allocator_type &a)
|
||||
: AllocHolder(a)
|
||||
{ this->insert(this->cbegin(), x.begin(), x.end()); }
|
||||
|
||||
@@ -370,7 +370,7 @@ class list
|
||||
//! Moves mx's resources to *this.
|
||||
//!
|
||||
//! <b>Throws</b>: If allocation or value_type's copy constructor throws.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant if a == x.get_allocator(), linear otherwise.
|
||||
list(BOOST_RV_REF(list) x, const allocator_type &a)
|
||||
: AllocHolder(a)
|
||||
@@ -405,14 +405,14 @@ class list
|
||||
{} //AllocHolder clears the list
|
||||
|
||||
//! <b>Effects</b>: Returns a copy of the internal allocator.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: If allocator's copy constructor throws.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
allocator_type get_allocator() const
|
||||
{ return allocator_type(this->node_alloc()); }
|
||||
|
||||
const stored_allocator_type &get_stored_allocator() const
|
||||
const stored_allocator_type &get_stored_allocator() const
|
||||
{ return this->node_alloc(); }
|
||||
|
||||
stored_allocator_type &get_stored_allocator()
|
||||
@@ -427,129 +427,129 @@ class list
|
||||
{ AllocHolder::clear(alloc_version()); }
|
||||
|
||||
//! <b>Effects</b>: Returns an iterator to the first element contained in the list.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
iterator begin()
|
||||
{ return iterator(this->icont().begin()); }
|
||||
|
||||
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the list.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_iterator begin() const
|
||||
{ return this->cbegin(); }
|
||||
|
||||
//! <b>Effects</b>: Returns an iterator to the end of the list.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
iterator end()
|
||||
{ return iterator(this->icont().end()); }
|
||||
|
||||
//! <b>Effects</b>: Returns a const_iterator to the end of the list.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_iterator end() const
|
||||
{ return this->cend(); }
|
||||
|
||||
//! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning
|
||||
//! of the reversed list.
|
||||
//!
|
||||
//! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning
|
||||
//! of the reversed list.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
reverse_iterator rbegin()
|
||||
{ return reverse_iterator(end()); }
|
||||
|
||||
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
|
||||
//! of the reversed list.
|
||||
//!
|
||||
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
|
||||
//! of the reversed list.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_reverse_iterator rbegin() const
|
||||
{ return this->crbegin(); }
|
||||
|
||||
//! <b>Effects</b>: Returns a reverse_iterator pointing to the end
|
||||
//! of the reversed list.
|
||||
//!
|
||||
//! of the reversed list.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
reverse_iterator rend()
|
||||
{ return reverse_iterator(begin()); }
|
||||
|
||||
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
|
||||
//! of the reversed list.
|
||||
//!
|
||||
//! of the reversed list.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_reverse_iterator rend() const
|
||||
{ return this->crend(); }
|
||||
|
||||
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the list.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_iterator cbegin() const
|
||||
{ return const_iterator(this->non_const_icont().begin()); }
|
||||
|
||||
//! <b>Effects</b>: Returns a const_iterator to the end of the list.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_iterator cend() const
|
||||
{ return const_iterator(this->non_const_icont().end()); }
|
||||
|
||||
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
|
||||
//! of the reversed list.
|
||||
//!
|
||||
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
|
||||
//! of the reversed list.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_reverse_iterator crbegin() const
|
||||
{ return const_reverse_iterator(this->cend()); }
|
||||
|
||||
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
|
||||
//! of the reversed list.
|
||||
//!
|
||||
//! of the reversed list.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_reverse_iterator crend() const
|
||||
{ return const_reverse_iterator(this->cbegin()); }
|
||||
|
||||
//! <b>Effects</b>: Returns true if the list contains no elements.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
bool empty() const
|
||||
bool empty() const
|
||||
{ return !this->size(); }
|
||||
|
||||
//! <b>Effects</b>: Returns the number of the elements contained in the list.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
size_type size() const
|
||||
size_type size() const
|
||||
{ return this->icont().size(); }
|
||||
|
||||
//! <b>Effects</b>: Returns the largest possible size of the list.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
size_type max_size() const
|
||||
size_type max_size() const
|
||||
{ return AllocHolder::max_size(); }
|
||||
|
||||
#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
|
||||
@@ -597,7 +597,7 @@ class list
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//! <b>Complexity</b>: Amortized constant time.
|
||||
void pop_front()
|
||||
void pop_front()
|
||||
{ this->erase(this->cbegin()); }
|
||||
|
||||
//! <b>Effects</b>: Removes the last element from the list.
|
||||
@@ -605,51 +605,51 @@ class list
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//! <b>Complexity</b>: Amortized constant time.
|
||||
void pop_back()
|
||||
void pop_back()
|
||||
{ const_iterator tmp = this->cend(); this->erase(--tmp); }
|
||||
|
||||
//! <b>Requires</b>: !empty()
|
||||
//!
|
||||
//! <b>Effects</b>: Returns a reference to the first element
|
||||
//! <b>Effects</b>: Returns a reference to the first element
|
||||
//! from the beginning of the container.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
reference front()
|
||||
reference front()
|
||||
{ return *this->begin(); }
|
||||
|
||||
//! <b>Requires</b>: !empty()
|
||||
//!
|
||||
//! <b>Effects</b>: Returns a const reference to the first element
|
||||
//! <b>Effects</b>: Returns a const reference to the first element
|
||||
//! from the beginning of the container.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_reference front() const
|
||||
const_reference front() const
|
||||
{ return *this->begin(); }
|
||||
|
||||
//! <b>Requires</b>: !empty()
|
||||
//!
|
||||
//! <b>Effects</b>: Returns a reference to the first element
|
||||
//! <b>Effects</b>: Returns a reference to the first element
|
||||
//! from the beginning of the container.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
reference back()
|
||||
reference back()
|
||||
{ return *(--this->end()); }
|
||||
|
||||
//! <b>Requires</b>: !empty()
|
||||
//!
|
||||
//! <b>Effects</b>: Returns a const reference to the first element
|
||||
//! <b>Effects</b>: Returns a const reference to the first element
|
||||
//! from the beginning of the container.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_reference back() const
|
||||
const_reference back() const
|
||||
{ return *(--this->end()); }
|
||||
|
||||
//! <b>Effects</b>: Inserts or erases elements at the end such that
|
||||
@@ -662,7 +662,7 @@ class list
|
||||
{
|
||||
const_iterator iend = this->cend();
|
||||
size_type len = this->size();
|
||||
|
||||
|
||||
if(len > new_size){
|
||||
size_type to_erase = len - new_size;
|
||||
while(to_erase--){
|
||||
@@ -685,7 +685,7 @@ class list
|
||||
{
|
||||
const_iterator iend = this->end();
|
||||
size_type len = this->size();
|
||||
|
||||
|
||||
if(len > new_size){
|
||||
size_type to_erase = len - new_size;
|
||||
const_iterator ifirst;
|
||||
@@ -719,8 +719,8 @@ class list
|
||||
|
||||
//! <b>Effects</b>: Makes *this contain the same elements as x.
|
||||
//!
|
||||
//! <b>Postcondition</b>: this->size() == x.size(). *this contains a copy
|
||||
//! of each of x's elements.
|
||||
//! <b>Postcondition</b>: this->size() == x.size(). *this contains a copy
|
||||
//! of each of x's elements.
|
||||
//!
|
||||
//! <b>Throws</b>: If memory allocation throws or T's copy constructor throws.
|
||||
//!
|
||||
@@ -791,7 +791,7 @@ class list
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear to std::distance [first, last).
|
||||
template <class InpIt>
|
||||
void insert(const_iterator p, InpIt first, InpIt last)
|
||||
void insert(const_iterator p, InpIt first, InpIt last)
|
||||
{
|
||||
const bool aux_boolean = container_detail::is_convertible<InpIt, size_type>::value;
|
||||
typedef container_detail::bool_<aux_boolean> Result;
|
||||
@@ -900,7 +900,7 @@ class list
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//! <b>Complexity</b>: Amortized constant time.
|
||||
iterator erase(const_iterator p)
|
||||
iterator erase(const_iterator p)
|
||||
{ return iterator(this->icont().erase_and_dispose(p.get(), Destroyer(this->node_alloc()))); }
|
||||
|
||||
//! <b>Requires</b>: first and last must be valid iterator to elements in *this.
|
||||
@@ -918,7 +918,7 @@ class list
|
||||
//! <b>Throws</b>: If memory allocation throws or T's copy constructor throws.
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear to n.
|
||||
void assign(size_type n, const T& val)
|
||||
void assign(size_type n, const T& val)
|
||||
{ this->priv_fill_assign(n, val); }
|
||||
|
||||
//! <b>Effects</b>: Assigns the the range [first, last) to *this.
|
||||
@@ -928,7 +928,7 @@ class list
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear to n.
|
||||
template <class InpIt>
|
||||
void assign(InpIt first, InpIt last)
|
||||
void assign(InpIt first, InpIt last)
|
||||
{
|
||||
const bool aux_boolean = container_detail::is_convertible<InpIt, size_type>::value;
|
||||
typedef container_detail::bool_<aux_boolean> Result;
|
||||
@@ -945,7 +945,7 @@ class list
|
||||
//! are not equal.
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
//!
|
||||
//!
|
||||
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of
|
||||
//! this list. Iterators of this list and all the references are not invalidated.
|
||||
void splice(const_iterator p, ThisType& x) BOOST_CONTAINER_NOEXCEPT
|
||||
@@ -956,16 +956,16 @@ class list
|
||||
|
||||
//! <b>Requires</b>: p must point to an element contained
|
||||
//! by this list. i must point to an element contained in list x.
|
||||
//!
|
||||
//! <b>Effects</b>: Transfers the value pointed by i, from list x to this list,
|
||||
//!
|
||||
//! <b>Effects</b>: Transfers the value pointed by i, from list x to this list,
|
||||
//! before the the element pointed by p. No destructors or copy constructors are called.
|
||||
//! If p == i or p == ++i, this function is a null operation.
|
||||
//!
|
||||
//! If p == i or p == ++i, this function is a null operation.
|
||||
//!
|
||||
//! <b>Throws</b>: std::runtime_error if this' allocator and x's allocator
|
||||
//! are not equal.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
//!
|
||||
//!
|
||||
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
|
||||
//! list. Iterators of this list and all the references are not invalidated.
|
||||
void splice(const_iterator p, ThisType &x, const_iterator i) BOOST_CONTAINER_NOEXCEPT
|
||||
@@ -976,15 +976,15 @@ class list
|
||||
|
||||
//! <b>Requires</b>: p must point to an element contained
|
||||
//! by this list. first and last must point to elements contained in list x.
|
||||
//!
|
||||
//! <b>Effects</b>: Transfers the range pointed by first and last from list x to this list,
|
||||
//!
|
||||
//! <b>Effects</b>: Transfers the range pointed by first and last from list x to this list,
|
||||
//! before the the element pointed by p. No destructors or copy constructors are called.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: std::runtime_error if this' allocator and x's allocator
|
||||
//! are not equal.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear to the number of elements transferred.
|
||||
//!
|
||||
//!
|
||||
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
|
||||
//! list. Iterators of this list and all the references are not invalidated.
|
||||
void splice(const_iterator p, ThisType &x, const_iterator first, const_iterator last) BOOST_CONTAINER_NOEXCEPT
|
||||
@@ -996,15 +996,15 @@ class list
|
||||
//! <b>Requires</b>: p must point to an element contained
|
||||
//! by this list. first and last must point to elements contained in list x.
|
||||
//! n == std::distance(first, last)
|
||||
//!
|
||||
//! <b>Effects</b>: Transfers the range pointed by first and last from list x to this list,
|
||||
//!
|
||||
//! <b>Effects</b>: Transfers the range pointed by first and last from list x to this list,
|
||||
//! before the the element pointed by p. No destructors or copy constructors are called.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: std::runtime_error if this' allocator and x's allocator
|
||||
//! are not equal.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
//!
|
||||
//!
|
||||
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
|
||||
//! list. Iterators of this list and all the references are not invalidated.
|
||||
void splice(const_iterator p, ThisType &x, const_iterator first, const_iterator last, size_type n) BOOST_CONTAINER_NOEXCEPT
|
||||
@@ -1013,22 +1013,22 @@ class list
|
||||
this->icont().splice(p.get(), x.icont(), first.get(), last.get(), n);
|
||||
}
|
||||
|
||||
//! <b>Effects</b>: Reverses the order of elements in the list.
|
||||
//!
|
||||
//! <b>Effects</b>: Reverses the order of elements in the list.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: This function is linear time.
|
||||
//!
|
||||
//!
|
||||
//! <b>Note</b>: Iterators and references are not invalidated
|
||||
void reverse()
|
||||
{ this->icont().reverse(); }
|
||||
{ this->icont().reverse(); }
|
||||
|
||||
//! <b>Effects</b>: Removes all the elements that compare equal to value.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear time. It performs exactly size() comparisons for equality.
|
||||
//!
|
||||
//!
|
||||
//! <b>Note</b>: The relative order of elements that are not removed is unchanged,
|
||||
//! and iterators to elements that are not removed remain valid.
|
||||
void remove(const T& value)
|
||||
@@ -1036,11 +1036,11 @@ class list
|
||||
|
||||
//! <b>Effects</b>: Removes all the elements for which a specified
|
||||
//! predicate is satisfied.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: If pred throws.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear time. It performs exactly size() calls to the predicate.
|
||||
//!
|
||||
//!
|
||||
//! <b>Note</b>: The relative order of elements that are not removed is unchanged,
|
||||
//! and iterators to elements that are not removed remain valid.
|
||||
template <class Pred>
|
||||
@@ -1050,25 +1050,25 @@ class list
|
||||
this->icont().remove_and_dispose_if(Predicate(pred), Destroyer(this->node_alloc()));
|
||||
}
|
||||
|
||||
//! <b>Effects</b>: Removes adjacent duplicate elements or adjacent
|
||||
//! <b>Effects</b>: Removes adjacent duplicate elements or adjacent
|
||||
//! elements that are equal from the list.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear time (size()-1 comparisons calls to pred()).
|
||||
//!
|
||||
//!
|
||||
//! <b>Note</b>: The relative order of elements that are not removed is unchanged,
|
||||
//! and iterators to elements that are not removed remain valid.
|
||||
void unique()
|
||||
{ this->unique(value_equal()); }
|
||||
|
||||
//! <b>Effects</b>: Removes adjacent duplicate elements or adjacent
|
||||
//! <b>Effects</b>: Removes adjacent duplicate elements or adjacent
|
||||
//! elements that satisfy some binary predicate from the list.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: If pred throws.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear time (size()-1 comparisons equality comparisons).
|
||||
//!
|
||||
//!
|
||||
//! <b>Note</b>: The relative order of elements that are not removed is unchanged,
|
||||
//! and iterators to elements that are not removed remain valid.
|
||||
template <class BinaryPredicate>
|
||||
@@ -1078,15 +1078,15 @@ class list
|
||||
this->icont().unique_and_dispose(Predicate(binary_pred), Destroyer(this->node_alloc()));
|
||||
}
|
||||
|
||||
//! <b>Requires</b>: The lists x and *this must be distinct.
|
||||
//! <b>Requires</b>: The lists x and *this must be distinct.
|
||||
//!
|
||||
//! <b>Effects</b>: This function removes all of x's elements and inserts them
|
||||
//! in order into *this according to std::less<value_type>. The merge is stable;
|
||||
//! that is, if an element from *this is equivalent to one from x, then the element
|
||||
//! from *this will precede the one from x.
|
||||
//!
|
||||
//! in order into *this according to std::less<value_type>. The merge is stable;
|
||||
//! that is, if an element from *this is equivalent to one from x, then the element
|
||||
//! from *this will precede the one from x.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: This function is linear time: it performs at most
|
||||
//! size() + x.size() - 1 comparisons.
|
||||
void merge(list<T, A>& x)
|
||||
@@ -1094,17 +1094,17 @@ class list
|
||||
|
||||
//! <b>Requires</b>: p must be a comparison function that induces a strict weak
|
||||
//! ordering and both *this and x must be sorted according to that ordering
|
||||
//! The lists x and *this must be distinct.
|
||||
//!
|
||||
//! The lists x and *this must be distinct.
|
||||
//!
|
||||
//! <b>Effects</b>: This function removes all of x's elements and inserts them
|
||||
//! in order into *this. The merge is stable; that is, if an element from *this is
|
||||
//! equivalent to one from x, then the element from *this will precede the one from x.
|
||||
//!
|
||||
//! in order into *this. The merge is stable; that is, if an element from *this is
|
||||
//! equivalent to one from x, then the element from *this will precede the one from x.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: This function is linear time: it performs at most
|
||||
//! size() + x.size() - 1 comparisons.
|
||||
//!
|
||||
//!
|
||||
//! <b>Note</b>: Iterators and references to *this are not invalidated.
|
||||
template <class StrictWeakOrdering>
|
||||
void merge(list &x, StrictWeakOrdering comp)
|
||||
@@ -1118,25 +1118,25 @@ class list
|
||||
}
|
||||
}
|
||||
|
||||
//! <b>Effects</b>: This function sorts the list *this according to std::less<value_type>.
|
||||
//! <b>Effects</b>: This function sorts the list *this according to std::less<value_type>.
|
||||
//! The sort is stable, that is, the relative order of equivalent elements is preserved.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//! <b>Notes</b>: Iterators and references are not invalidated.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: The number of comparisons is approximately N log N, where N
|
||||
//! is the list's size.
|
||||
void sort()
|
||||
{ this->sort(value_less()); }
|
||||
|
||||
//! <b>Effects</b>: This function sorts the list *this according to std::less<value_type>.
|
||||
//! <b>Effects</b>: This function sorts the list *this according to std::less<value_type>.
|
||||
//! The sort is stable, that is, the relative order of equivalent elements is preserved.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//! <b>Notes</b>: Iterators and references are not invalidated.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: The number of comparisons is approximately N log N, where N
|
||||
//! is the list's size.
|
||||
template <class StrictWeakOrdering>
|
||||
@@ -1151,25 +1151,25 @@ class list
|
||||
/// @cond
|
||||
private:
|
||||
|
||||
iterator priv_insert(const_iterator p, const T &x)
|
||||
iterator priv_insert(const_iterator p, const T &x)
|
||||
{
|
||||
NodePtr tmp = AllocHolder::create_node(x);
|
||||
return iterator(this->icont().insert(p.get(), *tmp));
|
||||
}
|
||||
|
||||
iterator priv_insert(const_iterator p, BOOST_RV_REF(T) x)
|
||||
iterator priv_insert(const_iterator p, BOOST_RV_REF(T) x)
|
||||
{
|
||||
NodePtr tmp = AllocHolder::create_node(boost::move(x));
|
||||
return iterator(this->icont().insert(p.get(), *tmp));
|
||||
}
|
||||
|
||||
void priv_push_back (const T &x)
|
||||
void priv_push_back (const T &x)
|
||||
{ this->insert(this->cend(), x); }
|
||||
|
||||
void priv_push_back (BOOST_RV_REF(T) x)
|
||||
{ this->insert(this->cend(), boost::move(x)); }
|
||||
|
||||
void priv_push_front (const T &x)
|
||||
void priv_push_front (const T &x)
|
||||
{ this->insert(this->cbegin(), x); }
|
||||
|
||||
void priv_push_front (BOOST_RV_REF(T) x)
|
||||
@@ -1251,10 +1251,10 @@ class list
|
||||
{ this->priv_create_and_insert_nodes(p, first, last); }
|
||||
|
||||
template<class Integer>
|
||||
void priv_insert_dispatch(const_iterator p, Integer n, Integer x, container_detail::true_)
|
||||
void priv_insert_dispatch(const_iterator p, Integer n, Integer x, container_detail::true_)
|
||||
{ this->insert(p, (size_type)n, x); }
|
||||
|
||||
void priv_fill_assign(size_type n, const T& val)
|
||||
void priv_fill_assign(size_type n, const T& val)
|
||||
{
|
||||
iterator i = this->begin(), iend = this->end();
|
||||
|
||||
@@ -1328,25 +1328,25 @@ inline bool operator<(const list<T,A>& x,
|
||||
}
|
||||
|
||||
template <class T, class A>
|
||||
inline bool operator!=(const list<T,A>& x, const list<T,A>& y)
|
||||
inline bool operator!=(const list<T,A>& x, const list<T,A>& y)
|
||||
{
|
||||
return !(x == y);
|
||||
}
|
||||
|
||||
template <class T, class A>
|
||||
inline bool operator>(const list<T,A>& x, const list<T,A>& y)
|
||||
inline bool operator>(const list<T,A>& x, const list<T,A>& y)
|
||||
{
|
||||
return y < x;
|
||||
}
|
||||
|
||||
template <class T, class A>
|
||||
inline bool operator<=(const list<T,A>& x, const list<T,A>& y)
|
||||
inline bool operator<=(const list<T,A>& x, const list<T,A>& y)
|
||||
{
|
||||
return !(y < x);
|
||||
}
|
||||
|
||||
template <class T, class A>
|
||||
inline bool operator>=(const list<T,A>& x, const list<T,A>& y)
|
||||
inline bool operator>=(const list<T,A>& x, const list<T,A>& y)
|
||||
{
|
||||
return !(x < y);
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -75,36 +75,36 @@ struct allocator_arg_t{};
|
||||
//!
|
||||
static const allocator_arg_t allocator_arg = allocator_arg_t();
|
||||
|
||||
//! <b>Remark</b>: if a specialization is derived from true_type, indicates that T may be constructed
|
||||
//! with an allocator as its last constructor argument. Ideally, all constructors of T (including the
|
||||
//! copy and move constructors) should have a variant that accepts a final argument of
|
||||
//! allocator_type.
|
||||
//! <b>Remark</b>: if a specialization is derived from true_type, indicates that T may be constructed
|
||||
//! with an allocator as its last constructor argument. Ideally, all constructors of T (including the
|
||||
//! copy and move constructors) should have a variant that accepts a final argument of
|
||||
//! allocator_type.
|
||||
//!
|
||||
//! <b>Requires</b>: if a specialization is derived from true_type, T must have a nested type,
|
||||
//! allocator_type and at least one constructor for which allocator_type is the last
|
||||
//! parameter. If not all constructors of T can be called with a final allocator_type argument,
|
||||
//! and if T is used in a context where a container must call such a constructor, then the program is
|
||||
//! ill-formed.
|
||||
//! <b>Requires</b>: if a specialization is derived from true_type, T must have a nested type,
|
||||
//! allocator_type and at least one constructor for which allocator_type is the last
|
||||
//! parameter. If not all constructors of T can be called with a final allocator_type argument,
|
||||
//! and if T is used in a context where a container must call such a constructor, then the program is
|
||||
//! ill-formed.
|
||||
//!
|
||||
//! [Example:
|
||||
//! template <class T, class A = allocator<T> >
|
||||
//! class Z {
|
||||
//! public:
|
||||
//! typedef A allocator_type;
|
||||
//! [Example:
|
||||
//! template <class T, class A = allocator<T> >
|
||||
//! class Z {
|
||||
//! public:
|
||||
//! typedef A allocator_type;
|
||||
//!
|
||||
//! // Default constructor with optional allocator suffix
|
||||
//! Z(const allocator_type& a = allocator_type());
|
||||
//! // Default constructor with optional allocator suffix
|
||||
//! Z(const allocator_type& a = allocator_type());
|
||||
//!
|
||||
//! // Copy constructor and allocator-extended copy constructor
|
||||
//! Z(const Z& zz);
|
||||
//! Z(const Z& zz, const allocator_type& a);
|
||||
//! };
|
||||
//! // Copy constructor and allocator-extended copy constructor
|
||||
//! Z(const Z& zz);
|
||||
//! Z(const Z& zz, const allocator_type& a);
|
||||
//! };
|
||||
//!
|
||||
//! // Specialize trait for class template Z
|
||||
//! template <class T, class A = allocator<T> >
|
||||
//! struct constructible_with_allocator_suffix<Z<T,A> >
|
||||
//! // Specialize trait for class template Z
|
||||
//! template <class T, class A = allocator<T> >
|
||||
//! struct constructible_with_allocator_suffix<Z<T,A> >
|
||||
//! : ::boost::true_type { };
|
||||
//! -- end example]
|
||||
//! -- end example]
|
||||
//!
|
||||
//! <b>Note</b>: This trait is a workaround inspired by "N2554: The Scoped Allocator Model (Rev 2)"
|
||||
//! (Pablo Halpern, 2008-02-29) to backport the scoped allocator model to C++03, as
|
||||
@@ -117,44 +117,44 @@ static const allocator_arg_t allocator_arg = allocator_arg_t();
|
||||
template <class T>
|
||||
struct constructible_with_allocator_suffix
|
||||
: ::boost::false_type
|
||||
{};
|
||||
{};
|
||||
|
||||
//! <b>Remark</b>: if a specialization is derived from true_type, indicates that T may be constructed
|
||||
//! with allocator_arg and T::allocator_type as its first two constructor arguments.
|
||||
//! Ideally, all constructors of T (including the copy and move constructors) should have a variant
|
||||
//! <b>Remark</b>: if a specialization is derived from true_type, indicates that T may be constructed
|
||||
//! with allocator_arg and T::allocator_type as its first two constructor arguments.
|
||||
//! Ideally, all constructors of T (including the copy and move constructors) should have a variant
|
||||
//! that accepts these two initial arguments.
|
||||
//!
|
||||
//! <b>Requires</b>: if a specialization is derived from true_type, T must have a nested type,
|
||||
//! allocator_type and at least one constructor for which allocator_arg_t is the first
|
||||
//! parameter and allocator_type is the second parameter. If not all constructors of T can be
|
||||
//! called with these initial arguments, and if T is used in a context where a container must call such
|
||||
//! <b>Requires</b>: if a specialization is derived from true_type, T must have a nested type,
|
||||
//! allocator_type and at least one constructor for which allocator_arg_t is the first
|
||||
//! parameter and allocator_type is the second parameter. If not all constructors of T can be
|
||||
//! called with these initial arguments, and if T is used in a context where a container must call such
|
||||
//! a constructor, then the program is ill-formed.
|
||||
//!
|
||||
//! [Example:
|
||||
//! template <class T, class A = allocator<T> >
|
||||
//! class Y {
|
||||
//! public:
|
||||
//! typedef A allocator_type;
|
||||
//!
|
||||
//! // Default constructor with and allocator-extended default constructor
|
||||
//! Y();
|
||||
//! Y(allocator_arg_t, const allocator_type& a);
|
||||
//!
|
||||
//! // Copy constructor and allocator-extended copy constructor
|
||||
//! Y(const Y& yy);
|
||||
//! Y(allocator_arg_t, const allocator_type& a, const Y& yy);
|
||||
//!
|
||||
//! // Variadic constructor and allocator-extended variadic constructor
|
||||
//! template<class ...Args> Y(Args&& args...);
|
||||
//! template<class ...Args>
|
||||
//! Y(allocator_arg_t, const allocator_type& a, Args&&... args);
|
||||
//! };
|
||||
//!
|
||||
//! // Specialize trait for class template Y
|
||||
//! template <class T, class A = allocator<T> >
|
||||
//! struct constructible_with_allocator_prefix<Y<T,A> >
|
||||
//! : ::boost::true_type { };
|
||||
//!
|
||||
//! [Example:
|
||||
//! template <class T, class A = allocator<T> >
|
||||
//! class Y {
|
||||
//! public:
|
||||
//! typedef A allocator_type;
|
||||
//!
|
||||
//! // Default constructor with and allocator-extended default constructor
|
||||
//! Y();
|
||||
//! Y(allocator_arg_t, const allocator_type& a);
|
||||
//!
|
||||
//! // Copy constructor and allocator-extended copy constructor
|
||||
//! Y(const Y& yy);
|
||||
//! Y(allocator_arg_t, const allocator_type& a, const Y& yy);
|
||||
//!
|
||||
//! // Variadic constructor and allocator-extended variadic constructor
|
||||
//! template<class ...Args> Y(Args&& args...);
|
||||
//! template<class ...Args>
|
||||
//! Y(allocator_arg_t, const allocator_type& a, Args&&... args);
|
||||
//! };
|
||||
//!
|
||||
//! // Specialize trait for class template Y
|
||||
//! template <class T, class A = allocator<T> >
|
||||
//! struct constructible_with_allocator_prefix<Y<T,A> >
|
||||
//! : ::boost::true_type { };
|
||||
//!
|
||||
//! -- end example]
|
||||
//!
|
||||
//! <b>Note</b>: This trait is a workaround inspired by "N2554: The Scoped Allocator Model (Rev 2)"
|
||||
@@ -166,7 +166,7 @@ struct constructible_with_allocator_suffix
|
||||
//! (when BOOST_NO_SFINAE_EXPR is NOT defined), this trait is ignored and C++11 rules will be used
|
||||
//! to detect if a type should be constructed with suffix or prefix allocator arguments.
|
||||
template <class T>
|
||||
struct constructible_with_allocator_prefix
|
||||
struct constructible_with_allocator_prefix
|
||||
: ::boost::false_type
|
||||
{};
|
||||
|
||||
@@ -201,12 +201,12 @@ struct uses_allocator_imp
|
||||
|
||||
///@endcond
|
||||
|
||||
//! <b>Remark</b>: Automatically detects if T has a nested allocator_type that is convertible from
|
||||
//! Alloc. Meets the BinaryTypeTrait requirements ([meta.rqmts] 20.4.1). A program may
|
||||
//! <b>Remark</b>: Automatically detects if T has a nested allocator_type that is convertible from
|
||||
//! Alloc. Meets the BinaryTypeTrait requirements ([meta.rqmts] 20.4.1). A program may
|
||||
//! specialize this type to derive from true_type for a T of user-defined type if T does not
|
||||
//! have a nested allocator_type but is nonetheless constructible using the specified Alloc.
|
||||
//! have a nested allocator_type but is nonetheless constructible using the specified Alloc.
|
||||
//!
|
||||
//! <b>Result</b>: derived from true_type if Convertible<Alloc,T::allocator_type> and
|
||||
//! <b>Result</b>: derived from true_type if Convertible<Alloc,T::allocator_type> and
|
||||
//! derived from false_type otherwise.
|
||||
template <typename T, typename Alloc>
|
||||
struct uses_allocator
|
||||
@@ -340,7 +340,7 @@ namespace container_detail {
|
||||
//!
|
||||
|
||||
//Generate N+1 template parameters so that we can specialize N
|
||||
template<class T
|
||||
template<class T
|
||||
BOOST_PP_ENUM_TRAILING( BOOST_PP_ADD(BOOST_CONTAINER_MAX_IS_CONSTRUCTIBLE_PARAMETERS, 1)
|
||||
, BOOST_CONTAINER_PP_TEMPLATE_PARAM_WITH_DEFAULT
|
||||
, void)
|
||||
@@ -379,7 +379,7 @@ namespace container_detail {
|
||||
#include BOOST_PP_LOCAL_ITERATE()
|
||||
|
||||
//Finally just inherit from the implementation to define he trait
|
||||
template< class T
|
||||
template< class T
|
||||
BOOST_PP_ENUM_TRAILING( BOOST_CONTAINER_MAX_IS_CONSTRUCTIBLE_PARAMETERS
|
||||
, BOOST_CONTAINER_PP_TEMPLATE_PARAM_WITH_DEFAULT
|
||||
, void)
|
||||
@@ -388,14 +388,14 @@ namespace container_detail {
|
||||
: boost::integral_constant
|
||||
< bool
|
||||
, is_constructible_impl
|
||||
< T
|
||||
< T
|
||||
BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_IS_CONSTRUCTIBLE_PARAMETERS, P)
|
||||
, void>::value
|
||||
>
|
||||
{};
|
||||
|
||||
//Finally just inherit from the implementation to define he trait
|
||||
template <class T
|
||||
template <class T
|
||||
,class InnerAlloc
|
||||
BOOST_PP_ENUM_TRAILING( BOOST_PP_SUB(BOOST_CONTAINER_MAX_IS_CONSTRUCTIBLE_PARAMETERS, 2)
|
||||
, BOOST_CONTAINER_PP_TEMPLATE_PARAM_WITH_DEFAULT
|
||||
@@ -408,7 +408,7 @@ namespace container_detail {
|
||||
>
|
||||
{};
|
||||
/*
|
||||
template <class T
|
||||
template <class T
|
||||
,class InnerAlloc
|
||||
BOOST_PP_ENUM_TRAILING( BOOST_PP_SUB(BOOST_CONTAINER_MAX_IS_CONSTRUCTIBLE_PARAMETERS, 1)
|
||||
, BOOST_CONTAINER_PP_TEMPLATE_PARAM_WITH_DEFAULT
|
||||
@@ -443,7 +443,7 @@ namespace container_detail {
|
||||
|
||||
#else // #if !defined(BOOST_NO_VARIADIC_TEMPLATES)
|
||||
|
||||
template < class T
|
||||
template < class T
|
||||
, class InnerAlloc
|
||||
BOOST_PP_ENUM_TRAILING( BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS
|
||||
, BOOST_CONTAINER_PP_TEMPLATE_PARAM_WITH_DEFAULT
|
||||
@@ -453,7 +453,7 @@ namespace container_detail {
|
||||
: constructible_with_allocator_prefix<T>
|
||||
{};
|
||||
/*
|
||||
template < class T
|
||||
template < class T
|
||||
, class InnerAlloc
|
||||
BOOST_PP_ENUM_TRAILING( BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS
|
||||
, BOOST_CONTAINER_PP_TEMPLATE_PARAM_WITH_DEFAULT
|
||||
@@ -954,7 +954,7 @@ class scoped_allocator_adaptor_base
|
||||
scoped_allocator_adaptor_base(internal_type_t, BOOST_FWD_REF(OuterA2) outerAlloc, const inner_allocator_type &)
|
||||
: outer_allocator_type(::boost::forward<OuterA2>(outerAlloc))
|
||||
{}
|
||||
|
||||
|
||||
public:
|
||||
scoped_allocator_adaptor_base &operator=(BOOST_COPY_ASSIGN_REF(scoped_allocator_adaptor_base) other)
|
||||
{
|
||||
@@ -991,36 +991,36 @@ class scoped_allocator_adaptor_base
|
||||
#if !defined(BOOST_CONTAINER_UNIMPLEMENTED_PACK_EXPANSION_TO_FIXED_LIST)
|
||||
|
||||
//! This class is a C++03-compatible implementation of std::scoped_allocator_adaptor.
|
||||
//! The class template scoped_allocator_adaptor is an allocator template that specifies
|
||||
//! the memory resource (the outer allocator) to be used by a container (as any other
|
||||
//! allocator does) and also specifies an inner allocator resource to be passed to
|
||||
//! The class template scoped_allocator_adaptor is an allocator template that specifies
|
||||
//! the memory resource (the outer allocator) to be used by a container (as any other
|
||||
//! allocator does) and also specifies an inner allocator resource to be passed to
|
||||
//! the constructor of every element within the container.
|
||||
//!
|
||||
//! This adaptor is
|
||||
//! instantiated with one outer and zero or more inner allocator types. If
|
||||
//! instantiated with only one allocator type, the inner allocator becomes the
|
||||
//! scoped_allocator_adaptor itself, thus using the same allocator resource for the
|
||||
//! container and every element within the container and, if the elements themselves
|
||||
//! are containers, each of their elements recursively. If instantiated with more than
|
||||
//! This adaptor is
|
||||
//! instantiated with one outer and zero or more inner allocator types. If
|
||||
//! instantiated with only one allocator type, the inner allocator becomes the
|
||||
//! scoped_allocator_adaptor itself, thus using the same allocator resource for the
|
||||
//! container and every element within the container and, if the elements themselves
|
||||
//! are containers, each of their elements recursively. If instantiated with more than
|
||||
//! one allocator, the first allocator is the outer allocator for use by the container,
|
||||
//! the second allocator is passed to the constructors of the container's elements,
|
||||
//! and, if the elements themselves are containers, the third allocator is passed to
|
||||
//! the elements' elements, and so on. If containers are nested to a depth greater
|
||||
//! than the number of allocators, the last allocator is used repeatedly, as in the
|
||||
//! single-allocator case, for any remaining recursions.
|
||||
//! the second allocator is passed to the constructors of the container's elements,
|
||||
//! and, if the elements themselves are containers, the third allocator is passed to
|
||||
//! the elements' elements, and so on. If containers are nested to a depth greater
|
||||
//! than the number of allocators, the last allocator is used repeatedly, as in the
|
||||
//! single-allocator case, for any remaining recursions.
|
||||
//!
|
||||
//! [<b>Note</b>: The
|
||||
//! scoped_allocator_adaptor is derived from the outer allocator type so it can be
|
||||
//! scoped_allocator_adaptor is derived from the outer allocator type so it can be
|
||||
//! substituted for the outer allocator type in most expressions. -end note]
|
||||
//!
|
||||
//! In the construct member functions, `OUTERMOST(x)` is x if x does not have
|
||||
//! In the construct member functions, `OUTERMOST(x)` is x if x does not have
|
||||
//! an `outer_allocator()` member function and
|
||||
//! `OUTERMOST(x.outer_allocator())` otherwise; `OUTERMOST_ALLOC_TRAITS(x)` is
|
||||
//! `allocator_traits<decltype(OUTERMOST(x))>`.
|
||||
//!
|
||||
//! [<b>Note</b>: `OUTERMOST(x)` and
|
||||
//! `OUTERMOST_ALLOC_TRAITS(x)` are recursive operations. It is incumbent upon
|
||||
//! the definition of `outer_allocator()` to ensure that the recursion terminates.
|
||||
//! `OUTERMOST_ALLOC_TRAITS(x)` are recursive operations. It is incumbent upon
|
||||
//! the definition of `outer_allocator()` to ensure that the recursion terminates.
|
||||
//! It will terminate for all instantiations of scoped_allocator_adaptor. -end note]
|
||||
template <typename OuterAlloc, typename ...InnerAllocs>
|
||||
class scoped_allocator_adaptor
|
||||
@@ -1120,7 +1120,7 @@ class scoped_allocator_adaptor
|
||||
: base_type(other.base())
|
||||
{}
|
||||
|
||||
//! <b>Effects</b>: move constructs each allocator within the adaptor with
|
||||
//! <b>Effects</b>: move constructs each allocator within the adaptor with
|
||||
//! the corresponding allocator from other.
|
||||
scoped_allocator_adaptor(BOOST_RV_REF(scoped_allocator_adaptor) other)
|
||||
: base_type(::boost::move(other.base()))
|
||||
@@ -1131,7 +1131,7 @@ class scoped_allocator_adaptor
|
||||
//! <b>Requires</b>: OuterAlloc shall be constructible from OuterA2.
|
||||
//!
|
||||
//! <b>Effects</b>: initializes the OuterAlloc base class with boost::forward<OuterA2>(outerAlloc) and inner
|
||||
//! with innerAllocs...(hence recursively initializing each allocator within the adaptor with the
|
||||
//! with innerAllocs...(hence recursively initializing each allocator within the adaptor with the
|
||||
//! corresponding allocator from the argument list).
|
||||
template <class OuterA2>
|
||||
scoped_allocator_adaptor(BOOST_FWD_REF(OuterA2) outerAlloc, const InnerAllocs & ...innerAllocs)
|
||||
@@ -1169,7 +1169,7 @@ class scoped_allocator_adaptor
|
||||
|
||||
//! <b>Requires</b>: OuterAlloc shall be constructible from OuterA2.
|
||||
//!
|
||||
//! <b>Effects</b>: initializes each allocator within the adaptor with the corresponding allocator
|
||||
//! <b>Effects</b>: initializes each allocator within the adaptor with the corresponding allocator
|
||||
//! rvalue from other.
|
||||
template <class OuterA2>
|
||||
scoped_allocator_adaptor(BOOST_RV_REF_BEG scoped_allocator_adaptor<OuterA2
|
||||
@@ -1221,7 +1221,7 @@ class scoped_allocator_adaptor
|
||||
return outer_traits_type::max_size(this->outer_allocator());
|
||||
}
|
||||
|
||||
//! <b>Effects</b>:
|
||||
//! <b>Effects</b>:
|
||||
//! calls `OUTERMOST_ALLOC_TRAITS(*this)::destroy(OUTERMOST(*this), p)`.
|
||||
template <class T>
|
||||
void destroy(T* p)
|
||||
@@ -1230,14 +1230,14 @@ class scoped_allocator_adaptor
|
||||
::destroy(get_outermost_allocator(this->outer_allocator()), p);
|
||||
}
|
||||
|
||||
//! <b>Returns</b>:
|
||||
//! <b>Returns</b>:
|
||||
//! `allocator_traits<OuterAlloc>::allocate(outer_allocator(), n)`.
|
||||
pointer allocate(size_type n)
|
||||
{
|
||||
return outer_traits_type::allocate(this->outer_allocator(), n);
|
||||
}
|
||||
|
||||
//! <b>Returns</b>:
|
||||
//! <b>Returns</b>:
|
||||
//! `allocator_traits<OuterAlloc>::allocate(outer_allocator(), n, hint)`.
|
||||
pointer allocate(size_type n, const_void_pointer hint)
|
||||
{
|
||||
@@ -1252,7 +1252,7 @@ class scoped_allocator_adaptor
|
||||
}
|
||||
|
||||
//! <b>Returns</b>: A new scoped_allocator_adaptor object where each allocator
|
||||
//! A in the adaptor is initialized from the result of calling
|
||||
//! A in the adaptor is initialized from the result of calling
|
||||
//! `allocator_traits<A>::select_on_container_copy_construction()` on
|
||||
//! the corresponding allocator in *this.
|
||||
scoped_allocator_adaptor select_on_container_copy_construction() const
|
||||
@@ -1275,21 +1275,21 @@ class scoped_allocator_adaptor
|
||||
//! 1) If `uses_allocator<T, inner_allocator_type>::value` is false calls
|
||||
//! `OUTERMOST_ALLOC_TRAITS(*this)::construct
|
||||
//! (OUTERMOST(*this), p, std::forward<Args>(args)...)`.
|
||||
//!
|
||||
//! 2) Otherwise, if `uses_allocator<T, inner_allocator_type>::value` is true and
|
||||
//!
|
||||
//! 2) Otherwise, if `uses_allocator<T, inner_allocator_type>::value` is true and
|
||||
//! `is_constructible<T, allocator_arg_t, inner_allocator_type, Args...>::value` is true, calls
|
||||
//! `OUTERMOST_ALLOC_TRAITS(*this)::construct(OUTERMOST(*this), p, allocator_arg,
|
||||
//! inner_allocator(), std::forward<Args>(args)...)`.
|
||||
//!
|
||||
//!
|
||||
//! [<b>Note</b>: In compilers without advanced decltype SFINAE support, `is_constructible` can't
|
||||
//! be implemented so that condition will be replaced by
|
||||
//! constructible_with_allocator_prefix<T>::value. -end note]
|
||||
//!
|
||||
//! 3) Otherwise, if uses_allocator<T, inner_allocator_type>::value is true and
|
||||
//! `is_constructible<T, Args..., inner_allocator_type>::value` is true, calls
|
||||
//! `OUTERMOST_ALLOC_TRAITS(*this)::construct(OUTERMOST(*this), p,
|
||||
//! 3) Otherwise, if uses_allocator<T, inner_allocator_type>::value is true and
|
||||
//! `is_constructible<T, Args..., inner_allocator_type>::value` is true, calls
|
||||
//! `OUTERMOST_ALLOC_TRAITS(*this)::construct(OUTERMOST(*this), p,
|
||||
//! std::forward<Args>(args)..., inner_allocator())`.
|
||||
//!
|
||||
//!
|
||||
//! [<b>Note</b>: In compilers without advanced decltype SFINAE support, `is_constructible` can't be
|
||||
//! implemented so that condition will be replaced by
|
||||
//! `constructible_with_allocator_suffix<T>::value`. -end note]
|
||||
@@ -1352,7 +1352,7 @@ class scoped_allocator_adaptor
|
||||
template <class T1, class T2, class U, class V>
|
||||
void construct(container_detail::pair<T1, T2>* p, BOOST_FWD_REF(U) x, BOOST_FWD_REF(V) y)
|
||||
{ this->construct_pair(p, ::boost::forward<U>(x), ::boost::forward<V>(y)); }
|
||||
|
||||
|
||||
template <class T1, class T2, class U, class V>
|
||||
void construct(std::pair<T1, T2>* p, const std::pair<U, V>& x)
|
||||
{ this->construct_pair(p, x); }
|
||||
@@ -1361,7 +1361,7 @@ class scoped_allocator_adaptor
|
||||
void construct( container_detail::pair<T1, T2>* p
|
||||
, const container_detail::pair<U, V>& x)
|
||||
{ this->construct_pair(p, x); }
|
||||
|
||||
|
||||
template <class T1, class T2, class U, class V>
|
||||
void construct( std::pair<T1, T2>* p
|
||||
, BOOST_RV_REF_BEG std::pair<U, V> BOOST_RV_REF_END x)
|
||||
@@ -1461,7 +1461,7 @@ inline bool operator==(
|
||||
#endif
|
||||
>& b)
|
||||
{
|
||||
#if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
|
||||
#if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
|
||||
const bool has_zero_inner = sizeof...(InnerAllocs) == 0u;
|
||||
#else
|
||||
const bool has_zero_inner =
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -93,7 +93,7 @@ class clear_on_destroy
|
||||
{
|
||||
if(do_clear_){
|
||||
c_.clear();
|
||||
c_.clear_pool();
|
||||
c_.clear_pool();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ class iterator
|
||||
iterator(const iterator<T, T&, typename boost::intrusive::pointer_traits<Pointer>::template rebind_pointer<T>::type>& x)
|
||||
: pn(x.pn)
|
||||
{}
|
||||
|
||||
|
||||
private:
|
||||
static node_type_ptr_t node_ptr_cast(const void_ptr &p)
|
||||
{
|
||||
@@ -208,7 +208,7 @@ class iterator
|
||||
pointer operator->() const { return pointer(&this->dereference()); }
|
||||
|
||||
//Increment / Decrement
|
||||
iterator& operator++()
|
||||
iterator& operator++()
|
||||
{ this->increment(); return *this; }
|
||||
|
||||
iterator operator++(int)
|
||||
@@ -328,11 +328,11 @@ BOOST_JOIN(check_invariant_,__LINE__).touch();
|
||||
//! stability.
|
||||
//!
|
||||
//! More details taken the author's blog:
|
||||
//! (<a href="http://bannalia.blogspot.com/2008/09/introducing-stablevector.html" >
|
||||
//! (<a href="http://bannalia.blogspot.com/2008/09/introducing-stablevector.html" >
|
||||
//! Introducing stable_vector</a>)
|
||||
//!
|
||||
//! We present stable_vector, a fully STL-compliant stable container that provides
|
||||
//! most of the features of std::vector except element contiguity.
|
||||
//! most of the features of std::vector except element contiguity.
|
||||
//!
|
||||
//! General properties: stable_vector satisfies all the requirements of a container,
|
||||
//! a reversible container and a sequence and provides all the optional operations
|
||||
@@ -398,7 +398,7 @@ class stable_vector
|
||||
integral_constant<unsigned, 1> allocator_v1;
|
||||
typedef ::boost::container::container_detail::
|
||||
integral_constant<unsigned, 2> allocator_v2;
|
||||
typedef ::boost::container::container_detail::integral_constant
|
||||
typedef ::boost::container::container_detail::integral_constant
|
||||
<unsigned, boost::container::container_detail::
|
||||
version<A>::value> alloc_version;
|
||||
typedef typename allocator_traits_type::
|
||||
@@ -481,9 +481,9 @@ class stable_vector
|
||||
public:
|
||||
|
||||
//! <b>Effects</b>: Default constructs a stable_vector.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: If allocator_type's default constructor throws.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
stable_vector()
|
||||
: internal_data(), impl()
|
||||
@@ -492,9 +492,9 @@ class stable_vector
|
||||
}
|
||||
|
||||
//! <b>Effects</b>: Constructs a stable_vector taking the allocator as parameter.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: If allocator_type's copy constructor throws.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
explicit stable_vector(const allocator_type& al)
|
||||
: internal_data(al),impl(al)
|
||||
@@ -507,7 +507,7 @@ class stable_vector
|
||||
//!
|
||||
//! <b>Throws</b>: If allocator_type's default constructor or copy constructor
|
||||
//! throws or T's default or copy constructor throws.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear to n.
|
||||
explicit stable_vector(size_type n)
|
||||
: internal_data(),impl()
|
||||
@@ -523,7 +523,7 @@ class stable_vector
|
||||
//!
|
||||
//! <b>Throws</b>: If allocator_type's default constructor or copy constructor
|
||||
//! throws or T's default or copy constructor throws.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear to n.
|
||||
stable_vector(size_type n, const T& t, const allocator_type& al = allocator_type())
|
||||
: internal_data(al),impl(al)
|
||||
@@ -554,7 +554,7 @@ class stable_vector
|
||||
//! <b>Effects</b>: Copy constructs a stable_vector.
|
||||
//!
|
||||
//! <b>Postcondition</b>: x == *this.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear to the elements x contains.
|
||||
stable_vector(const stable_vector& x)
|
||||
: internal_data(allocator_traits<node_allocator_type>::
|
||||
@@ -571,7 +571,7 @@ class stable_vector
|
||||
//! <b>Effects</b>: Move constructor. Moves mx's resources to *this.
|
||||
//!
|
||||
//! <b>Throws</b>: If allocator_type's copy constructor throws.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
stable_vector(BOOST_RV_REF(stable_vector) x)
|
||||
: internal_data(boost::move(x.node_alloc())), impl(boost::move(x.impl))
|
||||
@@ -582,7 +582,7 @@ class stable_vector
|
||||
//! <b>Effects</b>: Copy constructs a stable_vector using the specified allocator.
|
||||
//!
|
||||
//! <b>Postcondition</b>: x == *this.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear to the elements x contains.
|
||||
stable_vector(const stable_vector& x, const allocator_type &a)
|
||||
: internal_data(a), impl(a)
|
||||
@@ -597,7 +597,7 @@ class stable_vector
|
||||
//! Moves mx's resources to *this.
|
||||
//!
|
||||
//! <b>Throws</b>: If allocator_type's copy constructor throws.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant if a == x.get_allocator(), linear otherwise
|
||||
stable_vector(BOOST_RV_REF(stable_vector) x, const allocator_type &a)
|
||||
: internal_data(a), impl(a)
|
||||
@@ -622,13 +622,13 @@ class stable_vector
|
||||
~stable_vector()
|
||||
{
|
||||
this->clear();
|
||||
clear_pool();
|
||||
clear_pool();
|
||||
}
|
||||
|
||||
//! <b>Effects</b>: Makes *this contain the same elements as x.
|
||||
//!
|
||||
//! <b>Postcondition</b>: this->size() == x.size(). *this contains a copy
|
||||
//! of each of x's elements.
|
||||
//! <b>Postcondition</b>: this->size() == x.size(). *this contains a copy
|
||||
//! of each of x's elements.
|
||||
//!
|
||||
//! <b>Throws</b>: If memory allocation throws or T's copy constructor throws.
|
||||
//!
|
||||
@@ -711,146 +711,146 @@ class stable_vector
|
||||
}
|
||||
|
||||
//! <b>Effects</b>: Returns a copy of the internal allocator.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: If allocator's copy constructor throws.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
allocator_type get_allocator()const {return this->node_alloc();}
|
||||
|
||||
//! <b>Effects</b>: Returns a reference to the internal allocator.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
//!
|
||||
//!
|
||||
//! <b>Note</b>: Non-standard extension.
|
||||
const stored_allocator_type &get_stored_allocator() const BOOST_CONTAINER_NOEXCEPT
|
||||
{ return node_alloc(); }
|
||||
|
||||
//! <b>Effects</b>: Returns a reference to the internal allocator.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
//!
|
||||
//!
|
||||
//! <b>Note</b>: Non-standard extension.
|
||||
stored_allocator_type &get_stored_allocator() BOOST_CONTAINER_NOEXCEPT
|
||||
{ return node_alloc(); }
|
||||
|
||||
|
||||
//! <b>Effects</b>: Returns an iterator to the first element contained in the stable_vector.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
iterator begin()
|
||||
{ return (impl.empty()) ? end(): iterator(node_ptr_cast(impl.front())) ; }
|
||||
|
||||
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the stable_vector.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_iterator begin()const
|
||||
{ return (impl.empty()) ? cend() : const_iterator(node_ptr_cast(impl.front())) ; }
|
||||
|
||||
//! <b>Effects</b>: Returns an iterator to the end of the stable_vector.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
iterator end() {return iterator(get_end_node());}
|
||||
|
||||
//! <b>Effects</b>: Returns a const_iterator to the end of the stable_vector.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_iterator end()const {return const_iterator(get_end_node());}
|
||||
|
||||
//! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning
|
||||
//! of the reversed stable_vector.
|
||||
//!
|
||||
//! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning
|
||||
//! of the reversed stable_vector.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
reverse_iterator rbegin() {return reverse_iterator(this->end());}
|
||||
|
||||
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
|
||||
//! of the reversed stable_vector.
|
||||
//!
|
||||
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
|
||||
//! of the reversed stable_vector.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_reverse_iterator rbegin()const {return const_reverse_iterator(this->end());}
|
||||
|
||||
//! <b>Effects</b>: Returns a reverse_iterator pointing to the end
|
||||
//! of the reversed stable_vector.
|
||||
//!
|
||||
//! of the reversed stable_vector.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
reverse_iterator rend() {return reverse_iterator(this->begin());}
|
||||
|
||||
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
|
||||
//! of the reversed stable_vector.
|
||||
//!
|
||||
//! of the reversed stable_vector.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_reverse_iterator rend()const {return const_reverse_iterator(this->begin());}
|
||||
|
||||
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the stable_vector.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_iterator cbegin()const {return this->begin();}
|
||||
|
||||
//! <b>Effects</b>: Returns a const_iterator to the end of the stable_vector.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_iterator cend()const {return this->end();}
|
||||
|
||||
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
|
||||
//! of the reversed stable_vector.
|
||||
//!
|
||||
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
|
||||
//! of the reversed stable_vector.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_reverse_iterator crbegin()const{return this->rbegin();}
|
||||
|
||||
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
|
||||
//! of the reversed stable_vector.
|
||||
//!
|
||||
//! of the reversed stable_vector.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_reverse_iterator crend()const {return this->rend();}
|
||||
|
||||
//! <b>Effects</b>: Returns the number of the elements contained in the stable_vector.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
size_type size() const
|
||||
{ return impl.empty() ? 0 : (impl.size() - ExtraPointers); }
|
||||
|
||||
//! <b>Effects</b>: Returns the largest possible size of the stable_vector.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
size_type max_size() const
|
||||
{ return impl.max_size() - ExtraPointers; }
|
||||
|
||||
//! <b>Effects</b>: Number of elements for which memory has been allocated.
|
||||
//! capacity() is always greater than or equal to size().
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
size_type capacity() const
|
||||
{
|
||||
@@ -865,9 +865,9 @@ class stable_vector
|
||||
}
|
||||
|
||||
//! <b>Effects</b>: Returns true if the stable_vector contains no elements.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
bool empty() const
|
||||
{ return impl.empty() || impl.size() == ExtraPointers; }
|
||||
@@ -907,7 +907,7 @@ class stable_vector
|
||||
//! effect. Otherwise, it is a request for allocation of additional memory.
|
||||
//! If the request is successful, then capacity() is greater than or equal to
|
||||
//! n; otherwise, capacity() is unchanged. In either case, size() is unchanged.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: If memory allocation allocation throws.
|
||||
void reserve(size_type n)
|
||||
{
|
||||
@@ -915,7 +915,7 @@ class stable_vector
|
||||
if(n > this->max_size())
|
||||
throw std::bad_alloc();
|
||||
|
||||
size_type size = this->size();
|
||||
size_type size = this->size();
|
||||
size_type old_capacity = this->capacity();
|
||||
if(n > old_capacity){
|
||||
this->initialize_end_node(n);
|
||||
@@ -935,31 +935,31 @@ class stable_vector
|
||||
|
||||
//! <b>Requires</b>: size() > n.
|
||||
//!
|
||||
//! <b>Effects</b>: Returns a reference to the nth element
|
||||
//! <b>Effects</b>: Returns a reference to the nth element
|
||||
//! from the beginning of the container.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
reference operator[](size_type n){return value(impl[n]);}
|
||||
|
||||
//! <b>Requires</b>: size() > n.
|
||||
//!
|
||||
//! <b>Effects</b>: Returns a const reference to the nth element
|
||||
//! <b>Effects</b>: Returns a const reference to the nth element
|
||||
//! from the beginning of the container.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_reference operator[](size_type n)const{return value(impl[n]);}
|
||||
|
||||
//! <b>Requires</b>: size() > n.
|
||||
//!
|
||||
//! <b>Effects</b>: Returns a reference to the nth element
|
||||
//! <b>Effects</b>: Returns a reference to the nth element
|
||||
//! from the beginning of the container.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: std::range_error if n >= size()
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
reference at(size_type n)
|
||||
{
|
||||
@@ -970,11 +970,11 @@ class stable_vector
|
||||
|
||||
//! <b>Requires</b>: size() > n.
|
||||
//!
|
||||
//! <b>Effects</b>: Returns a const reference to the nth element
|
||||
//! <b>Effects</b>: Returns a const reference to the nth element
|
||||
//! from the beginning of the container.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: std::range_error if n >= size()
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_reference at(size_type n)const
|
||||
{
|
||||
@@ -987,9 +987,9 @@ class stable_vector
|
||||
//!
|
||||
//! <b>Effects</b>: Returns a reference to the first
|
||||
//! element of the container.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
reference front()
|
||||
{ return value(impl.front()); }
|
||||
@@ -998,9 +998,9 @@ class stable_vector
|
||||
//!
|
||||
//! <b>Effects</b>: Returns a const reference to the first
|
||||
//! element of the container.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_reference front()const
|
||||
{ return value(impl.front()); }
|
||||
@@ -1009,9 +1009,9 @@ class stable_vector
|
||||
//!
|
||||
//! <b>Effects</b>: Returns a reference to the last
|
||||
//! element of the container.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
reference back()
|
||||
{ return value(*(&impl.back() - ExtraPointers)); }
|
||||
@@ -1020,9 +1020,9 @@ class stable_vector
|
||||
//!
|
||||
//! <b>Effects</b>: Returns a const reference to the last
|
||||
//! element of the container.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_reference back()const
|
||||
{ return value(*(&impl.back() - ExtraPointers)); }
|
||||
@@ -1033,7 +1033,7 @@ class stable_vector
|
||||
//! T's copy constructor throws.
|
||||
//!
|
||||
//! <b>Complexity</b>: Amortized constant time.
|
||||
void push_back(insert_const_ref_type x)
|
||||
void push_back(insert_const_ref_type x)
|
||||
{ return priv_push_back(x); }
|
||||
|
||||
#if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
|
||||
@@ -1051,7 +1051,7 @@ class stable_vector
|
||||
//! <b>Throws</b>: If memory allocation throws.
|
||||
//!
|
||||
//! <b>Complexity</b>: Amortized constant time.
|
||||
void push_back(BOOST_RV_REF(T) t)
|
||||
void push_back(BOOST_RV_REF(T) t)
|
||||
{ this->insert(end(), boost::move(t)); }
|
||||
|
||||
//! <b>Effects</b>: Removes the last element from the stable_vector.
|
||||
@@ -1070,7 +1070,7 @@ class stable_vector
|
||||
//!
|
||||
//! <b>Complexity</b>: If position is end(), amortized constant time
|
||||
//! Linear time otherwise.
|
||||
iterator insert(const_iterator position, insert_const_ref_type x)
|
||||
iterator insert(const_iterator position, insert_const_ref_type x)
|
||||
{ return this->priv_insert(position, x); }
|
||||
|
||||
#if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
|
||||
@@ -1090,7 +1090,7 @@ class stable_vector
|
||||
//!
|
||||
//! <b>Complexity</b>: If position is end(), amortized constant time
|
||||
//! Linear time otherwise.
|
||||
iterator insert(const_iterator position, BOOST_RV_REF(T) x)
|
||||
iterator insert(const_iterator position, BOOST_RV_REF(T) x)
|
||||
{
|
||||
typedef repeat_iterator<T, difference_type> repeat_it;
|
||||
typedef boost::move_iterator<repeat_it> repeat_move_it;
|
||||
@@ -1210,7 +1210,7 @@ class stable_vector
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear to the elements between pos and the
|
||||
//! <b>Complexity</b>: Linear to the elements between pos and the
|
||||
//! last element. Constant if pos is the last element.
|
||||
iterator erase(const_iterator position)
|
||||
{
|
||||
@@ -1581,7 +1581,7 @@ class stable_vector
|
||||
{
|
||||
for(; first!=last; ++first){
|
||||
this->insert(position, *first);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <class InputIterator>
|
||||
@@ -1692,7 +1692,7 @@ class stable_vector
|
||||
return false;
|
||||
}
|
||||
for(const_impl_iterator it = impl.begin(), it_end = get_last_align(); it != it_end; ++it){
|
||||
if(const_void_ptr(node_ptr_cast(*it)->up) !=
|
||||
if(const_void_ptr(node_ptr_cast(*it)->up) !=
|
||||
const_void_ptr(const_void_ptr_ptr(&*it)))
|
||||
return false;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -55,7 +55,7 @@ namespace container {
|
||||
|
||||
namespace container_detail {
|
||||
|
||||
//! Const vector_iterator used to iterate through a vector.
|
||||
//! Const vector_iterator used to iterate through a vector.
|
||||
template <class Pointer>
|
||||
class vector_const_iterator
|
||||
{
|
||||
@@ -82,20 +82,20 @@ class vector_const_iterator
|
||||
vector_const_iterator() : m_ptr(0){}
|
||||
|
||||
//Pointer like operators
|
||||
reference operator*() const
|
||||
reference operator*() const
|
||||
{ return *m_ptr; }
|
||||
|
||||
const value_type * operator->() const
|
||||
const value_type * operator->() const
|
||||
{ return container_detail::to_raw_pointer(m_ptr); }
|
||||
|
||||
reference operator[](difference_type off) const
|
||||
{ return m_ptr[off]; }
|
||||
|
||||
//Increment / Decrement
|
||||
vector_const_iterator& operator++()
|
||||
vector_const_iterator& operator++()
|
||||
{ ++m_ptr; return *this; }
|
||||
|
||||
vector_const_iterator operator++(int)
|
||||
vector_const_iterator operator++(int)
|
||||
{ Pointer tmp = m_ptr; ++*this; return vector_const_iterator(tmp); }
|
||||
|
||||
vector_const_iterator& operator--()
|
||||
@@ -165,22 +165,22 @@ class vector_iterator
|
||||
{}
|
||||
|
||||
//Pointer like operators
|
||||
reference operator*() const
|
||||
reference operator*() const
|
||||
{ return *this->m_ptr; }
|
||||
|
||||
value_type* operator->() const
|
||||
value_type* operator->() const
|
||||
{ return container_detail::to_raw_pointer(this->m_ptr); }
|
||||
|
||||
reference operator[](difference_type off) const
|
||||
reference operator[](difference_type off) const
|
||||
{ return this->m_ptr[off]; }
|
||||
|
||||
//Increment / Decrement
|
||||
vector_iterator& operator++()
|
||||
vector_iterator& operator++()
|
||||
{ ++this->m_ptr; return *this; }
|
||||
|
||||
vector_iterator operator++(int)
|
||||
{ pointer tmp = this->m_ptr; ++*this; return vector_iterator(tmp); }
|
||||
|
||||
|
||||
vector_iterator& operator--()
|
||||
{ --this->m_ptr; return *this; }
|
||||
|
||||
@@ -249,7 +249,7 @@ struct vector_value_traits
|
||||
|
||||
//!This struct deallocates and allocated memory
|
||||
template <class A>
|
||||
struct vector_alloc_holder
|
||||
struct vector_alloc_holder
|
||||
{
|
||||
typedef boost::container::allocator_traits<A> allocator_traits_type;
|
||||
typedef typename allocator_traits_type::pointer pointer;
|
||||
@@ -282,7 +282,7 @@ struct vector_alloc_holder
|
||||
boost::container::container_detail::version<A>::value> alloc_version;
|
||||
std::pair<pointer, bool>
|
||||
allocation_command(allocation_type command,
|
||||
size_type limit_size,
|
||||
size_type limit_size,
|
||||
size_type preferred_size,
|
||||
size_type &received_size, const pointer &reuse = 0)
|
||||
{
|
||||
@@ -292,7 +292,7 @@ struct vector_alloc_holder
|
||||
|
||||
std::pair<pointer, bool>
|
||||
allocation_command(allocation_type command,
|
||||
size_type limit_size,
|
||||
size_type limit_size,
|
||||
size_type preferred_size,
|
||||
size_type &received_size,
|
||||
const pointer &reuse,
|
||||
@@ -308,7 +308,7 @@ struct vector_alloc_holder
|
||||
|
||||
std::pair<pointer, bool>
|
||||
allocation_command(allocation_type command,
|
||||
size_type limit_size,
|
||||
size_type limit_size,
|
||||
size_type preferred_size,
|
||||
size_type &received_size,
|
||||
const pointer &reuse,
|
||||
@@ -394,9 +394,9 @@ struct vector_alloc_holder
|
||||
/// @endcond
|
||||
|
||||
//! \class vector
|
||||
//! A vector is a sequence that supports random access to elements, constant
|
||||
//! time insertion and removal of elements at the end, and linear time insertion
|
||||
//! and removal of elements at the beginning or in the middle. The number of
|
||||
//! A vector is a sequence that supports random access to elements, constant
|
||||
//! time insertion and removal of elements at the end, and linear time insertion
|
||||
//! and removal of elements at the beginning or in the middle. The number of
|
||||
//! elements in a vector may vary dynamically; memory management is automatic.
|
||||
//! boost::container::vector is similar to std::vector but it's compatible
|
||||
//! with shared memory and memory mapped files.
|
||||
@@ -434,11 +434,11 @@ class vector : private container_detail::vector_alloc_holder<A>
|
||||
//! The random access const_iterator
|
||||
typedef container_detail::vector_const_iterator<pointer> const_iterator;
|
||||
|
||||
//! Iterator used to iterate backwards through a vector.
|
||||
typedef std::reverse_iterator<iterator>
|
||||
//! Iterator used to iterate backwards through a vector.
|
||||
typedef std::reverse_iterator<iterator>
|
||||
reverse_iterator;
|
||||
//! Const iterator used to iterate backwards through a vector.
|
||||
typedef std::reverse_iterator<const_iterator>
|
||||
//! Const iterator used to iterate backwards through a vector.
|
||||
typedef std::reverse_iterator<const_iterator>
|
||||
const_reverse_iterator;
|
||||
//! The stored allocator type
|
||||
typedef allocator_type stored_allocator_type;
|
||||
@@ -461,9 +461,9 @@ class vector : private container_detail::vector_alloc_holder<A>
|
||||
public:
|
||||
|
||||
//! <b>Effects</b>: Constructs a vector taking the allocator as parameter.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: If allocator_type's default constructor throws.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
vector()
|
||||
BOOST_CONTAINER_NOEXCEPT_IF(::boost::has_nothrow_default_constructor<A>::value)
|
||||
@@ -471,9 +471,9 @@ class vector : private container_detail::vector_alloc_holder<A>
|
||||
{}
|
||||
|
||||
//! <b>Effects</b>: Constructs a vector taking the allocator as parameter.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
explicit vector(const A& a) BOOST_CONTAINER_NOEXCEPT
|
||||
: base_t(a)
|
||||
@@ -484,7 +484,7 @@ class vector : private container_detail::vector_alloc_holder<A>
|
||||
//!
|
||||
//! <b>Throws</b>: If allocator_type's default constructor or allocation
|
||||
//! throws or T's default constructor throws.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear to n.
|
||||
explicit vector(size_type n)
|
||||
: base_t()
|
||||
@@ -511,21 +511,21 @@ class vector : private container_detail::vector_alloc_holder<A>
|
||||
//!
|
||||
//! <b>Throws</b>: If allocator_type's default constructor or allocation
|
||||
//! throws or T's copy constructor throws.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear to n.
|
||||
vector(size_type n, const T& value, const allocator_type& a = allocator_type())
|
||||
vector(size_type n, const T& value, const allocator_type& a = allocator_type())
|
||||
: base_t(a)
|
||||
{ this->insert(this->cend(), n, value); }
|
||||
|
||||
//! <b>Effects</b>: Copy constructs a vector.
|
||||
//!
|
||||
//! <b>Postcondition</b>: x == *this.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: If allocator_type's default constructor or allocation
|
||||
//! throws or T's copy constructor throws.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear to the elements x contains.
|
||||
vector(const vector &x)
|
||||
vector(const vector &x)
|
||||
: base_t(allocator_traits_type::select_on_container_copy_construction(x.alloc()))
|
||||
{
|
||||
this->assign( container_detail::to_raw_pointer(x.members_.m_start)
|
||||
@@ -535,7 +535,7 @@ class vector : private container_detail::vector_alloc_holder<A>
|
||||
//! <b>Effects</b>: Move constructor. Moves mx's resources to *this.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
vector(BOOST_RV_REF(vector) mx) BOOST_CONTAINER_NOEXCEPT
|
||||
: base_t(boost::move(mx.alloc()))
|
||||
@@ -544,12 +544,12 @@ class vector : private container_detail::vector_alloc_holder<A>
|
||||
//! <b>Effects</b>: Copy constructs a vector using the specified allocator.
|
||||
//!
|
||||
//! <b>Postcondition</b>: x == *this.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: If allocation
|
||||
//! throws or T's copy constructor throws.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear to the elements x contains.
|
||||
vector(const vector &x, const allocator_type &a)
|
||||
vector(const vector &x, const allocator_type &a)
|
||||
: base_t(a)
|
||||
{
|
||||
this->assign( container_detail::to_raw_pointer(x.members_.m_start)
|
||||
@@ -561,7 +561,7 @@ class vector : private container_detail::vector_alloc_holder<A>
|
||||
//! Otherwise copies values from x to *this.
|
||||
//!
|
||||
//! <b>Throws</b>: If allocation or T's copy constructor throws.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant if a == mx.get_allocator(), linear otherwise.
|
||||
vector(BOOST_RV_REF(vector) mx, const allocator_type &a)
|
||||
: base_t(a)
|
||||
@@ -597,103 +597,103 @@ class vector : private container_detail::vector_alloc_holder<A>
|
||||
{} //vector_alloc_holder clears the data
|
||||
|
||||
//! <b>Effects</b>: Returns an iterator to the first element contained in the vector.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
iterator begin() BOOST_CONTAINER_NOEXCEPT
|
||||
{ return iterator(this->members_.m_start); }
|
||||
|
||||
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the vector.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_iterator begin() const BOOST_CONTAINER_NOEXCEPT
|
||||
{ return const_iterator(this->members_.m_start); }
|
||||
|
||||
//! <b>Effects</b>: Returns an iterator to the end of the vector.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
iterator end() BOOST_CONTAINER_NOEXCEPT
|
||||
{ return iterator(this->members_.m_start + this->members_.m_size); }
|
||||
|
||||
//! <b>Effects</b>: Returns a const_iterator to the end of the vector.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_iterator end() const BOOST_CONTAINER_NOEXCEPT
|
||||
{ return this->cend(); }
|
||||
|
||||
//! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning
|
||||
//! of the reversed vector.
|
||||
//!
|
||||
//! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning
|
||||
//! of the reversed vector.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
reverse_iterator rbegin() BOOST_CONTAINER_NOEXCEPT
|
||||
{ return reverse_iterator(this->end()); }
|
||||
|
||||
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
|
||||
//! of the reversed vector.
|
||||
//!
|
||||
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
|
||||
//! of the reversed vector.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_reverse_iterator rbegin() const BOOST_CONTAINER_NOEXCEPT
|
||||
{ return this->crbegin(); }
|
||||
|
||||
//! <b>Effects</b>: Returns a reverse_iterator pointing to the end
|
||||
//! of the reversed vector.
|
||||
//!
|
||||
//! of the reversed vector.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
reverse_iterator rend() BOOST_CONTAINER_NOEXCEPT
|
||||
{ return reverse_iterator(this->begin()); }
|
||||
|
||||
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
|
||||
//! of the reversed vector.
|
||||
//!
|
||||
//! of the reversed vector.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_reverse_iterator rend() const BOOST_CONTAINER_NOEXCEPT
|
||||
{ return this->crend(); }
|
||||
|
||||
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the vector.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_iterator cbegin() const BOOST_CONTAINER_NOEXCEPT
|
||||
{ return const_iterator(this->members_.m_start); }
|
||||
|
||||
//! <b>Effects</b>: Returns a const_iterator to the end of the vector.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_iterator cend() const BOOST_CONTAINER_NOEXCEPT
|
||||
{ return const_iterator(this->members_.m_start + this->members_.m_size); }
|
||||
|
||||
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
|
||||
//! of the reversed vector.
|
||||
//!
|
||||
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
|
||||
//! of the reversed vector.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_reverse_iterator crbegin() const BOOST_CONTAINER_NOEXCEPT
|
||||
{ return const_reverse_iterator(this->end());}
|
||||
|
||||
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
|
||||
//! of the reversed vector.
|
||||
//!
|
||||
//! of the reversed vector.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_reverse_iterator crend() const BOOST_CONTAINER_NOEXCEPT
|
||||
{ return const_reverse_iterator(this->begin()); }
|
||||
@@ -702,9 +702,9 @@ class vector : private container_detail::vector_alloc_holder<A>
|
||||
//!
|
||||
//! <b>Effects</b>: Returns a reference to the first
|
||||
//! element of the container.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
reference front() BOOST_CONTAINER_NOEXCEPT
|
||||
{ return *this->members_.m_start; }
|
||||
@@ -713,9 +713,9 @@ class vector : private container_detail::vector_alloc_holder<A>
|
||||
//!
|
||||
//! <b>Effects</b>: Returns a const reference to the first
|
||||
//! element of the container.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_reference front() const BOOST_CONTAINER_NOEXCEPT
|
||||
{ return *this->members_.m_start; }
|
||||
@@ -724,9 +724,9 @@ class vector : private container_detail::vector_alloc_holder<A>
|
||||
//!
|
||||
//! <b>Effects</b>: Returns a reference to the last
|
||||
//! element of the container.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
reference back() BOOST_CONTAINER_NOEXCEPT
|
||||
{ return this->members_.m_start[this->members_.m_size - 1]; }
|
||||
@@ -735,132 +735,132 @@ class vector : private container_detail::vector_alloc_holder<A>
|
||||
//!
|
||||
//! <b>Effects</b>: Returns a const reference to the last
|
||||
//! element of the container.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_reference back() const BOOST_CONTAINER_NOEXCEPT
|
||||
{ return this->members_.m_start[this->members_.m_size - 1]; }
|
||||
|
||||
//! <b>Returns</b>: A pointer such that [data(),data() + size()) is a valid range.
|
||||
//! For a non-empty vector, data() == &front().
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
pointer data() BOOST_CONTAINER_NOEXCEPT
|
||||
{ return this->members_.m_start; }
|
||||
|
||||
//! <b>Returns</b>: A pointer such that [data(),data() + size()) is a valid range.
|
||||
//! For a non-empty vector, data() == &front().
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_pointer data() const BOOST_CONTAINER_NOEXCEPT
|
||||
{ return this->members_.m_start; }
|
||||
|
||||
//! <b>Effects</b>: Returns the number of the elements contained in the vector.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
size_type size() const BOOST_CONTAINER_NOEXCEPT
|
||||
{ return this->members_.m_size; }
|
||||
|
||||
//! <b>Effects</b>: Returns the largest possible size of the vector.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
size_type max_size() const BOOST_CONTAINER_NOEXCEPT
|
||||
{ return allocator_traits_type::max_size(this->alloc()); }
|
||||
|
||||
//! <b>Effects</b>: Number of elements for which memory has been allocated.
|
||||
//! capacity() is always greater than or equal to size().
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
size_type capacity() const BOOST_CONTAINER_NOEXCEPT
|
||||
{ return this->members_.m_capacity; }
|
||||
|
||||
//! <b>Effects</b>: Returns true if the vector contains no elements.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
bool empty() const BOOST_CONTAINER_NOEXCEPT
|
||||
{ return !this->members_.m_size; }
|
||||
|
||||
//! <b>Requires</b>: size() > n.
|
||||
//!
|
||||
//! <b>Effects</b>: Returns a reference to the nth element
|
||||
//! <b>Effects</b>: Returns a reference to the nth element
|
||||
//! from the beginning of the container.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
reference operator[](size_type n)
|
||||
reference operator[](size_type n)
|
||||
{ return this->members_.m_start[n]; }
|
||||
|
||||
//! <b>Requires</b>: size() > n.
|
||||
//!
|
||||
//! <b>Effects</b>: Returns a const reference to the nth element
|
||||
//! <b>Effects</b>: Returns a const reference to the nth element
|
||||
//! from the beginning of the container.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_reference operator[](size_type n) const BOOST_CONTAINER_NOEXCEPT
|
||||
{ return this->members_.m_start[n]; }
|
||||
|
||||
//! <b>Requires</b>: size() > n.
|
||||
//!
|
||||
//! <b>Effects</b>: Returns a reference to the nth element
|
||||
//! <b>Effects</b>: Returns a reference to the nth element
|
||||
//! from the beginning of the container.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: std::range_error if n >= size()
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
reference at(size_type n)
|
||||
reference at(size_type n)
|
||||
{ this->priv_check_range(n); return this->members_.m_start[n]; }
|
||||
|
||||
//! <b>Requires</b>: size() > n.
|
||||
//!
|
||||
//! <b>Effects</b>: Returns a const reference to the nth element
|
||||
//! <b>Effects</b>: Returns a const reference to the nth element
|
||||
//! from the beginning of the container.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: std::range_error if n >= size()
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
const_reference at(size_type n) const
|
||||
{ this->priv_check_range(n); return this->members_.m_start[n]; }
|
||||
|
||||
//! <b>Effects</b>: Returns a copy of the internal allocator.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: If allocator's copy constructor throws.
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
allocator_type get_allocator() const BOOST_CONTAINER_NOEXCEPT
|
||||
{ return this->alloc(); }
|
||||
|
||||
//! <b>Effects</b>: Returns a reference to the internal allocator.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
//!
|
||||
//!
|
||||
//! <b>Note</b>: Non-standard extension.
|
||||
const stored_allocator_type &get_stored_allocator() const BOOST_CONTAINER_NOEXCEPT
|
||||
{ return this->alloc(); }
|
||||
|
||||
//! <b>Effects</b>: Returns a reference to the internal allocator.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing
|
||||
//!
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant.
|
||||
//!
|
||||
//!
|
||||
//! <b>Note</b>: Non-standard extension.
|
||||
stored_allocator_type &get_stored_allocator() BOOST_CONTAINER_NOEXCEPT
|
||||
{ return this->alloc(); }
|
||||
@@ -869,7 +869,7 @@ class vector : private container_detail::vector_alloc_holder<A>
|
||||
//! effect. Otherwise, it is a request for allocation of additional memory.
|
||||
//! If the request is successful, then capacity() is greater than or equal to
|
||||
//! n; otherwise, capacity() is unchanged. In either case, size() is unchanged.
|
||||
//!
|
||||
//!
|
||||
//! <b>Throws</b>: If memory allocation allocation throws or T's copy/move constructor throws.
|
||||
void reserve(size_type new_cap)
|
||||
{
|
||||
@@ -928,8 +928,8 @@ class vector : private container_detail::vector_alloc_holder<A>
|
||||
|
||||
//! <b>Effects</b>: Makes *this contain the same elements as x.
|
||||
//!
|
||||
//! <b>Postcondition</b>: this->size() == x.size(). *this contains a copy
|
||||
//! of each of x's elements.
|
||||
//! <b>Postcondition</b>: this->size() == x.size(). *this contains a copy
|
||||
//! of each of x's elements.
|
||||
//!
|
||||
//! <b>Throws</b>: If memory allocation throws or T's copy/move constructor/assignment throws.
|
||||
//!
|
||||
@@ -1002,7 +1002,7 @@ class vector : private container_detail::vector_alloc_holder<A>
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear to n.
|
||||
template <class InIt>
|
||||
void assign(InIt first, InIt last)
|
||||
void assign(InIt first, InIt last)
|
||||
{
|
||||
//Dispatch depending on integer/iterator
|
||||
const bool aux_boolean = container_detail::is_convertible<InIt, size_type>::value;
|
||||
@@ -1113,7 +1113,7 @@ class vector : private container_detail::vector_alloc_holder<A>
|
||||
#include BOOST_PP_LOCAL_ITERATE()
|
||||
|
||||
#endif //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
|
||||
|
||||
|
||||
//! <b>Effects</b>: Swaps the contents of *this and x.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
@@ -1184,7 +1184,7 @@ class vector : private container_detail::vector_alloc_holder<A>
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant time.
|
||||
void pop_back()
|
||||
void pop_back()
|
||||
{
|
||||
//Destroy last element
|
||||
--this->members_.m_size;
|
||||
@@ -1195,9 +1195,9 @@ class vector : private container_detail::vector_alloc_holder<A>
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear to the elements between pos and the
|
||||
//! <b>Complexity</b>: Linear to the elements between pos and the
|
||||
//! last element. Constant if pos is the last element.
|
||||
iterator erase(const_iterator position)
|
||||
iterator erase(const_iterator position)
|
||||
{
|
||||
T *pos = container_detail::to_raw_pointer(position.get_ptr());
|
||||
T *beg = container_detail::to_raw_pointer(this->members_.m_start);
|
||||
@@ -1214,7 +1214,7 @@ class vector : private container_detail::vector_alloc_holder<A>
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear to the distance between first and last
|
||||
//! plus linear to the elements between pos and the last element.
|
||||
iterator erase(const_iterator first, const_iterator last)
|
||||
iterator erase(const_iterator first, const_iterator last)
|
||||
{
|
||||
if (first != last){ // worth doing, copy down over hole
|
||||
T* end_pos = container_detail::to_raw_pointer(this->members_.m_start) + this->members_.m_size;
|
||||
@@ -1236,7 +1236,7 @@ class vector : private container_detail::vector_alloc_holder<A>
|
||||
//! <b>Throws</b>: If memory allocation throws, or T's copy constructor throws.
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear to the difference between size() and new_size.
|
||||
void resize(size_type new_size, const T& x)
|
||||
void resize(size_type new_size, const T& x)
|
||||
{
|
||||
pointer finish = this->members_.m_start + this->members_.m_size;
|
||||
if (new_size < size()){
|
||||
@@ -1255,7 +1255,7 @@ class vector : private container_detail::vector_alloc_holder<A>
|
||||
//! <b>Throws</b>: If memory allocation throws, or T's copy constructor throws.
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear to the difference between size() and new_size.
|
||||
void resize(size_type new_size)
|
||||
void resize(size_type new_size)
|
||||
{
|
||||
if (new_size < this->size()){
|
||||
//Destroy last elements
|
||||
@@ -1288,8 +1288,23 @@ class vector : private container_detail::vector_alloc_holder<A>
|
||||
|
||||
/// @cond
|
||||
|
||||
//Absolutely experimental. This function might change, disappear or simply crash!
|
||||
template<class BiDirPosConstIt, class BiDirValueIt>
|
||||
void insert_ordered_at(size_type element_count, BiDirPosConstIt last_position_it, BiDirValueIt last_value_it)
|
||||
{
|
||||
const size_type *dummy = 0;
|
||||
this->priv_insert_ordered_at(element_count, last_position_it, false, &dummy[0], last_value_it);
|
||||
}
|
||||
|
||||
//Absolutely experimental. This function might change, disappear or simply crash!
|
||||
template<class BiDirPosConstIt, class BiDirSkipConstIt, class BiDirValueIt>
|
||||
void insert_ordered_at(size_type element_count, BiDirPosConstIt last_position_it, BiDirSkipConstIt last_skip_it, BiDirValueIt last_value_it)
|
||||
{
|
||||
this->priv_insert_ordered_at(element_count, last_position_it, true, last_skip_it, last_value_it);
|
||||
}
|
||||
|
||||
private:
|
||||
iterator priv_insert(const_iterator position, const T &x)
|
||||
iterator priv_insert(const_iterator position, const T &x)
|
||||
{
|
||||
//Just call more general insert(pos, size, value) and return iterator
|
||||
size_type pos_n = position - cbegin();
|
||||
@@ -1297,7 +1312,7 @@ class vector : private container_detail::vector_alloc_holder<A>
|
||||
return iterator(this->members_.m_start + pos_n);
|
||||
}
|
||||
|
||||
iterator priv_insert(const_iterator position, BOOST_RV_REF(T) x)
|
||||
iterator priv_insert(const_iterator position, BOOST_RV_REF(T) x)
|
||||
{
|
||||
//Just call more general insert(pos, size, value) and return iterator
|
||||
size_type pos_n = position - cbegin();
|
||||
@@ -1387,7 +1402,7 @@ class vector : private container_detail::vector_alloc_holder<A>
|
||||
template <class FwdIt>
|
||||
void priv_range_insert(const_iterator pos, FwdIt first, FwdIt last, std::forward_iterator_tag)
|
||||
{
|
||||
if(first != last){
|
||||
if(first != last){
|
||||
const size_type n = std::distance(first, last);
|
||||
container_detail::advanced_insert_aux_proxy<A, FwdIt, T*> proxy(this->alloc(), first, last);
|
||||
priv_range_insert(pos.get_ptr(), n, proxy);
|
||||
@@ -1428,7 +1443,7 @@ class vector : private container_detail::vector_alloc_holder<A>
|
||||
this->members_.m_capacity = real_cap;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//If we had room or we have expanded forward
|
||||
if (same_buffer_start){
|
||||
#ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
|
||||
@@ -1463,10 +1478,10 @@ class vector : private container_detail::vector_alloc_holder<A>
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
//Absolutely experimental. This function might change, disappear or simply crash!
|
||||
template<class BiDirPosIt, class BiDirValueIt>
|
||||
void insert_ordered_at(size_type element_count, BiDirPosIt last_position_it, BiDirValueIt last_value_it)
|
||||
template<class BiDirPosConstIt, class BiDirSkipConstIt, class BiDirValueIt>
|
||||
void priv_insert_ordered_at( size_type element_count, BiDirPosConstIt last_position_it
|
||||
, bool do_skip, BiDirSkipConstIt last_skip_it, BiDirValueIt last_value_it)
|
||||
{
|
||||
const size_type old_size_pos = this->size();
|
||||
this->reserve(old_size_pos + element_count);
|
||||
@@ -1484,11 +1499,15 @@ class vector : private container_detail::vector_alloc_holder<A>
|
||||
while(insertions_left){
|
||||
const size_type pos = static_cast<size_type>(*(--last_position_it));
|
||||
BOOST_ASSERT(pos <= old_size_pos);
|
||||
//Shift the range after the insertion point, function will take care if the shift
|
||||
//crosses the size() boundary, using copy/move or uninitialized copy/move if necessary.
|
||||
size_type new_hole_size = insert_ordered_at_shift_range(pos, next_pos, this->size(), insertions_left);
|
||||
//If needed shift the range after the insertion point and the previous insertion point.
|
||||
//Function will take care if the shift crosses the size() boundary, using copy/move
|
||||
//or uninitialized copy/move if necessary.
|
||||
size_type new_hole_size = (pos != next_pos)
|
||||
? priv_insert_ordered_at_shift_range(pos, next_pos, this->size(), insertions_left)
|
||||
: hole_size
|
||||
;
|
||||
if(new_hole_size > 0){
|
||||
//The hole was reduced by insert_ordered_at_shift_range so expand exception rollback range backwards
|
||||
//The hole was reduced by priv_insert_ordered_at_shift_range so expand exception rollback range backwards
|
||||
past_hole_values_destroyer.increment_size_backwards(next_pos - pos);
|
||||
//Insert the new value in the hole
|
||||
allocator_traits_type::construct(this->alloc(), begin_ptr + pos + insertions_left - 1, *(--last_value_it));
|
||||
@@ -1505,13 +1524,19 @@ class vector : private container_detail::vector_alloc_holder<A>
|
||||
}
|
||||
else{
|
||||
if(hole_size){
|
||||
//Hole was just filled by insert_ordered_at_shift_range, disable exception rollback and change vector size
|
||||
//Hole was just filled by priv_insert_ordered_at_shift_range, disable exception rollback and change vector size
|
||||
past_hole_values_destroyer.release();
|
||||
this->members_.m_size += element_count;
|
||||
}
|
||||
//Insert the new value in the already constructed range
|
||||
begin_ptr[pos + insertions_left - 1] = *(--last_value_it);
|
||||
}
|
||||
if(do_skip){
|
||||
size_type n = *(--last_skip_it);
|
||||
while(n--){
|
||||
--last_value_it;
|
||||
}
|
||||
}
|
||||
--insertions_left;
|
||||
hole_size = new_hole_size;
|
||||
next_pos = pos;
|
||||
@@ -1531,7 +1556,7 @@ class vector : private container_detail::vector_alloc_holder<A>
|
||||
//
|
||||
//Old situation:
|
||||
// first_pos last_pos old_limit
|
||||
// | | |
|
||||
// | | |
|
||||
// ____________V_______V__________________V_____________
|
||||
//| prefix | range | suffix |raw_mem ~
|
||||
//|____________|_______|__________________|_____________~
|
||||
@@ -1540,20 +1565,20 @@ class vector : private container_detail::vector_alloc_holder<A>
|
||||
// range is moved through move assignments
|
||||
//
|
||||
// first_pos last_pos old_limit
|
||||
// | | |
|
||||
// | | |
|
||||
// ____________V_______V__________________V_____________
|
||||
//| prefix' | | | range |suffix'|raw_mem ~
|
||||
//|________________+______|___^___|_______|_____________~
|
||||
// | |
|
||||
// |_>_>_>_>_>^
|
||||
// |_>_>_>_>_>^
|
||||
//
|
||||
//
|
||||
//New situation in Case B (hole_size >= 0):
|
||||
// range is moved through uninitialized moves
|
||||
//
|
||||
// first_pos last_pos old_limit
|
||||
// | | |
|
||||
// ____________V_______V__________________V________________
|
||||
// | | |
|
||||
// ____________V_______V__________________V________________
|
||||
//| prefix' | | | [hole] | range |
|
||||
//|_______________________________________|________|___^___|
|
||||
// | |
|
||||
@@ -1563,13 +1588,13 @@ class vector : private container_detail::vector_alloc_holder<A>
|
||||
// range is moved through move assignments and uninitialized moves
|
||||
//
|
||||
// first_pos last_pos old_limit
|
||||
// | | |
|
||||
// ____________V_______V__________________V___
|
||||
// | | |
|
||||
// ____________V_______V__________________V___
|
||||
//| prefix' | | | range |
|
||||
//|___________________________________|___^___|
|
||||
// | |
|
||||
// |_>_>_>_>_>_>_>_>_>_>_>^
|
||||
size_type insert_ordered_at_shift_range(size_type first_pos, size_type last_pos, size_type limit_pos, size_type shift_count)
|
||||
size_type priv_insert_ordered_at_shift_range(size_type first_pos, size_type last_pos, size_type limit_pos, size_type shift_count)
|
||||
{
|
||||
BOOST_ASSERT(first_pos <= last_pos);
|
||||
BOOST_ASSERT(last_pos <= limit_pos);
|
||||
@@ -1597,7 +1622,7 @@ class vector : private container_detail::vector_alloc_holder<A>
|
||||
::boost::container::uninitialized_move_alloc
|
||||
(this->alloc(), boundary_ptr, begin_ptr + last_pos, limit_ptr);
|
||||
//The rest is move assigned
|
||||
boost::move_backward(begin_ptr + first_pos, boundary_ptr, limit_ptr + shift_count);
|
||||
boost::move_backward(begin_ptr + first_pos, boundary_ptr, limit_ptr);
|
||||
}
|
||||
return hole_size;
|
||||
}
|
||||
@@ -1646,7 +1671,7 @@ class vector : private container_detail::vector_alloc_holder<A>
|
||||
typename value_traits::ArrayDeallocator scoped_alloc(new_start, this->alloc(), new_cap);
|
||||
typename value_traits::ArrayDestructor constructed_values_destroyer(new_start, this->alloc(), 0u);
|
||||
|
||||
//Initialize with [begin(), pos) old buffer
|
||||
//Initialize with [begin(), pos) old buffer
|
||||
//the start of the new buffer
|
||||
T *old_buffer = container_detail::to_raw_pointer(this->members_.m_start);
|
||||
if(old_buffer){
|
||||
@@ -1658,7 +1683,7 @@ class vector : private container_detail::vector_alloc_holder<A>
|
||||
interf.uninitialized_copy_remaining_to(old_finish = new_finish);
|
||||
new_finish += n;
|
||||
constructed_values_destroyer.increment_size(new_finish - old_finish);
|
||||
//Initialize from the rest of the old buffer,
|
||||
//Initialize from the rest of the old buffer,
|
||||
//starting from previous point
|
||||
if(old_buffer){
|
||||
new_finish = ::boost::container::uninitialized_move_alloc
|
||||
@@ -1666,7 +1691,7 @@ class vector : private container_detail::vector_alloc_holder<A>
|
||||
//Destroy and deallocate old elements
|
||||
//If there is allocated memory, destroy and deallocate
|
||||
if(!value_traits::trivial_dctr_after_move)
|
||||
this->destroy_n(old_buffer, this->members_.m_size);
|
||||
this->destroy_n(old_buffer, this->members_.m_size);
|
||||
this->alloc().deallocate(this->members_.m_start, this->members_.m_capacity);
|
||||
}
|
||||
this->members_.m_start = new_start;
|
||||
@@ -1812,7 +1837,7 @@ class vector : private container_detail::vector_alloc_holder<A>
|
||||
//|___________|_____|_________|_____________________|
|
||||
//
|
||||
//Copy the first part of old_begin to raw_mem
|
||||
T *start_n = old_start + difference_type(s_before);
|
||||
T *start_n = old_start + difference_type(s_before);
|
||||
::boost::container::uninitialized_move_alloc
|
||||
(this->alloc(), old_start, start_n, new_start);
|
||||
//The buffer is all constructed until old_end,
|
||||
@@ -2021,7 +2046,7 @@ class vector : private container_detail::vector_alloc_holder<A>
|
||||
this->members_.m_capacity = real_cap;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(same_buffer_start){
|
||||
T *start = container_detail::to_raw_pointer(this->members_.m_start);
|
||||
if (this->size() >= n){
|
||||
@@ -2050,7 +2075,7 @@ class vector : private container_detail::vector_alloc_holder<A>
|
||||
scoped_alloc.release();
|
||||
//Destroy and deallocate old buffer
|
||||
if(this->members_.m_start != 0){
|
||||
this->destroy_n(container_detail::to_raw_pointer(this->members_.m_start), this->members_.m_size);
|
||||
this->destroy_n(container_detail::to_raw_pointer(this->members_.m_start), this->members_.m_size);
|
||||
this->alloc().deallocate(this->members_.m_start, this->members_.m_capacity);
|
||||
}
|
||||
this->members_.m_start = ret.first;
|
||||
@@ -2068,7 +2093,7 @@ class vector : private container_detail::vector_alloc_holder<A>
|
||||
this->members_.m_size = 0;
|
||||
this->members_.m_start = ret.first;
|
||||
this->members_.m_capacity = real_cap;
|
||||
|
||||
|
||||
//Backup old buffer data
|
||||
size_type old_offset = old_start - container_detail::to_raw_pointer(ret.first);
|
||||
size_type first_count = container_detail::min_value(n, old_offset);
|
||||
@@ -2079,7 +2104,7 @@ class vector : private container_detail::vector_alloc_holder<A>
|
||||
(this->alloc(), first, mid, container_detail::to_raw_pointer(ret.first));
|
||||
|
||||
if(old_offset > n){
|
||||
//All old elements will be destroyed by "old_values_destroyer"
|
||||
//All old elements will be destroyed by "old_values_destroyer"
|
||||
this->members_.m_size = n;
|
||||
}
|
||||
else{
|
||||
@@ -2094,7 +2119,7 @@ class vector : private container_detail::vector_alloc_holder<A>
|
||||
std::advance(mid2, second_count);
|
||||
// iG std::copy(mid, mid2, old_start);
|
||||
std::copy(mid, mid2, old_start);
|
||||
|
||||
|
||||
//Check if we still have to append elements in the
|
||||
//uninitialized end
|
||||
if(second_count == old_size){
|
||||
@@ -2107,7 +2132,7 @@ class vector : private container_detail::vector_alloc_holder<A>
|
||||
(old_start + second_count, old_size - second_count);
|
||||
this->members_.m_size = n;
|
||||
}
|
||||
this->members_.m_size = n;
|
||||
this->members_.m_size = n;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2118,18 +2143,18 @@ class vector : private container_detail::vector_alloc_holder<A>
|
||||
|
||||
template <class InIt>
|
||||
void priv_assign_dispatch(InIt first, InIt last, container_detail::false_)
|
||||
{
|
||||
{
|
||||
//Dispatch depending on integer/iterator
|
||||
typedef typename std::iterator_traits<InIt>::iterator_category ItCat;
|
||||
this->priv_assign_aux(first, last, ItCat());
|
||||
this->priv_assign_aux(first, last, ItCat());
|
||||
}
|
||||
|
||||
template <class Integer>
|
||||
void priv_insert_dispatch(const_iterator pos, Integer n, Integer val, container_detail::true_)
|
||||
void priv_insert_dispatch(const_iterator pos, Integer n, Integer val, container_detail::true_)
|
||||
{ this->insert(pos, (size_type)n, (T)val); }
|
||||
|
||||
template <class InIt>
|
||||
void priv_insert_dispatch(const_iterator pos, InIt first,
|
||||
void priv_insert_dispatch(const_iterator pos, InIt first,
|
||||
InIt last, container_detail::false_)
|
||||
{
|
||||
//Dispatch depending on integer/iterator
|
||||
@@ -2137,7 +2162,7 @@ class vector : private container_detail::vector_alloc_holder<A>
|
||||
this->priv_range_insert(pos, first, last, ItCat());
|
||||
}
|
||||
|
||||
void priv_check_range(size_type n) const
|
||||
void priv_check_range(size_type n) const
|
||||
{
|
||||
//If n is out of range, throw an out_of_range exception
|
||||
if (n >= size())
|
||||
@@ -2157,7 +2182,7 @@ class vector : private container_detail::vector_alloc_holder<A>
|
||||
};
|
||||
|
||||
template <class T, class A>
|
||||
inline bool
|
||||
inline bool
|
||||
operator==(const vector<T, A>& x, const vector<T, A>& y)
|
||||
{
|
||||
//Check first size and each element if needed
|
||||
@@ -2165,7 +2190,7 @@ operator==(const vector<T, A>& x, const vector<T, A>& y)
|
||||
}
|
||||
|
||||
template <class T, class A>
|
||||
inline bool
|
||||
inline bool
|
||||
operator!=(const vector<T, A>& x, const vector<T, A>& y)
|
||||
{
|
||||
//Check first size and each element if needed
|
||||
@@ -2173,7 +2198,7 @@ operator!=(const vector<T, A>& x, const vector<T, A>& y)
|
||||
}
|
||||
|
||||
template <class T, class A>
|
||||
inline bool
|
||||
inline bool
|
||||
operator<(const vector<T, A>& x, const vector<T, A>& y)
|
||||
{
|
||||
return std::lexicographical_compare(x.begin(), x.end(), y.begin(), y.end());
|
||||
|
Reference in New Issue
Block a user