src/cxx_supportlib/vendor-modified/boost/container/vector.hpp in passenger-5.1.4 vs src/cxx_supportlib/vendor-modified/boost/container/vector.hpp in passenger-5.1.5
- old
+ new
@@ -94,101 +94,101 @@
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
private:
Pointer m_ptr;
public:
- const Pointer &get_ptr() const BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE const Pointer &get_ptr() const BOOST_NOEXCEPT_OR_NOTHROW
{ return m_ptr; }
- Pointer &get_ptr() BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE Pointer &get_ptr() BOOST_NOEXCEPT_OR_NOTHROW
{ return m_ptr; }
- explicit vec_iterator(Pointer ptr) BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE explicit vec_iterator(Pointer ptr) BOOST_NOEXCEPT_OR_NOTHROW
: m_ptr(ptr)
{}
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
public:
//Constructors
- vec_iterator() BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE vec_iterator() BOOST_NOEXCEPT_OR_NOTHROW
: m_ptr() //Value initialization to achieve "null iterators" (N3644)
{}
- vec_iterator(vec_iterator<Pointer, false> const& other) BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE vec_iterator(vec_iterator<Pointer, false> const& other) BOOST_NOEXCEPT_OR_NOTHROW
: m_ptr(other.get_ptr())
{}
//Pointer like operators
- reference operator*() const BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE reference operator*() const BOOST_NOEXCEPT_OR_NOTHROW
{ return *m_ptr; }
- pointer operator->() const BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE pointer operator->() const BOOST_NOEXCEPT_OR_NOTHROW
{ return ::boost::intrusive::pointer_traits<pointer>::pointer_to(this->operator*()); }
- reference operator[](difference_type off) const BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE reference operator[](difference_type off) const BOOST_NOEXCEPT_OR_NOTHROW
{ return m_ptr[off]; }
//Increment / Decrement
- vec_iterator& operator++() BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE vec_iterator& operator++() BOOST_NOEXCEPT_OR_NOTHROW
{ ++m_ptr; return *this; }
- vec_iterator operator++(int) BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE vec_iterator operator++(int) BOOST_NOEXCEPT_OR_NOTHROW
{ return vec_iterator(m_ptr++); }
- vec_iterator& operator--() BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE vec_iterator& operator--() BOOST_NOEXCEPT_OR_NOTHROW
{ --m_ptr; return *this; }
- vec_iterator operator--(int) BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE vec_iterator operator--(int) BOOST_NOEXCEPT_OR_NOTHROW
{ return vec_iterator(m_ptr--); }
//Arithmetic
- vec_iterator& operator+=(difference_type off) BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE vec_iterator& operator+=(difference_type off) BOOST_NOEXCEPT_OR_NOTHROW
{ m_ptr += off; return *this; }
- vec_iterator& operator-=(difference_type off) BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE vec_iterator& operator-=(difference_type off) BOOST_NOEXCEPT_OR_NOTHROW
{ m_ptr -= off; return *this; }
- friend vec_iterator operator+(const vec_iterator &x, difference_type off) BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE friend vec_iterator operator+(const vec_iterator &x, difference_type off) BOOST_NOEXCEPT_OR_NOTHROW
{ return vec_iterator(x.m_ptr+off); }
- friend vec_iterator operator+(difference_type off, vec_iterator right) BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE friend vec_iterator operator+(difference_type off, vec_iterator right) BOOST_NOEXCEPT_OR_NOTHROW
{ right.m_ptr += off; return right; }
- friend vec_iterator operator-(vec_iterator left, difference_type off) BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE friend vec_iterator operator-(vec_iterator left, difference_type off) BOOST_NOEXCEPT_OR_NOTHROW
{ left.m_ptr -= off; return left; }
- friend difference_type operator-(const vec_iterator &left, const vec_iterator& right) BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE friend difference_type operator-(const vec_iterator &left, const vec_iterator& right) BOOST_NOEXCEPT_OR_NOTHROW
{ return left.m_ptr - right.m_ptr; }
//Comparison operators
- friend bool operator== (const vec_iterator& l, const vec_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE friend bool operator== (const vec_iterator& l, const vec_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW
{ return l.m_ptr == r.m_ptr; }
- friend bool operator!= (const vec_iterator& l, const vec_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE friend bool operator!= (const vec_iterator& l, const vec_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW
{ return l.m_ptr != r.m_ptr; }
- friend bool operator< (const vec_iterator& l, const vec_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE friend bool operator< (const vec_iterator& l, const vec_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW
{ return l.m_ptr < r.m_ptr; }
- friend bool operator<= (const vec_iterator& l, const vec_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE friend bool operator<= (const vec_iterator& l, const vec_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW
{ return l.m_ptr <= r.m_ptr; }
- friend bool operator> (const vec_iterator& l, const vec_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE friend bool operator> (const vec_iterator& l, const vec_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW
{ return l.m_ptr > r.m_ptr; }
- friend bool operator>= (const vec_iterator& l, const vec_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE friend bool operator>= (const vec_iterator& l, const vec_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW
{ return l.m_ptr >= r.m_ptr; }
};
template<class BiDirPosConstIt, class BiDirValueIt>
struct vector_insert_ordered_cursor
{
typedef typename iterator_traits<BiDirPosConstIt>::value_type size_type;
typedef typename iterator_traits<BiDirValueIt>::reference reference;
- vector_insert_ordered_cursor(BiDirPosConstIt posit, BiDirValueIt valueit)
+ BOOST_CONTAINER_FORCEINLINE vector_insert_ordered_cursor(BiDirPosConstIt posit, BiDirValueIt valueit)
: last_position_it(posit), last_value_it(valueit)
{}
void operator --()
{
@@ -198,14 +198,14 @@
--last_value_it;
--last_position_it;
}
}
- size_type get_pos() const
+ BOOST_CONTAINER_FORCEINLINE size_type get_pos() const
{ return *last_position_it; }
- reference get_val()
+ BOOST_CONTAINER_FORCEINLINE reference get_val()
{ return *last_value_it; }
BiDirPosConstIt last_position_it;
BiDirValueIt last_value_it;
};
@@ -214,11 +214,11 @@
struct vector_merge_cursor
{
typedef SizeType size_type;
typedef typename iterator_traits<BiDirValueIt>::reference reference;
- vector_merge_cursor(T *pbeg, T *plast, BiDirValueIt valueit, Comp &cmp)
+ BOOST_CONTAINER_FORCEINLINE vector_merge_cursor(T *pbeg, T *plast, BiDirValueIt valueit, Comp &cmp)
: m_pbeg(pbeg), m_pcur(--plast), m_valueit(valueit), m_cmp(cmp)
{}
void operator --()
{
@@ -230,14 +230,14 @@
}
--m_pcur;
}
}
- size_type get_pos() const
+ BOOST_CONTAINER_FORCEINLINE size_type get_pos() const
{ return static_cast<size_type>((m_pcur + 1) - m_pbeg); }
- reference get_val()
+ BOOST_CONTAINER_FORCEINLINE reference get_val()
{ return *m_valueit; }
T *const m_pbeg;
T *m_pcur;
BiDirValueIt m_valueit;
@@ -245,15 +245,15 @@
};
} //namespace container_detail {
template<class Pointer, bool IsConst>
-const Pointer &vector_iterator_get_ptr(const container_detail::vec_iterator<Pointer, IsConst> &it) BOOST_NOEXCEPT_OR_NOTHROW
+BOOST_CONTAINER_FORCEINLINE const Pointer &vector_iterator_get_ptr(const container_detail::vec_iterator<Pointer, IsConst> &it) BOOST_NOEXCEPT_OR_NOTHROW
{ return it.get_ptr(); }
template<class Pointer, bool IsConst>
-Pointer &get_ptr(container_detail::vec_iterator<Pointer, IsConst> &it) BOOST_NOEXCEPT_OR_NOTHROW
+BOOST_CONTAINER_FORCEINLINE Pointer &get_ptr(container_detail::vec_iterator<Pointer, IsConst> &it) BOOST_NOEXCEPT_OR_NOTHROW
{ return it.get_ptr(); }
namespace container_detail {
#else //ifndef BOOST_CONTAINER_VECTOR_ITERATOR_IS_POINTER
@@ -268,26 +268,26 @@
typedef typename pointer_traits_t::element_type element_type;
typedef typename remove_const<element_type>::type non_const_element_type;
typedef typename pointer_traits_t
::template rebind_pointer<non_const_element_type>::type return_type;
- static return_type get_ptr(const const_pointer &ptr) BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE static return_type get_ptr(const const_pointer &ptr) BOOST_NOEXCEPT_OR_NOTHROW
{ return boost::intrusive::pointer_traits<return_type>::const_cast_from(ptr); }
};
template<class Pointer>
struct vector_get_ptr_pointer_to_non_const<Pointer, false>
{
typedef const Pointer & return_type;
- static return_type get_ptr(const Pointer &ptr) BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE static return_type get_ptr(const Pointer &ptr) BOOST_NOEXCEPT_OR_NOTHROW
{ return ptr; }
};
} //namespace container_detail {
template<class MaybeConstPointer>
-typename container_detail::vector_get_ptr_pointer_to_non_const<MaybeConstPointer>::return_type
+BOOST_CONTAINER_FORCEINLINE typename container_detail::vector_get_ptr_pointer_to_non_const<MaybeConstPointer>::return_type
vector_iterator_get_ptr(const MaybeConstPointer &ptr) BOOST_NOEXCEPT_OR_NOTHROW
{
return container_detail::vector_get_ptr_pointer_to_non_const<MaybeConstPointer>::get_ptr(ptr);
}
@@ -378,11 +378,11 @@
, m_start()
, m_size(initial_size) //Size is initialized here so vector should only call uninitialized_xxx after this
, m_capacity()
{
if(initial_size){
- pointer reuse = 0;
+ pointer reuse = pointer();
m_start = this->allocation_command(allocate_new, initial_size, m_capacity = initial_size, reuse);
}
}
//Constructor, does not throw
@@ -391,11 +391,11 @@
, m_start()
, m_size(initial_size) //Size is initialized here so vector should only call uninitialized_xxx after this
, m_capacity()
{
if(initial_size){
- pointer reuse = 0;
+ pointer reuse = pointer();
m_start = this->allocation_command(allocate_new, initial_size, m_capacity = initial_size, reuse);
}
}
vector_alloc_holder(BOOST_RV_REF(vector_alloc_holder) holder) BOOST_NOEXCEPT_OR_NOTHROW
@@ -449,18 +449,18 @@
, m_start(p)
, m_size()
, m_capacity(n)
{}
- ~vector_alloc_holder() BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE ~vector_alloc_holder() BOOST_NOEXCEPT_OR_NOTHROW
{
if(this->m_capacity){
this->alloc().deallocate(this->m_start, this->m_capacity);
}
}
- pointer allocation_command(boost::container::allocation_type command,
+ BOOST_CONTAINER_FORCEINLINE pointer allocation_command(boost::container::allocation_type command,
size_type limit_size, size_type &prefer_in_recvd_out_size, pointer &reuse)
{
typedef typename container_detail::version<Allocator>::type alloc_version;
return this->priv_allocation_command(alloc_version(), command, limit_size, prefer_in_recvd_out_size, reuse);
}
@@ -480,11 +480,11 @@
this->capacity(real_cap);
}
return success;
}
- size_type next_capacity(size_type additional_objects) const
+ BOOST_CONTAINER_FORCEINLINE size_type next_capacity(size_type additional_objects) const
{
return next_capacity_calculator
<size_type, NextCapacityDouble //NextCapacity60Percent
>::get( allocator_traits_type::max_size(this->alloc())
, this->m_capacity, additional_objects );
@@ -508,14 +508,14 @@
this->m_capacity = x.m_capacity;
x.m_start = pointer();
x.m_size = x.m_capacity = 0;
}
- Allocator &alloc() BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE Allocator &alloc() BOOST_NOEXCEPT_OR_NOTHROW
{ return *this; }
- const Allocator &alloc() const BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE const Allocator &alloc() const BOOST_NOEXCEPT_OR_NOTHROW
{ return *this; }
const pointer &start() const BOOST_NOEXCEPT_OR_NOTHROW { return m_start; }
const size_type &capacity() const BOOST_NOEXCEPT_OR_NOTHROW { return m_capacity; }
void start(const pointer &p) BOOST_NOEXCEPT_OR_NOTHROW { m_start = p; }
@@ -523,20 +523,20 @@
private:
void priv_first_allocation(size_type cap)
{
if(cap){
- pointer reuse = 0;
+ pointer reuse = pointer();
m_start = this->allocation_command(allocate_new, cap, cap, reuse);
m_capacity = cap;
#ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
++this->num_alloc;
#endif
}
}
- pointer priv_allocation_command(version_1, boost::container::allocation_type command,
+ BOOST_CONTAINER_FORCEINLINE pointer priv_allocation_command(version_1, boost::container::allocation_type command,
size_type ,
size_type &prefer_in_recvd_out_size,
pointer &reuse)
{
(void)command;
@@ -622,18 +622,18 @@
this->priv_first_allocation(n);
::boost::container::uninitialized_move_alloc_n
(this->alloc(), container_detail::to_raw_pointer(holder.start()), n, container_detail::to_raw_pointer(this->start()));
}
- void priv_first_allocation(size_type cap)
+ BOOST_CONTAINER_FORCEINLINE void priv_first_allocation(size_type cap)
{
if(cap > Allocator::internal_capacity){
throw_bad_alloc();
}
}
- void deep_swap(vector_alloc_holder &x)
+ BOOST_CONTAINER_FORCEINLINE void deep_swap(vector_alloc_holder &x)
{
this->priv_deep_swap(x);
}
template<class OtherAllocator, class OtherAllocatorVersion>
@@ -643,32 +643,32 @@
throw_bad_alloc();
}
this->priv_deep_swap(x);
}
- void swap_resources(vector_alloc_holder &) BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE void swap_resources(vector_alloc_holder &) BOOST_NOEXCEPT_OR_NOTHROW
{ //Containers with version 0 allocators can't be moved without moving elements one by one
throw_bad_alloc();
}
- void steal_resources(vector_alloc_holder &)
+ BOOST_CONTAINER_FORCEINLINE void steal_resources(vector_alloc_holder &)
{ //Containers with version 0 allocators can't be moved without moving elements one by one
throw_bad_alloc();
}
- Allocator &alloc() BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE Allocator &alloc() BOOST_NOEXCEPT_OR_NOTHROW
{ return *this; }
- const Allocator &alloc() const BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE const Allocator &alloc() const BOOST_NOEXCEPT_OR_NOTHROW
{ return *this; }
- bool try_expand_fwd(size_type at_least)
+ BOOST_CONTAINER_FORCEINLINE bool try_expand_fwd(size_type at_least)
{ return !at_least; }
- pointer start() const BOOST_NOEXCEPT_OR_NOTHROW { return Allocator::internal_storage(); }
- size_type capacity() const BOOST_NOEXCEPT_OR_NOTHROW { return Allocator::internal_capacity; }
+ BOOST_CONTAINER_FORCEINLINE pointer start() const BOOST_NOEXCEPT_OR_NOTHROW { return Allocator::internal_storage(); }
+ BOOST_CONTAINER_FORCEINLINE size_type capacity() const BOOST_NOEXCEPT_OR_NOTHROW { return Allocator::internal_capacity; }
size_type m_size;
private:
template<class OtherAllocator, class OtherAllocatorVersion>
@@ -763,20 +763,20 @@
typedef container_detail::vector_value_traits<Allocator> value_traits;
typedef constant_iterator<T, difference_type> cvalue_iterator;
protected:
- void steal_resources(vector &x)
+ BOOST_CONTAINER_FORCEINLINE void steal_resources(vector &x)
{ return this->m_holder.steal_resources(x.m_holder); }
struct initial_capacity_t{};
template<class AllocFwd>
- vector(initial_capacity_t, pointer initial_memory, size_type capacity, BOOST_FWD_REF(AllocFwd) a)
+ BOOST_CONTAINER_FORCEINLINE vector(initial_capacity_t, pointer initial_memory, size_type capacity, BOOST_FWD_REF(AllocFwd) a)
: m_holder(initial_memory, capacity, ::boost::forward<AllocFwd>(a))
{}
- vector(initial_capacity_t, pointer initial_memory, size_type capacity)
+ BOOST_CONTAINER_FORCEINLINE vector(initial_capacity_t, pointer initial_memory, size_type capacity)
: m_holder(initial_memory, capacity)
{}
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
@@ -790,11 +790,11 @@
//! <b>Effects</b>: Constructs a vector taking the allocator as parameter.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- vector() BOOST_NOEXCEPT_OR_NOTHROW
+ vector() BOOST_NOEXCEPT_IF(container_detail::is_nothrow_default_constructible<Allocator>::value)
: m_holder()
{}
//! <b>Effects</b>: Constructs a vector taking the allocator as parameter.
//!
@@ -820,42 +820,42 @@
boost::container::uninitialized_value_init_alloc_n
(this->m_holder.alloc(), n, this->priv_raw_begin());
}
//! <b>Effects</b>: Constructs a vector that will use a copy of allocator a
- //! and inserts n default initialized values.
+ //! and inserts n value initialized values.
//!
//! <b>Throws</b>: If allocator_type's allocation
- //! throws or T's default initialization throws.
+ //! throws or T's value initialization throws.
//!
//! <b>Complexity</b>: Linear to n.
- //!
- //! <b>Note</b>: Non-standard extension
- vector(size_type n, default_init_t)
- : m_holder(container_detail::uninitialized_size, n)
+ explicit vector(size_type n, const allocator_type &a)
+ : m_holder(container_detail::uninitialized_size, a, n)
{
#ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
this->num_alloc += n != 0;
#endif
- boost::container::uninitialized_default_init_alloc_n
+ boost::container::uninitialized_value_init_alloc_n
(this->m_holder.alloc(), n, this->priv_raw_begin());
}
//! <b>Effects</b>: Constructs a vector that will use a copy of allocator a
- //! and inserts n value initialized values.
+ //! and inserts n default initialized values.
//!
//! <b>Throws</b>: If allocator_type's allocation
- //! throws or T's value initialization throws.
+ //! throws or T's default initialization throws.
//!
//! <b>Complexity</b>: Linear to n.
- explicit vector(size_type n, const allocator_type &a)
- : m_holder(container_detail::uninitialized_size, a, n)
+ //!
+ //! <b>Note</b>: Non-standard extension
+ vector(size_type n, default_init_t)
+ : m_holder(container_detail::uninitialized_size, n)
{
#ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
this->num_alloc += n != 0;
#endif
- boost::container::uninitialized_value_init_alloc_n
+ boost::container::uninitialized_default_init_alloc_n
(this->m_holder.alloc(), n, this->priv_raw_begin());
}
//! <b>Effects</b>: Constructs a vector that will use a copy of allocator a
//! and inserts n default initialized values.
@@ -916,11 +916,15 @@
//! <b>Throws</b>: If allocator_type's allocation
//! throws or T's constructor taking a dereferenced InIt throws.
//!
//! <b>Complexity</b>: Linear to the range [first, last).
template <class InIt>
- vector(InIt first, InIt last)
+ vector(InIt first, InIt last
+ BOOST_CONTAINER_DOCIGN(BOOST_MOVE_I typename container_detail::disable_if_c
+ < container_detail::is_convertible<InIt BOOST_MOVE_I size_type>::value
+ BOOST_MOVE_I container_detail::nat >::type * = 0)
+ )
: m_holder()
{ this->assign(first, last); }
//! <b>Effects</b>: Constructs a vector that will use a copy of allocator a
//! and inserts a copy of the range [first, last) in the vector.
@@ -928,11 +932,15 @@
//! <b>Throws</b>: If allocator_type's allocation
//! throws or T's constructor taking a dereferenced InIt throws.
//!
//! <b>Complexity</b>: Linear to the range [first, last).
template <class InIt>
- vector(InIt first, InIt last, const allocator_type& a)
+ vector(InIt first, InIt last, const allocator_type& a
+ BOOST_CONTAINER_DOCIGN(BOOST_MOVE_I typename container_detail::disable_if_c
+ < container_detail::is_convertible<InIt BOOST_MOVE_I size_type>::value
+ BOOST_MOVE_I container_detail::nat >::type * = 0)
+ )
: m_holder(a)
{ this->assign(first, last); }
//! <b>Effects</b>: Copy constructs a vector.
//!
@@ -1061,11 +1069,11 @@
//! of each of x's elements.
//!
//! <b>Throws</b>: If memory allocation throws or T's copy/move constructor/assignment throws.
//!
//! <b>Complexity</b>: Linear to the number of elements in x.
- vector& operator=(BOOST_COPY_ASSIGN_REF(vector) x)
+ BOOST_CONTAINER_FORCEINLINE vector& operator=(BOOST_COPY_ASSIGN_REF(vector) x)
{
if (&x != this){
this->priv_copy_assign(x);
}
return *this;
@@ -1073,11 +1081,11 @@
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
//! <b>Effects</b>: Make *this container contains elements from il.
//!
//! <b>Complexity</b>: Linear to the range [il.begin(), il.end()).
- vector& operator=(std::initializer_list<value_type> il)
+ BOOST_CONTAINER_FORCEINLINE vector& operator=(std::initializer_list<value_type> il)
{
this->assign(il.begin(), il.end());
return *this;
}
#endif
@@ -1091,13 +1099,13 @@
//! is false and (allocation throws or value_type's move constructor throws)
//!
//! <b>Complexity</b>: Constant if allocator_traits_type::
//! propagate_on_container_move_assignment is true or
//! this->get>allocator() == x.get_allocator(). Linear otherwise.
- vector& operator=(BOOST_RV_REF(vector) x)
+ BOOST_CONTAINER_FORCEINLINE vector& operator=(BOOST_RV_REF(vector) x)
BOOST_NOEXCEPT_IF(allocator_traits_type::propagate_on_container_move_assignment::value
- || allocator_traits_type::is_always_equal::value)
+ || allocator_traits_type::is_always_equal::value)
{
BOOST_ASSERT(&x != this);
this->priv_move_assign(boost::move(x));
return *this;
}
@@ -1113,11 +1121,11 @@
//!
//! <b>Complexity</b>: Linear.
//!
//! <b>Note</b>: Non-standard extension to support static_vector
template<class OtherAllocator>
- typename container_detail::enable_if_and
+ BOOST_CONTAINER_FORCEINLINE typename container_detail::enable_if_and
< vector&
, container_detail::is_version<OtherAllocator, 0>
, container_detail::is_different<OtherAllocator, allocator_type>
>::type
operator=(BOOST_RV_REF_BEG vector<value_type, OtherAllocator> BOOST_RV_REF_END x)
@@ -1135,11 +1143,11 @@
//!
//! <b>Complexity</b>: Linear.
//!
//! <b>Note</b>: Non-standard extension to support static_vector
template<class OtherAllocator>
- typename container_detail::enable_if_and
+ BOOST_CONTAINER_FORCEINLINE typename container_detail::enable_if_and
< vector&
, container_detail::is_version<OtherAllocator, 0>
, container_detail::is_different<OtherAllocator, allocator_type>
>::type
operator=(const vector<value_type, OtherAllocator> &x)
@@ -1191,11 +1199,11 @@
//! <b>Effects</b>: Assigns the the range [il.begin(), il.end()) to *this.
//!
//! <b>Throws</b>: If memory allocation throws or
//! T's constructor from dereferencing iniializer_list iterator throws.
//!
- void assign(std::initializer_list<T> il)
+ BOOST_CONTAINER_FORCEINLINE void assign(std::initializer_list<T> il)
{
this->assign(il.begin(), il.end());
}
#endif
@@ -1267,11 +1275,11 @@
//!
//! <b>Throws</b>: If memory allocation throws or
//! T's copy/move constructor/assignment throws.
//!
//! <b>Complexity</b>: Linear to n.
- void assign(size_type n, const value_type& val)
+ BOOST_CONTAINER_FORCEINLINE void assign(size_type n, const value_type& val)
{ this->assign(cvalue_iterator(val, n), cvalue_iterator()); }
//! <b>Effects</b>: Returns a copy of the internal allocator.
//!
//! <b>Throws</b>: If allocator's copy constructor throws.
@@ -1285,21 +1293,21 @@
//! <b>Throws</b>: Nothing
//!
//! <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->m_holder.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_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE const stored_allocator_type &get_stored_allocator() const BOOST_NOEXCEPT_OR_NOTHROW
{ return this->m_holder.alloc(); }
//////////////////////////////////////////////
//
// iterators
@@ -1309,105 +1317,105 @@
//! <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_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE iterator begin() BOOST_NOEXCEPT_OR_NOTHROW
{ return iterator(this->m_holder.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_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE const_iterator begin() const BOOST_NOEXCEPT_OR_NOTHROW
{ return const_iterator(this->m_holder.start()); }
//! <b>Effects</b>: Returns an iterator to the end of the 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->m_holder.start() + this->m_holder.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_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE const_iterator end() const BOOST_NOEXCEPT_OR_NOTHROW
{ return this->cend(); }
//! <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_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
//! of the reversed 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 this->crbegin(); }
//! <b>Effects</b>: Returns a reverse_iterator pointing to the end
//! of the reversed 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
//! of the reversed 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 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_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE const_iterator cbegin() const BOOST_NOEXCEPT_OR_NOTHROW
{ return const_iterator(this->m_holder.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_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE const_iterator cend() const BOOST_NOEXCEPT_OR_NOTHROW
{ return const_iterator(this->m_holder.start() + this->m_holder.m_size); }
//! <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_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE const_reverse_iterator crbegin() const BOOST_NOEXCEPT_OR_NOTHROW
{ return const_reverse_iterator(this->end());}
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
//! of the reversed 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 const_reverse_iterator(this->begin()); }
//////////////////////////////////////////////
//
// capacity
@@ -1417,27 +1425,27 @@
//! <b>Effects</b>: Returns true if the vector contains no elements.
//!
//! <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->m_holder.m_size; }
//! <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_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE size_type size() const BOOST_NOEXCEPT_OR_NOTHROW
{ return this->m_holder.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_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE size_type max_size() const BOOST_NOEXCEPT_OR_NOTHROW
{ return allocator_traits_type::max_size(this->m_holder.alloc()); }
//! <b>Effects</b>: Inserts or erases elements at the end such that
//! the size becomes n. New elements are value initialized.
//!
@@ -1471,20 +1479,20 @@
//! capacity() is always greater than or equal to size().
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- size_type capacity() const BOOST_NOEXCEPT_OR_NOTHROW
+ BOOST_CONTAINER_FORCEINLINE size_type capacity() const BOOST_NOEXCEPT_OR_NOTHROW
{ return this->m_holder.capacity(); }
//! <b>Effects</b>: If n is less than or equal to capacity(), this call has no
//! 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)
+ BOOST_CONTAINER_FORCEINLINE void reserve(size_type new_cap)
{
if (this->capacity() < new_cap){
this->priv_reserve_no_capacity(new_cap, alloc_version());
}
}
@@ -1493,11 +1501,11 @@
//! with previous allocations. The size of the vector is unchanged
//!
//! <b>Throws</b>: If memory allocation throws, or T's copy/move constructor throws.
//!
//! <b>Complexity</b>: Linear to size().
- void shrink_to_fit()
+ BOOST_CONTAINER_FORCEINLINE void shrink_to_fit()
{ this->priv_shrink_to_fit(alloc_version()); }
//////////////////////////////////////////////
//
// element access
@@ -1620,15 +1628,14 @@
{
BOOST_ASSERT(this->m_holder.m_size >= n);
return const_iterator(this->m_holder.start()+n);
}
- //! <b>Requires</b>: size() >= n.
+ //! <b>Requires</b>: begin() <= p <= end().
//!
- //! <b>Effects</b>: Returns an iterator to the nth element
- //! from the beginning of the container. Returns end()
- //! if n == size().
+ //! <b>Effects</b>: Returns the index of the element pointed by p
+ //! and size() if p == end().
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
//!
@@ -1715,25 +1722,29 @@
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
//! <b>Effects</b>: Inserts an object of type T constructed with
//! std::forward<Args>(args)... in the end of the vector.
//!
+ //! <b>Returns</b>: A reference to the created object.
+ //!
//! <b>Throws</b>: If memory allocation throws or the in-place constructor throws or
//! T's copy/move constructor throws.
//!
//! <b>Complexity</b>: Amortized constant time.
template<class ...Args>
- void emplace_back(BOOST_FWD_REF(Args)...args)
+ BOOST_CONTAINER_FORCEINLINE reference emplace_back(BOOST_FWD_REF(Args)...args)
{
if (BOOST_LIKELY(this->room_enough())){
//There is more memory, just construct a new object at the end
- allocator_traits_type::construct(this->m_holder.alloc(), this->priv_raw_end(), ::boost::forward<Args>(args)...);
+ T* const p = this->priv_raw_end();
+ allocator_traits_type::construct(this->m_holder.alloc(), p, ::boost::forward<Args>(args)...);
++this->m_holder.m_size;
+ return *p;
}
else{
typedef container_detail::insert_emplace_proxy<Allocator, T*, Args...> type;
- this->priv_forward_range_insert_no_capacity
+ return *this->priv_forward_range_insert_no_capacity
(this->back_ptr(), 1, type(::boost::forward<Args>(args)...), alloc_version());
}
}
//! <b>Effects</b>: Inserts an object of type T constructed with
@@ -1743,11 +1754,11 @@
//!
//! <b>Complexity</b>: Constant time.
//!
//! <b>Note</b>: Non-standard extension.
template<class ...Args>
- bool stable_emplace_back(BOOST_FWD_REF(Args)...args)
+ BOOST_CONTAINER_FORCEINLINE bool stable_emplace_back(BOOST_FWD_REF(Args)...args)
{
const bool is_room_enough = this->room_enough() || (alloc_version::value == 2 && this->m_holder.try_expand_fwd(1u));
if (BOOST_LIKELY(is_room_enough)){
//There is more memory, just construct a new object at the end
allocator_traits_type::construct(this->m_holder.alloc(), this->priv_raw_end(), ::boost::forward<Args>(args)...);
@@ -1778,26 +1789,28 @@
#else // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
#define BOOST_CONTAINER_VECTOR_EMPLACE_CODE(N) \
BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \
- void emplace_back(BOOST_MOVE_UREF##N)\
+ BOOST_CONTAINER_FORCEINLINE reference emplace_back(BOOST_MOVE_UREF##N)\
{\
if (BOOST_LIKELY(this->room_enough())){\
+ T* const p = this->priv_raw_end();\
allocator_traits_type::construct (this->m_holder.alloc()\
, this->priv_raw_end() BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\
++this->m_holder.m_size;\
+ return *p;\
}\
else{\
typedef container_detail::insert_emplace_proxy_arg##N<Allocator, T* BOOST_MOVE_I##N BOOST_MOVE_TARG##N> type;\
- this->priv_forward_range_insert_no_capacity\
+ return *this->priv_forward_range_insert_no_capacity\
( this->back_ptr(), 1, type(BOOST_MOVE_FWD##N), alloc_version());\
}\
}\
\
BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \
- bool stable_emplace_back(BOOST_MOVE_UREF##N)\
+ BOOST_CONTAINER_FORCEINLINE bool stable_emplace_back(BOOST_MOVE_UREF##N)\
{\
const bool is_room_enough = this->room_enough() || (alloc_version::value == 2 && this->m_holder.try_expand_fwd(1u));\
if (BOOST_LIKELY(is_room_enough)){\
allocator_traits_type::construct (this->m_holder.alloc()\
, this->priv_raw_end() BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\
@@ -2237,16 +2250,16 @@
static const std::size_t PosCount = 64u;
size_type positions[PosCount];
size_type *indexes = 0;
while(remaining){
//Query for room to store indexes in the remaining buffer
- uintptr_t const szt_align_mask = container_detail::alignment_of<size_type>::value - 1;
+ boost::uintptr_t const szt_align_mask = container_detail::alignment_of<size_type>::value - 1;
boost::uintptr_t const addr = boost::uintptr_t(this->priv_raw_begin() + s + n);
boost::uintptr_t const capaddr = boost::uintptr_t(this->priv_raw_begin() + c);
boost::uintptr_t const aligned_addr = (addr + szt_align_mask) & ~szt_align_mask;
indexes = reinterpret_cast<size_type *>(aligned_addr);
- std::size_t index_capacity = (aligned_addr >= capaddr) ? 0u : (capaddr - addr)/sizeof(size_type);
+ std::size_t index_capacity = (aligned_addr >= capaddr) ? 0u : (capaddr - aligned_addr)/sizeof(size_type);
//Capacity is constant, we're not going to change it
if(index_capacity < PosCount){
indexes = positions;
index_capacity = PosCount;
@@ -2534,11 +2547,11 @@
{
//There is not enough memory, allocate a new
//buffer or expand the old one.
bool same_buffer_start;
size_type real_cap = 0;
- pointer reuse = 0;
+ pointer reuse(this->m_holder.start());
pointer const ret(this->m_holder.allocation_command(allocate_new | expand_fwd | expand_bwd, new_cap, real_cap = new_cap, reuse));
//Check for forward expansion
same_buffer_start = reuse && this->m_holder.start() == ret;
if(same_buffer_start){
@@ -3096,19 +3109,22 @@
//Now we have a contiguous buffer so program trailing element destruction
//and update size to the final size.
old_values_destroyer.shrink_forward(new_size-s_before);
this->m_holder.m_size = new_size;
//Now move remaining last objects in the old buffer begin
- ::boost::container::move(pos + raw_gap, old_finish, old_start);
+ T * const remaining_pos = pos + raw_gap;
+ if(remaining_pos != old_start){ //Make sure data has to be moved
+ ::boost::container::move(remaining_pos, old_finish, old_start);
+ }
//Once moved, avoid calling the destructors if trivial after move
if(value_traits::trivial_dctr_after_move){
old_values_destroyer.release();
}
}
else{ //If trivial destructor, we can uninitialized copy + copy in a single uninitialized copy
::boost::container::uninitialized_move_alloc_n
- (this->m_holder.alloc(), pos, old_finish - pos, new_start + before_plus_new);
+ (this->m_holder.alloc(), pos, static_cast<size_type>(old_finish - pos), new_start + before_plus_new);
this->m_holder.m_size = new_size;
old_values_destroyer.release();
}
}
}
@@ -3236,11 +3252,12 @@
else{
//Copy all new elements
const size_type rest_new = n - mid_n;
insert_range_proxy.copy_n_and_update(this->m_holder.alloc(), old_start, rest_new);
T* const move_start = old_start + rest_new;
- //Displace old_end
- T* const move_end = ::boost::container::move(pos, old_finish, move_start);
+ //Displace old_end, but make sure data has to be moved
+ T* const move_end = move_start != pos ? ::boost::container::move(pos, old_finish, move_start)
+ : old_finish;
//Destroy remaining moved elements from old_end except if they
//have trivial destructor after being moved
size_type n_destroy = s_before - n;
if(!value_traits::trivial_dctr_after_move)
boost::container::destroy_alloc_n(this->get_stored_allocator(), move_end, n_destroy);