summaryrefslogtreecommitdiff
path: root/boost/container/stable_vector.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/container/stable_vector.hpp')
-rw-r--r--boost/container/stable_vector.hpp217
1 files changed, 117 insertions, 100 deletions
diff --git a/boost/container/stable_vector.hpp b/boost/container/stable_vector.hpp
index 1f55c435ad..92ef0f6a7f 100644
--- a/boost/container/stable_vector.hpp
+++ b/boost/container/stable_vector.hpp
@@ -80,14 +80,14 @@ template <class C>
class clear_on_destroy
{
public:
- clear_on_destroy(C &c)
+ BOOST_CONTAINER_FORCEINLINE clear_on_destroy(C &c)
: c_(c), do_clear_(true)
{}
- void release()
+ BOOST_CONTAINER_FORCEINLINE void release()
{ do_clear_ = false; }
- ~clear_on_destroy()
+ BOOST_CONTAINER_FORCEINLINE ~clear_on_destroy()
{
if(do_clear_){
c_.clear();
@@ -121,11 +121,11 @@ struct node_base
<node_base_ptr>::type node_base_ptr_ptr;
public:
- explicit node_base(const node_base_ptr_ptr &n)
+ BOOST_CONTAINER_FORCEINLINE explicit node_base(const node_base_ptr_ptr &n)
: up(n)
{}
- node_base()
+ BOOST_CONTAINER_FORCEINLINE node_base()
: up()
{}
@@ -220,7 +220,7 @@ struct index_traits
// Node cache first is *(this->index.end() - 2);
// Node cache last is this->index.back();
- static node_base_ptr_ptr ptr_to_node_base_ptr(node_base_ptr &n)
+ BOOST_CONTAINER_FORCEINLINE static node_base_ptr_ptr ptr_to_node_base_ptr(node_base_ptr &n)
{ return node_base_ptr_ptr_traits::pointer_to(n); }
static void fix_up_pointers(index_iterator first, index_iterator last)
@@ -233,10 +233,10 @@ struct index_traits
}
}
- static index_iterator get_fix_up_end(index_type &index)
+ BOOST_CONTAINER_FORCEINLINE static index_iterator get_fix_up_end(index_type &index)
{ return index.end() - (ExtraPointers - 1); }
- static void fix_up_pointers_from(index_type & index, index_iterator first)
+ BOOST_CONTAINER_FORCEINLINE static void fix_up_pointers_from(index_type & index, index_iterator first)
{ index_traits::fix_up_pointers(first, index_traits::get_fix_up_end(index)); }
static void readjust_end_node(index_type &index, node_base_type &end_node)
@@ -298,7 +298,6 @@ class stable_vector_iterator
typedef boost::intrusive::pointer_traits<pointer> ptr_traits;
typedef typename ptr_traits::reference reference;
- private:
typedef typename non_const_ptr_traits::template
rebind_pointer<void>::type void_ptr;
typedef stable_vector_detail::node<Pointer> node_type;
@@ -312,107 +311,124 @@ class stable_vector_iterator
typedef typename non_const_ptr_traits::template
rebind_pointer<node_base_ptr>::type node_base_ptr_ptr;
+ class nat
+ {
+ public:
+ node_base_ptr node_pointer() const
+ { return node_base_ptr(); }
+ };
+ typedef typename dtl::if_c< IsConst
+ , stable_vector_iterator<Pointer, false>
+ , nat>::type nonconst_iterator;
+
node_base_ptr m_pn;
public:
- explicit stable_vector_iterator(node_base_ptr p) BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE explicit stable_vector_iterator(node_base_ptr p) BOOST_NOEXCEPT_OR_NOTHROW
: m_pn(p)
{}
- stable_vector_iterator() BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE stable_vector_iterator() BOOST_NOEXCEPT_OR_NOTHROW
: m_pn() //Value initialization to achieve "null iterators" (N3644)
{}
- stable_vector_iterator(stable_vector_iterator<Pointer, false> const& other) BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE stable_vector_iterator(const stable_vector_iterator& other) BOOST_NOEXCEPT_OR_NOTHROW
: m_pn(other.node_pointer())
{}
- node_ptr node_pointer() const BOOST_NOEXCEPT_OR_NOTHROW
+ stable_vector_iterator(const nonconst_iterator& other) BOOST_NOEXCEPT_OR_NOTHROW
+ : m_pn(other.node_pointer())
+ {}
+
+ BOOST_CONTAINER_FORCEINLINE stable_vector_iterator & operator=(const stable_vector_iterator& other) BOOST_NOEXCEPT_OR_NOTHROW
+ { m_pn = other.node_pointer(); return *this; }
+
+ BOOST_CONTAINER_FORCEINLINE node_ptr node_pointer() const BOOST_NOEXCEPT_OR_NOTHROW
{ return node_ptr_traits::static_cast_from(m_pn); }
public:
//Pointer like operators
- reference operator*() const BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE reference operator*() const BOOST_NOEXCEPT_OR_NOTHROW
{ return node_pointer()->get_data(); }
- pointer operator->() const BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE pointer operator->() const BOOST_NOEXCEPT_OR_NOTHROW
{ return ptr_traits::pointer_to(this->operator*()); }
//Increment / Decrement
- stable_vector_iterator& operator++() BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE stable_vector_iterator& operator++() BOOST_NOEXCEPT_OR_NOTHROW
{
node_base_ptr_ptr p(this->m_pn->up);
this->m_pn = *(++p);
return *this;
}
- stable_vector_iterator operator++(int) BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE stable_vector_iterator operator++(int) BOOST_NOEXCEPT_OR_NOTHROW
{ stable_vector_iterator tmp(*this); ++*this; return stable_vector_iterator(tmp); }
- stable_vector_iterator& operator--() BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE stable_vector_iterator& operator--() BOOST_NOEXCEPT_OR_NOTHROW
{
node_base_ptr_ptr p(this->m_pn->up);
this->m_pn = *(--p);
return *this;
}
- stable_vector_iterator operator--(int) BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE stable_vector_iterator operator--(int) BOOST_NOEXCEPT_OR_NOTHROW
{ stable_vector_iterator tmp(*this); --*this; return stable_vector_iterator(tmp); }
- reference operator[](difference_type off) const BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE reference operator[](difference_type off) const BOOST_NOEXCEPT_OR_NOTHROW
{ return node_ptr_traits::static_cast_from(this->m_pn->up[off])->get_data(); }
- stable_vector_iterator& operator+=(difference_type off) BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE stable_vector_iterator& operator+=(difference_type off) BOOST_NOEXCEPT_OR_NOTHROW
{
if(off) this->m_pn = this->m_pn->up[off];
return *this;
}
- friend stable_vector_iterator operator+(const stable_vector_iterator &left, difference_type off) BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE friend stable_vector_iterator operator+(const stable_vector_iterator &left, difference_type off) BOOST_NOEXCEPT_OR_NOTHROW
{
stable_vector_iterator tmp(left);
tmp += off;
return tmp;
}
- friend stable_vector_iterator operator+(difference_type off, const stable_vector_iterator& right) BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE friend stable_vector_iterator operator+(difference_type off, const stable_vector_iterator& right) BOOST_NOEXCEPT_OR_NOTHROW
{
stable_vector_iterator tmp(right);
tmp += off;
return tmp;
}
- stable_vector_iterator& operator-=(difference_type off) BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE stable_vector_iterator& operator-=(difference_type off) BOOST_NOEXCEPT_OR_NOTHROW
{ *this += -off; return *this; }
- friend stable_vector_iterator operator-(const stable_vector_iterator &left, difference_type off) BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE friend stable_vector_iterator operator-(const stable_vector_iterator &left, difference_type off) BOOST_NOEXCEPT_OR_NOTHROW
{
stable_vector_iterator tmp(left);
tmp -= off;
return tmp;
}
- friend difference_type operator-(const stable_vector_iterator &left, const stable_vector_iterator &right) BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE friend difference_type operator-(const stable_vector_iterator &left, const stable_vector_iterator &right) BOOST_NOEXCEPT_OR_NOTHROW
{ return left.m_pn->up - right.m_pn->up; }
//Comparison operators
- friend bool operator== (const stable_vector_iterator& l, const stable_vector_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE friend bool operator== (const stable_vector_iterator& l, const stable_vector_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW
{ return l.m_pn == r.m_pn; }
- friend bool operator!= (const stable_vector_iterator& l, const stable_vector_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE friend bool operator!= (const stable_vector_iterator& l, const stable_vector_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW
{ return l.m_pn != r.m_pn; }
- friend bool operator< (const stable_vector_iterator& l, const stable_vector_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE friend bool operator< (const stable_vector_iterator& l, const stable_vector_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW
{ return l.m_pn->up < r.m_pn->up; }
- friend bool operator<= (const stable_vector_iterator& l, const stable_vector_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE friend bool operator<= (const stable_vector_iterator& l, const stable_vector_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW
{ return l.m_pn->up <= r.m_pn->up; }
- friend bool operator> (const stable_vector_iterator& l, const stable_vector_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE friend bool operator> (const stable_vector_iterator& l, const stable_vector_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW
{ return l.m_pn->up > r.m_pn->up; }
- friend bool operator>= (const stable_vector_iterator& l, const stable_vector_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE friend bool operator>= (const stable_vector_iterator& l, const stable_vector_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW
{ return l.m_pn->up >= r.m_pn->up; }
};
@@ -465,14 +481,15 @@ class stable_vector_iterator
//! \tparam T The type of object that is stored in the stable_vector
//! \tparam Allocator The allocator used for all internal memory management
#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
-template <class T, class Allocator = new_allocator<T> >
+template <class T, class Allocator = void >
#else
template <class T, class Allocator>
#endif
class stable_vector
{
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
- typedef allocator_traits<Allocator> allocator_traits_type;
+ typedef typename real_allocator<T, Allocator>::type ValueAllocator;
+ typedef allocator_traits<ValueAllocator> allocator_traits_type;
typedef boost::intrusive::
pointer_traits
<typename allocator_traits_type::pointer> ptr_traits;
@@ -510,7 +527,7 @@ class stable_vector
typedef ::boost::container::dtl::integral_constant
<unsigned, boost::container::dtl::
- version<Allocator>::value> alloc_version;
+ version<ValueAllocator>::value> alloc_version;
typedef typename allocator_traits_type::
template portable_rebind_alloc
<node_type>::type node_allocator_type;
@@ -519,24 +536,24 @@ class stable_vector
allocator_version_traits<node_allocator_type> allocator_version_traits_t;
typedef typename allocator_version_traits_t::multiallocation_chain multiallocation_chain;
- node_ptr allocate_one()
+ BOOST_CONTAINER_FORCEINLINE node_ptr allocate_one()
{ return allocator_version_traits_t::allocate_one(this->priv_node_alloc()); }
- void deallocate_one(const node_ptr &p)
+ BOOST_CONTAINER_FORCEINLINE void deallocate_one(const node_ptr &p)
{ allocator_version_traits_t::deallocate_one(this->priv_node_alloc(), p); }
- void allocate_individual(typename allocator_traits_type::size_type n, multiallocation_chain &m)
+ BOOST_CONTAINER_FORCEINLINE void allocate_individual(typename allocator_traits_type::size_type n, multiallocation_chain &m)
{ allocator_version_traits_t::allocate_individual(this->priv_node_alloc(), n, m); }
- void deallocate_individual(multiallocation_chain &holder)
+ BOOST_CONTAINER_FORCEINLINE void deallocate_individual(multiallocation_chain &holder)
{ allocator_version_traits_t::deallocate_individual(this->priv_node_alloc(), holder); }
friend class stable_vector_detail::clear_on_destroy<stable_vector>;
typedef stable_vector_iterator
- < typename allocator_traits<Allocator>::pointer
+ < typename allocator_traits<ValueAllocator>::pointer
, false> iterator_impl;
typedef stable_vector_iterator
- < typename allocator_traits<Allocator>::pointer
+ < typename allocator_traits<ValueAllocator>::pointer
, true> const_iterator_impl;
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
public:
@@ -547,13 +564,13 @@ class stable_vector
//
//////////////////////////////////////////////
typedef T value_type;
- typedef typename ::boost::container::allocator_traits<Allocator>::pointer pointer;
- typedef typename ::boost::container::allocator_traits<Allocator>::const_pointer const_pointer;
- typedef typename ::boost::container::allocator_traits<Allocator>::reference reference;
- typedef typename ::boost::container::allocator_traits<Allocator>::const_reference const_reference;
- typedef typename ::boost::container::allocator_traits<Allocator>::size_type size_type;
- typedef typename ::boost::container::allocator_traits<Allocator>::difference_type difference_type;
- typedef Allocator allocator_type;
+ typedef typename ::boost::container::allocator_traits<ValueAllocator>::pointer pointer;
+ typedef typename ::boost::container::allocator_traits<ValueAllocator>::const_pointer const_pointer;
+ typedef typename ::boost::container::allocator_traits<ValueAllocator>::reference reference;
+ typedef typename ::boost::container::allocator_traits<ValueAllocator>::const_reference const_reference;
+ typedef typename ::boost::container::allocator_traits<ValueAllocator>::size_type size_type;
+ typedef typename ::boost::container::allocator_traits<ValueAllocator>::difference_type difference_type;
+ typedef ValueAllocator allocator_type;
typedef node_allocator_type stored_allocator_type;
typedef BOOST_CONTAINER_IMPDEF(iterator_impl) iterator;
typedef BOOST_CONTAINER_IMPDEF(const_iterator_impl) const_iterator;
@@ -584,7 +601,7 @@ class stable_vector
//! <b>Throws</b>: If allocator_type's default constructor throws.
//!
//! <b>Complexity</b>: Constant.
- stable_vector() BOOST_NOEXCEPT_IF(dtl::is_nothrow_default_constructible<Allocator>::value)
+ BOOST_CONTAINER_FORCEINLINE stable_vector() BOOST_NOEXCEPT_IF(dtl::is_nothrow_default_constructible<ValueAllocator>::value)
: internal_data(), index()
{
STABLE_VECTOR_CHECK_INVARIANT;
@@ -595,7 +612,7 @@ class stable_vector
//! <b>Throws</b>: Nothing
//!
//! <b>Complexity</b>: Constant.
- explicit stable_vector(const allocator_type& al) BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE explicit stable_vector(const allocator_type& al) BOOST_NOEXCEPT_OR_NOTHROW
: internal_data(al), index(al)
{
STABLE_VECTOR_CHECK_INVARIANT;
@@ -742,7 +759,7 @@ class stable_vector
//! <b>Throws</b>: If allocator_type's copy constructor throws.
//!
//! <b>Complexity</b>: Constant.
- stable_vector(BOOST_RV_REF(stable_vector) x) BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE stable_vector(BOOST_RV_REF(stable_vector) x) BOOST_NOEXCEPT_OR_NOTHROW
: internal_data(boost::move(x.priv_node_alloc())), index(boost::move(x.index))
{
this->priv_swap_members(x);
@@ -882,7 +899,7 @@ class stable_vector
//! <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& t)
+ BOOST_CONTAINER_FORCEINLINE void assign(size_type n, const T& t)
{
typedef constant_iterator<value_type, difference_type> cvalue_iterator;
this->assign(cvalue_iterator(t, n), cvalue_iterator());
@@ -921,7 +938,7 @@ class stable_vector
//! <b>Throws</b>: If memory allocation throws or
//! T's constructor from dereferencing initializer_list iterator throws.
//!
- void assign(std::initializer_list<value_type> il)
+ BOOST_CONTAINER_FORCEINLINE void assign(std::initializer_list<value_type> il)
{
STABLE_VECTOR_CHECK_INVARIANT;
assign(il.begin(), il.end());
@@ -933,7 +950,7 @@ class stable_vector
//! <b>Throws</b>: If allocator's copy constructor throws.
//!
//! <b>Complexity</b>: Constant.
- allocator_type get_allocator() const
+ BOOST_CONTAINER_FORCEINLINE allocator_type get_allocator() const
{ return this->priv_node_alloc(); }
//! <b>Effects</b>: Returns a reference to the internal allocator.
@@ -943,7 +960,7 @@ class stable_vector
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: Non-standard extension.
- const stored_allocator_type &get_stored_allocator() const BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE const stored_allocator_type &get_stored_allocator() const BOOST_NOEXCEPT_OR_NOTHROW
{ return this->priv_node_alloc(); }
//! <b>Effects</b>: Returns a reference to the internal allocator.
@@ -953,7 +970,7 @@ class stable_vector
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: Non-standard extension.
- stored_allocator_type &get_stored_allocator() BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE stored_allocator_type &get_stored_allocator() BOOST_NOEXCEPT_OR_NOTHROW
{ return this->priv_node_alloc(); }
//////////////////////////////////////////////
@@ -967,7 +984,7 @@ class stable_vector
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- iterator begin() BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE iterator begin() BOOST_NOEXCEPT_OR_NOTHROW
{ return (this->index.empty()) ? this->end(): iterator(node_ptr_traits::static_cast_from(this->index.front())); }
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the stable_vector.
@@ -975,7 +992,7 @@ class stable_vector
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- const_iterator begin() const BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE const_iterator begin() const BOOST_NOEXCEPT_OR_NOTHROW
{ return (this->index.empty()) ? this->cend() : const_iterator(node_ptr_traits::static_cast_from(this->index.front())) ; }
//! <b>Effects</b>: Returns an iterator to the end of the stable_vector.
@@ -983,7 +1000,7 @@ class stable_vector
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- iterator end() BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE iterator end() BOOST_NOEXCEPT_OR_NOTHROW
{ return iterator(this->priv_get_end_node()); }
//! <b>Effects</b>: Returns a const_iterator to the end of the stable_vector.
@@ -991,7 +1008,7 @@ class stable_vector
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- const_iterator end() const BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE const_iterator end() const BOOST_NOEXCEPT_OR_NOTHROW
{ return const_iterator(this->priv_get_end_node()); }
//! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning
@@ -1000,7 +1017,7 @@ class stable_vector
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- reverse_iterator rbegin() BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE reverse_iterator rbegin() BOOST_NOEXCEPT_OR_NOTHROW
{ return reverse_iterator(this->end()); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
@@ -1009,7 +1026,7 @@ class stable_vector
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- const_reverse_iterator rbegin() const BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE const_reverse_iterator rbegin() const BOOST_NOEXCEPT_OR_NOTHROW
{ return const_reverse_iterator(this->end()); }
//! <b>Effects</b>: Returns a reverse_iterator pointing to the end
@@ -1018,7 +1035,7 @@ class stable_vector
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- reverse_iterator rend() BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE reverse_iterator rend() BOOST_NOEXCEPT_OR_NOTHROW
{ return reverse_iterator(this->begin()); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
@@ -1027,7 +1044,7 @@ class stable_vector
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- const_reverse_iterator rend() const BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE const_reverse_iterator rend() const BOOST_NOEXCEPT_OR_NOTHROW
{ return const_reverse_iterator(this->begin()); }
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the stable_vector.
@@ -1035,7 +1052,7 @@ class stable_vector
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- const_iterator cbegin() const BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE const_iterator cbegin() const BOOST_NOEXCEPT_OR_NOTHROW
{ return this->begin(); }
//! <b>Effects</b>: Returns a const_iterator to the end of the stable_vector.
@@ -1043,7 +1060,7 @@ class stable_vector
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- const_iterator cend() const BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE const_iterator cend() const BOOST_NOEXCEPT_OR_NOTHROW
{ return this->end(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
@@ -1052,7 +1069,7 @@ class stable_vector
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- const_reverse_iterator crbegin() const BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE const_reverse_iterator crbegin() const BOOST_NOEXCEPT_OR_NOTHROW
{ return this->rbegin(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
@@ -1061,7 +1078,7 @@ class stable_vector
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- const_reverse_iterator crend()const BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE const_reverse_iterator crend()const BOOST_NOEXCEPT_OR_NOTHROW
{ return this->rend(); }
//////////////////////////////////////////////
@@ -1075,7 +1092,7 @@ class stable_vector
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- bool empty() const BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE bool empty() const BOOST_NOEXCEPT_OR_NOTHROW
{ return this->index.size() <= ExtraPointers; }
//! <b>Effects</b>: Returns the number of the elements contained in the stable_vector.
@@ -1083,7 +1100,7 @@ class stable_vector
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- size_type size() const BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE size_type size() const BOOST_NOEXCEPT_OR_NOTHROW
{
const size_type index_size = this->index.size();
return (index_size - ExtraPointers) & (size_type(0u) -size_type(index_size != 0));
@@ -1094,7 +1111,7 @@ class stable_vector
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- size_type max_size() const BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE size_type max_size() const BOOST_NOEXCEPT_OR_NOTHROW
{ return this->index.max_size() - ExtraPointers; }
//! <b>Effects</b>: Inserts or erases elements at the end such that
@@ -1239,7 +1256,7 @@ class stable_vector
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- reference front() BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE reference front() BOOST_NOEXCEPT_OR_NOTHROW
{
BOOST_ASSERT(!this->empty());
return static_cast<node_reference>(*this->index.front()).get_data();
@@ -1253,7 +1270,7 @@ class stable_vector
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- const_reference front() const BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE const_reference front() const BOOST_NOEXCEPT_OR_NOTHROW
{
BOOST_ASSERT(!this->empty());
return static_cast<const_node_reference>(*this->index.front()).get_data();
@@ -1267,7 +1284,7 @@ class stable_vector
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- reference back() BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE reference back() BOOST_NOEXCEPT_OR_NOTHROW
{
BOOST_ASSERT(!this->empty());
return static_cast<node_reference>(*this->index[this->size()-1u]).get_data();
@@ -1295,7 +1312,7 @@ class stable_vector
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- reference operator[](size_type n) BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE reference operator[](size_type n) BOOST_NOEXCEPT_OR_NOTHROW
{
BOOST_ASSERT(this->size() > n);
return static_cast<node_reference>(*this->index[n]).get_data();
@@ -1309,7 +1326,7 @@ class stable_vector
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- const_reference operator[](size_type n) const BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE const_reference operator[](size_type n) const BOOST_NOEXCEPT_OR_NOTHROW
{
BOOST_ASSERT(this->size() > n);
return static_cast<const_node_reference>(*this->index[n]).get_data();
@@ -1326,7 +1343,7 @@ class stable_vector
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: Non-standard extension
- iterator nth(size_type n) BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE iterator nth(size_type n) BOOST_NOEXCEPT_OR_NOTHROW
{
BOOST_ASSERT(this->size() >= n);
return (this->index.empty()) ? this->end() : iterator(node_ptr_traits::static_cast_from(this->index[n]));
@@ -1343,7 +1360,7 @@ class stable_vector
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: Non-standard extension
- const_iterator nth(size_type n) const BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE const_iterator nth(size_type n) const BOOST_NOEXCEPT_OR_NOTHROW
{
BOOST_ASSERT(this->size() >= n);
return (this->index.empty()) ? this->cend() : iterator(node_ptr_traits::static_cast_from(this->index[n]));
@@ -1359,7 +1376,7 @@ class stable_vector
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: Non-standard extension
- size_type index_of(iterator p) BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE size_type index_of(iterator p) BOOST_NOEXCEPT_OR_NOTHROW
{ return this->priv_index_of(p.node_pointer()); }
//! <b>Requires</b>: begin() <= p <= end().
@@ -1372,7 +1389,7 @@ class stable_vector
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: Non-standard extension
- size_type index_of(const_iterator p) const BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE size_type index_of(const_iterator p) const BOOST_NOEXCEPT_OR_NOTHROW
{ return this->priv_index_of(p.node_pointer()); }
//! <b>Requires</b>: size() > n.
@@ -1558,7 +1575,7 @@ class stable_vector
//! <b>Returns</b>: an iterator to the first inserted element or p if first == last.
//!
//! <b>Complexity</b>: Linear to distance [il.begin(), il.end()).
- iterator insert(const_iterator p, std::initializer_list<value_type> il)
+ BOOST_CONTAINER_FORCEINLINE iterator insert(const_iterator p, std::initializer_list<value_type> il)
{
//Position checks done by insert()
STABLE_VECTOR_CHECK_INVARIANT;
@@ -1645,7 +1662,7 @@ class stable_vector
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant time.
- void pop_back() BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE void pop_back() BOOST_NOEXCEPT_OR_NOTHROW
{
BOOST_ASSERT(!this->empty());
this->erase(--this->cend());
@@ -1657,7 +1674,7 @@ class stable_vector
//!
//! <b>Complexity</b>: Linear to the elements between p and the
//! last element. Constant if p is the last element.
- iterator erase(const_iterator p) BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE iterator erase(const_iterator p) BOOST_NOEXCEPT_OR_NOTHROW
{
BOOST_ASSERT(this->priv_in_range(p));
STABLE_VECTOR_CHECK_INVARIANT;
@@ -1728,49 +1745,49 @@ class stable_vector
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Linear to the number of elements in the stable_vector.
- void clear() BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE void clear() BOOST_NOEXCEPT_OR_NOTHROW
{ this->erase(this->cbegin(),this->cend()); }
//! <b>Effects</b>: Returns true if x and y are equal
//!
//! <b>Complexity</b>: Linear to the number of elements in the container.
- friend bool operator==(const stable_vector& x, const stable_vector& y)
+ BOOST_CONTAINER_FORCEINLINE friend bool operator==(const stable_vector& x, const stable_vector& y)
{ return x.size() == y.size() && ::boost::container::algo_equal(x.begin(), x.end(), y.begin()); }
//! <b>Effects</b>: Returns true if x and y are unequal
//!
//! <b>Complexity</b>: Linear to the number of elements in the container.
- friend bool operator!=(const stable_vector& x, const stable_vector& y)
+ BOOST_CONTAINER_FORCEINLINE friend bool operator!=(const stable_vector& x, const stable_vector& y)
{ return !(x == y); }
//! <b>Effects</b>: Returns true if x is less than y
//!
//! <b>Complexity</b>: Linear to the number of elements in the container.
- friend bool operator<(const stable_vector& x, const stable_vector& y)
+ BOOST_CONTAINER_FORCEINLINE friend bool operator<(const stable_vector& x, const stable_vector& y)
{ return ::boost::container::algo_lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); }
//! <b>Effects</b>: Returns true if x is greater than y
//!
//! <b>Complexity</b>: Linear to the number of elements in the container.
- friend bool operator>(const stable_vector& x, const stable_vector& y)
+ BOOST_CONTAINER_FORCEINLINE friend bool operator>(const stable_vector& x, const stable_vector& y)
{ return y < x; }
//! <b>Effects</b>: Returns true if x is equal or less than y
//!
//! <b>Complexity</b>: Linear to the number of elements in the container.
- friend bool operator<=(const stable_vector& x, const stable_vector& y)
+ BOOST_CONTAINER_FORCEINLINE friend bool operator<=(const stable_vector& x, const stable_vector& y)
{ return !(y < x); }
//! <b>Effects</b>: Returns true if x is equal or greater than y
//!
//! <b>Complexity</b>: Linear to the number of elements in the container.
- friend bool operator>=(const stable_vector& x, const stable_vector& y)
+ BOOST_CONTAINER_FORCEINLINE friend bool operator>=(const stable_vector& x, const stable_vector& y)
{ return !(x < y); }
//! <b>Effects</b>: x.swap(y)
//!
//! <b>Complexity</b>: Constant.
- friend void swap(stable_vector& x, stable_vector& y)
+ BOOST_CONTAINER_FORCEINLINE friend void swap(stable_vector& x, stable_vector& y)
{ x.swap(y); }
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
@@ -1781,12 +1798,12 @@ class stable_vector
return (this->begin() <= pos) && (pos < this->end());
}
- bool priv_in_range_or_end(const_iterator pos) const
+ BOOST_CONTAINER_FORCEINLINE bool priv_in_range_or_end(const_iterator pos) const
{
return (this->begin() <= pos) && (pos <= this->end());
}
- size_type priv_index_of(node_ptr p) const
+ BOOST_CONTAINER_FORCEINLINE size_type priv_index_of(node_ptr p) const
{
//Check range
BOOST_ASSERT(this->index.empty() || (this->index.data() <= p->up));
@@ -1820,18 +1837,18 @@ class stable_vector
class push_back_rollback
{
public:
- push_back_rollback(stable_vector &sv, const node_ptr &p)
+ BOOST_CONTAINER_FORCEINLINE push_back_rollback(stable_vector &sv, const node_ptr &p)
: m_sv(sv), m_p(p)
{}
- ~push_back_rollback()
+ BOOST_CONTAINER_FORCEINLINE ~push_back_rollback()
{
if(m_p){
m_sv.priv_put_in_pool(m_p);
}
}
- void release()
+ BOOST_CONTAINER_FORCEINLINE void release()
{ m_p = node_ptr(); }
private:
@@ -1861,7 +1878,7 @@ class stable_vector
return index_beg + idx;
}
- bool priv_capacity_bigger_than_size() const
+ BOOST_CONTAINER_FORCEINLINE bool priv_capacity_bigger_than_size() const
{
return this->index.capacity() > this->index.size() &&
this->internal_data.pool_size > 0;
@@ -1994,16 +2011,16 @@ class stable_vector
return ret;
}
- node_base_ptr priv_get_end_node() const
+ BOOST_CONTAINER_FORCEINLINE node_base_ptr priv_get_end_node() const
{ return node_base_ptr_traits::pointer_to(const_cast<node_base_type&>(this->internal_data.end_node)); }
- void priv_destroy_node(const node_type &n)
+ BOOST_CONTAINER_FORCEINLINE void priv_destroy_node(const node_type &n)
{
allocator_traits<node_allocator_type>::
destroy(this->priv_node_alloc(), &n);
}
- void priv_delete_node(const node_ptr &n)
+ BOOST_CONTAINER_FORCEINLINE void priv_delete_node(const node_ptr &n)
{
this->priv_destroy_node(*n);
this->priv_put_in_pool(n);