| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | //////////////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | //
 | 
					
						
							| 
									
										
										
										
											2014-09-26 08:12:40 +02:00
										 |  |  | // (C) Copyright Ion Gaztanaga 2005-2014. Distributed under the Boost
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | // Software License, Version 1.0. (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.
 | 
					
						
							|  |  |  | //
 | 
					
						
							|  |  |  | //////////////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-22 20:08:24 +00:00
										 |  |  | #ifndef BOOST_CONTAINER_CONTAINER_VECTOR_HPP
 | 
					
						
							|  |  |  | #define BOOST_CONTAINER_CONTAINER_VECTOR_HPP
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-09-26 13:02:51 +00:00
										 |  |  | #if defined(_MSC_VER)
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | #  pragma once
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <boost/container/detail/config_begin.hpp>
 | 
					
						
							|  |  |  | #include <boost/container/detail/workaround.hpp>
 | 
					
						
							|  |  |  | #include <boost/container/container_fwd.hpp>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-09-17 21:52:34 +02:00
										 |  |  | #include <boost/core/no_exceptions_support.hpp>
 | 
					
						
							| 
									
										
										
										
											2014-09-26 08:12:40 +02:00
										 |  |  | #include <boost/assert.hpp>
 | 
					
						
							|  |  |  | #include <boost/move/utility_core.hpp>
 | 
					
						
							|  |  |  | #include <boost/move/iterator.hpp>
 | 
					
						
							|  |  |  | #include <boost/move/algorithm.hpp>
 | 
					
						
							|  |  |  | #include <boost/move/detail/move_helpers.hpp>
 | 
					
						
							|  |  |  | #include <boost/move/traits.hpp>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | #include <boost/container/detail/version_type.hpp>
 | 
					
						
							|  |  |  | #include <boost/container/detail/allocation_type.hpp>
 | 
					
						
							|  |  |  | #include <boost/container/detail/utilities.hpp>
 | 
					
						
							|  |  |  | #include <boost/container/detail/iterators.hpp>
 | 
					
						
							|  |  |  | #include <boost/container/detail/destroyers.hpp>
 | 
					
						
							| 
									
										
										
										
											2012-03-22 18:46:55 +00:00
										 |  |  | #include <boost/container/allocator_traits.hpp>
 | 
					
						
							| 
									
										
										
										
											2012-11-24 21:08:18 +00:00
										 |  |  | #include <boost/container/detail/allocator_version_traits.hpp>
 | 
					
						
							| 
									
										
										
										
											2013-01-10 10:55:50 +00:00
										 |  |  | #include <boost/container/throw_exception.hpp>
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | #include <boost/container/detail/mpl.hpp>
 | 
					
						
							| 
									
										
										
										
											2011-12-22 20:08:24 +00:00
										 |  |  | #include <boost/container/detail/type_traits.hpp>
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | #include <boost/container/detail/advanced_insert_int.hpp>
 | 
					
						
							| 
									
										
										
										
											2014-11-26 07:08:06 +01:00
										 |  |  | #include <boost/container/detail/algorithm.hpp> //equal()
 | 
					
						
							|  |  |  | #include <boost/container/detail/iterator.hpp>
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-09-26 08:12:40 +02:00
										 |  |  | #include <boost/intrusive/pointer_traits.hpp>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <boost/type_traits/has_trivial_destructor.hpp>
 | 
					
						
							|  |  |  | #include <boost/type_traits/has_trivial_copy.hpp>
 | 
					
						
							|  |  |  | #include <boost/type_traits/has_trivial_assign.hpp>
 | 
					
						
							|  |  |  | #include <boost/type_traits/has_nothrow_copy.hpp>
 | 
					
						
							|  |  |  | #include <boost/type_traits/has_nothrow_assign.hpp>
 | 
					
						
							|  |  |  | #include <boost/type_traits/has_nothrow_constructor.hpp>
 | 
					
						
							| 
									
										
										
										
											2014-08-15 20:15:01 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-11-26 07:08:06 +01:00
										 |  |  | #include <memory>    //for std::allocator
 | 
					
						
							|  |  |  | #include <utility>   //for std::pair
 | 
					
						
							|  |  |  | #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
 | 
					
						
							|  |  |  | #include <initializer_list>   //for std::initializer_list
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | namespace boost { | 
					
						
							|  |  |  | namespace container { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  | #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-02-24 20:34:15 +00:00
										 |  |  | //#define BOOST_CONTAINER_VECTOR_ITERATOR_IS_POINTER
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-22 20:08:24 +00:00
										 |  |  | namespace container_detail { | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-02-24 20:34:15 +00:00
										 |  |  | #ifndef BOOST_CONTAINER_VECTOR_ITERATOR_IS_POINTER
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-08-11 21:36:19 +00:00
										 |  |  | template <class Pointer, bool IsConst> | 
					
						
							|  |  |  | class vec_iterator | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | { | 
					
						
							|  |  |  |    public: | 
					
						
							| 
									
										
										
										
											2014-04-21 13:59:49 +02:00
										 |  |  |    typedef std::random_access_iterator_tag                                          iterator_category; | 
					
						
							| 
									
										
										
										
											2011-12-22 20:08:24 +00:00
										 |  |  |    typedef typename boost::intrusive::pointer_traits<Pointer>::element_type         value_type; | 
					
						
							|  |  |  |    typedef typename boost::intrusive::pointer_traits<Pointer>::difference_type      difference_type; | 
					
						
							| 
									
										
										
										
											2013-08-11 21:36:19 +00:00
										 |  |  |    typedef typename if_c | 
					
						
							|  |  |  |       < IsConst | 
					
						
							|  |  |  |       , typename boost::intrusive::pointer_traits<Pointer>::template | 
					
						
							|  |  |  |                                  rebind_pointer<const value_type>::type | 
					
						
							|  |  |  |       , Pointer | 
					
						
							|  |  |  |       >::type                                                                       pointer; | 
					
						
							| 
									
										
										
										
											2014-06-16 00:23:19 +02:00
										 |  |  |    typedef typename boost::intrusive::pointer_traits<Pointer>                       ptr_traits; | 
					
						
							|  |  |  |    typedef typename ptr_traits::reference                                           reference; | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |    #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
 | 
					
						
							| 
									
										
										
										
											2013-08-11 21:36:19 +00:00
										 |  |  |    private: | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    Pointer m_ptr; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    public: | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |    const Pointer &get_ptr() const BOOST_CONTAINER_NOEXCEPT | 
					
						
							|  |  |  |    {  return   m_ptr;  } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    Pointer &get_ptr() BOOST_CONTAINER_NOEXCEPT | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |    {  return   m_ptr;  } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-08-11 21:36:19 +00:00
										 |  |  |    explicit vec_iterator(Pointer ptr) BOOST_CONTAINER_NOEXCEPT | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |       : m_ptr(ptr) | 
					
						
							|  |  |  |    {} | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |    #endif   //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |    public: | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    //Constructors
 | 
					
						
							| 
									
										
										
										
											2013-08-11 21:36:19 +00:00
										 |  |  |    vec_iterator() BOOST_CONTAINER_NOEXCEPT | 
					
						
							| 
									
										
										
										
											2014-09-24 16:09:56 +02:00
										 |  |  |       : m_ptr()   //Value initialization to achieve "null iterators" (N3644)
 | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |    {} | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-08-11 21:36:19 +00:00
										 |  |  |    vec_iterator(vec_iterator<Pointer, false> const& other) BOOST_CONTAINER_NOEXCEPT | 
					
						
							|  |  |  |       :  m_ptr(other.get_ptr()) | 
					
						
							|  |  |  |    {} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //Pointer like operators
 | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |    reference operator*()   const BOOST_CONTAINER_NOEXCEPT | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    {  return *m_ptr;  } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-08-11 21:36:19 +00:00
										 |  |  |    pointer operator->()  const BOOST_CONTAINER_NOEXCEPT | 
					
						
							|  |  |  |    {  return ::boost::intrusive::pointer_traits<pointer>::pointer_to(this->operator*());  } | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |    reference operator[](difference_type off) const BOOST_CONTAINER_NOEXCEPT | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    {  return m_ptr[off];   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    //Increment / Decrement
 | 
					
						
							| 
									
										
										
										
											2013-08-11 21:36:19 +00:00
										 |  |  |    vec_iterator& operator++() BOOST_CONTAINER_NOEXCEPT | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    { ++m_ptr;  return *this; } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-08-11 21:36:19 +00:00
										 |  |  |    vec_iterator operator++(int) BOOST_CONTAINER_NOEXCEPT | 
					
						
							|  |  |  |    {  return vec_iterator(m_ptr++); } | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-08-11 21:36:19 +00:00
										 |  |  |    vec_iterator& operator--() BOOST_CONTAINER_NOEXCEPT | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    {  --m_ptr; return *this;  } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-08-11 21:36:19 +00:00
										 |  |  |    vec_iterator operator--(int) BOOST_CONTAINER_NOEXCEPT | 
					
						
							|  |  |  |    {  return vec_iterator(m_ptr--); } | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |    //Arithmetic
 | 
					
						
							| 
									
										
										
										
											2013-08-11 21:36:19 +00:00
										 |  |  |    vec_iterator& operator+=(difference_type off) BOOST_CONTAINER_NOEXCEPT | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    {  m_ptr += off; return *this;   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-08-11 21:36:19 +00:00
										 |  |  |    vec_iterator& operator-=(difference_type off) BOOST_CONTAINER_NOEXCEPT | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |    {  m_ptr -= off; return *this;   } | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-08-11 21:36:19 +00:00
										 |  |  |    friend vec_iterator operator+(const vec_iterator &x, difference_type off) BOOST_CONTAINER_NOEXCEPT | 
					
						
							|  |  |  |    {  return vec_iterator(x.m_ptr+off);  } | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-08-11 21:36:19 +00:00
										 |  |  |    friend vec_iterator operator+(difference_type off, vec_iterator right) BOOST_CONTAINER_NOEXCEPT | 
					
						
							| 
									
										
										
										
											2013-02-24 13:13:36 +00:00
										 |  |  |    {  right.m_ptr += off;  return right; } | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-08-11 21:36:19 +00:00
										 |  |  |    friend vec_iterator operator-(vec_iterator left, difference_type off) BOOST_CONTAINER_NOEXCEPT | 
					
						
							| 
									
										
										
										
											2013-04-18 20:04:04 +00:00
										 |  |  |    {  left.m_ptr -= off;  return left; } | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-08-11 21:36:19 +00:00
										 |  |  |    friend difference_type operator-(const vec_iterator &left, const vec_iterator& right) BOOST_CONTAINER_NOEXCEPT | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |    {  return left.m_ptr - right.m_ptr;   } | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |    //Comparison operators
 | 
					
						
							| 
									
										
										
										
											2013-08-11 21:36:19 +00:00
										 |  |  |    friend bool operator==   (const vec_iterator& l, const vec_iterator& r) BOOST_CONTAINER_NOEXCEPT | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |    {  return l.m_ptr == r.m_ptr;  } | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-08-11 21:36:19 +00:00
										 |  |  |    friend bool operator!=   (const vec_iterator& l, const vec_iterator& r) BOOST_CONTAINER_NOEXCEPT | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |    {  return l.m_ptr != r.m_ptr;  } | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-08-11 21:36:19 +00:00
										 |  |  |    friend bool operator<    (const vec_iterator& l, const vec_iterator& r) BOOST_CONTAINER_NOEXCEPT | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |    {  return l.m_ptr < r.m_ptr;  } | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-08-11 21:36:19 +00:00
										 |  |  |    friend bool operator<=   (const vec_iterator& l, const vec_iterator& r) BOOST_CONTAINER_NOEXCEPT | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |    {  return l.m_ptr <= r.m_ptr;  } | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-08-11 21:36:19 +00:00
										 |  |  |    friend bool operator>    (const vec_iterator& l, const vec_iterator& r) BOOST_CONTAINER_NOEXCEPT | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |    {  return l.m_ptr > r.m_ptr;  } | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-08-11 21:36:19 +00:00
										 |  |  |    friend bool operator>=   (const vec_iterator& l, const vec_iterator& r) BOOST_CONTAINER_NOEXCEPT | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |    {  return l.m_ptr >= r.m_ptr;  } | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-02-24 20:34:15 +00:00
										 |  |  | }  //namespace container_detail {
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-08-11 21:36:19 +00:00
										 |  |  | template<class Pointer, bool IsConst> | 
					
						
							|  |  |  | const Pointer &vector_iterator_get_ptr(const container_detail::vec_iterator<Pointer, IsConst> &it) BOOST_CONTAINER_NOEXCEPT | 
					
						
							| 
									
										
										
										
											2013-02-24 20:34:15 +00:00
										 |  |  | {  return   it.get_ptr();  } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-08-11 21:36:19 +00:00
										 |  |  | template<class Pointer, bool IsConst> | 
					
						
							|  |  |  | Pointer &get_ptr(container_detail::vec_iterator<Pointer, IsConst> &it) BOOST_CONTAINER_NOEXCEPT | 
					
						
							| 
									
										
										
										
											2013-02-24 20:34:15 +00:00
										 |  |  | {  return  it.get_ptr();  } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace container_detail { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #else //ifndef BOOST_CONTAINER_VECTOR_ITERATOR_IS_POINTER
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | template< class MaybeConstPointer | 
					
						
							|  |  |  |         , bool ElementTypeIsConst | 
					
						
							|  |  |  |             = is_const< typename boost::intrusive::pointer_traits<MaybeConstPointer>::element_type>::value > | 
					
						
							|  |  |  | struct vector_get_ptr_pointer_to_non_const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |    typedef MaybeConstPointer                                         const_pointer; | 
					
						
							|  |  |  |    typedef boost::intrusive::pointer_traits<const_pointer>           pointer_traits_t; | 
					
						
							|  |  |  |    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; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-08-11 21:36:19 +00:00
										 |  |  |    static return_type get_ptr(const const_pointer &ptr) BOOST_CONTAINER_NOEXCEPT | 
					
						
							| 
									
										
										
										
											2013-02-24 20:34:15 +00:00
										 |  |  |    {  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; | 
					
						
							| 
									
										
										
										
											2013-08-11 21:36:19 +00:00
										 |  |  |    static return_type get_ptr(const Pointer &ptr) BOOST_CONTAINER_NOEXCEPT | 
					
						
							| 
									
										
										
										
											2013-02-24 20:34:15 +00:00
										 |  |  |    {  return ptr;  } | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | }  //namespace container_detail {
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | template<class MaybeConstPointer> | 
					
						
							|  |  |  | typename container_detail::vector_get_ptr_pointer_to_non_const<MaybeConstPointer>::return_type | 
					
						
							|  |  |  |    vector_iterator_get_ptr(const MaybeConstPointer &ptr) BOOST_CONTAINER_NOEXCEPT | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |    return container_detail::vector_get_ptr_pointer_to_non_const<MaybeConstPointer>::get_ptr(ptr); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace container_detail { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif   //#ifndef BOOST_CONTAINER_VECTOR_ITERATOR_IS_POINTER
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-09-29 11:37:30 +00:00
										 |  |  | struct uninitialized_size_t {}; | 
					
						
							|  |  |  | static const uninitialized_size_t uninitialized_size = uninitialized_size_t(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-09-26 08:12:40 +02:00
										 |  |  | template <class T> | 
					
						
							|  |  |  | struct vector_value_traits_base | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2014-09-26 08:12:40 +02:00
										 |  |  |    static const bool trivial_dctr = boost::has_trivial_destructor<T>::value; | 
					
						
							|  |  |  |    static const bool trivial_dctr_after_move = ::boost::has_trivial_destructor_after_move<T>::value; | 
					
						
							|  |  |  |    static const bool trivial_copy = has_trivial_copy<T>::value; | 
					
						
							|  |  |  |    static const bool nothrow_copy = has_nothrow_copy<T>::value || trivial_copy; | 
					
						
							|  |  |  |    static const bool trivial_assign = has_trivial_assign<T>::value; | 
					
						
							|  |  |  |    static const bool nothrow_assign = has_nothrow_assign<T>::value || trivial_assign; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-09-26 08:12:40 +02:00
										 |  |  | template <class Allocator> | 
					
						
							|  |  |  | struct vector_value_traits | 
					
						
							|  |  |  |    : public vector_value_traits_base<typename Allocator::value_type> | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |    typedef vector_value_traits_base<typename Allocator::value_type> base_t; | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //This is the anti-exception array destructor
 | 
					
						
							|  |  |  |    //to deallocate values already constructed
 | 
					
						
							| 
									
										
										
										
											2011-12-22 20:08:24 +00:00
										 |  |  |    typedef typename container_detail::if_c | 
					
						
							| 
									
										
										
										
											2014-09-26 08:12:40 +02:00
										 |  |  |       <base_t::trivial_dctr | 
					
						
							| 
									
										
										
										
											2012-09-30 20:38:04 +00:00
										 |  |  |       ,container_detail::null_scoped_destructor_n<Allocator> | 
					
						
							|  |  |  |       ,container_detail::scoped_destructor_n<Allocator> | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |       >::type   ArrayDestructor; | 
					
						
							|  |  |  |    //This is the anti-exception array deallocator
 | 
					
						
							| 
									
										
										
										
											2014-09-26 08:12:40 +02:00
										 |  |  |    typedef container_detail::scoped_array_deallocator<Allocator> ArrayDeallocator; | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | //!This struct deallocates and allocated memory
 | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  | template < class Allocator | 
					
						
							| 
									
										
										
										
											2014-04-21 13:59:49 +02:00
										 |  |  |          , class AllocatorVersion = typename container_detail::version<Allocator>::type | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |          > | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  | struct vector_alloc_holder | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |    : public Allocator | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |    private: | 
					
						
							|  |  |  |    BOOST_MOVABLE_BUT_NOT_COPYABLE(vector_alloc_holder) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    public: | 
					
						
							| 
									
										
										
										
											2012-09-30 20:38:04 +00:00
										 |  |  |    typedef boost::container::allocator_traits<Allocator> allocator_traits_type; | 
					
						
							| 
									
										
										
										
											2011-12-22 20:08:24 +00:00
										 |  |  |    typedef typename allocator_traits_type::pointer       pointer; | 
					
						
							|  |  |  |    typedef typename allocator_traits_type::size_type     size_type; | 
					
						
							|  |  |  |    typedef typename allocator_traits_type::value_type    value_type; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    //Constructor, does not throw
 | 
					
						
							|  |  |  |    vector_alloc_holder() | 
					
						
							| 
									
										
										
										
											2012-09-30 20:38:04 +00:00
										 |  |  |       BOOST_CONTAINER_NOEXCEPT_IF(::boost::has_nothrow_default_constructor<Allocator>::value) | 
					
						
							| 
									
										
										
										
											2013-02-24 13:13:36 +00:00
										 |  |  |       : Allocator(), m_start(), m_size(), m_capacity() | 
					
						
							| 
									
										
										
										
											2011-12-22 20:08:24 +00:00
										 |  |  |    {} | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |    //Constructor, does not throw
 | 
					
						
							| 
									
										
										
										
											2011-12-22 20:08:24 +00:00
										 |  |  |    template<class AllocConvertible> | 
					
						
							|  |  |  |    explicit vector_alloc_holder(BOOST_FWD_REF(AllocConvertible) a) BOOST_CONTAINER_NOEXCEPT | 
					
						
							| 
									
										
										
										
											2013-02-24 13:13:36 +00:00
										 |  |  |       : Allocator(boost::forward<AllocConvertible>(a)), m_start(), m_size(), m_capacity() | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    {} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |    //Constructor, does not throw
 | 
					
						
							|  |  |  |    template<class AllocConvertible> | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |    vector_alloc_holder(uninitialized_size_t, BOOST_FWD_REF(AllocConvertible) a, size_type initial_size) | 
					
						
							| 
									
										
										
										
											2013-02-24 13:13:36 +00:00
										 |  |  |       : Allocator(boost::forward<AllocConvertible>(a)) | 
					
						
							| 
									
										
										
										
											2013-09-26 18:05:25 +00:00
										 |  |  |       , m_start() | 
					
						
							| 
									
										
										
										
											2013-02-24 13:13:36 +00:00
										 |  |  |       , m_size(initial_size)  //Size is initialized here so vector should only call uninitialized_xxx after this
 | 
					
						
							| 
									
										
										
										
											2013-09-26 18:05:25 +00:00
										 |  |  |       , m_capacity() | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |    { | 
					
						
							| 
									
										
										
										
											2013-09-26 18:05:25 +00:00
										 |  |  |       if(initial_size){ | 
					
						
							|  |  |  |          m_start = this->allocation_command(allocate_new, initial_size, initial_size, m_capacity, m_start).first; | 
					
						
							|  |  |  |       } | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    //Constructor, does not throw
 | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |    vector_alloc_holder(uninitialized_size_t, size_type initial_size) | 
					
						
							| 
									
										
										
										
											2013-02-24 13:13:36 +00:00
										 |  |  |       : Allocator() | 
					
						
							| 
									
										
										
										
											2013-09-26 18:05:25 +00:00
										 |  |  |       , m_start() | 
					
						
							| 
									
										
										
										
											2013-02-24 13:13:36 +00:00
										 |  |  |       , m_size(initial_size)  //Size is initialized here so vector should only call uninitialized_xxx after this
 | 
					
						
							| 
									
										
										
										
											2013-09-26 18:05:25 +00:00
										 |  |  |       , m_capacity() | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |    { | 
					
						
							| 
									
										
										
										
											2013-09-26 18:05:25 +00:00
										 |  |  |       if(initial_size){ | 
					
						
							|  |  |  |          m_start = this->allocation_command | 
					
						
							|  |  |  |                (allocate_new, initial_size, initial_size, m_capacity, m_start).first; | 
					
						
							|  |  |  |       } | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    vector_alloc_holder(BOOST_RV_REF(vector_alloc_holder) holder) BOOST_CONTAINER_NOEXCEPT | 
					
						
							| 
									
										
										
										
											2014-11-01 20:03:25 +01:00
										 |  |  |       : Allocator(BOOST_MOVE_BASE(Allocator, holder)) | 
					
						
							| 
									
										
										
										
											2013-02-24 13:13:36 +00:00
										 |  |  |       , m_start(holder.m_start) | 
					
						
							|  |  |  |       , m_size(holder.m_size) | 
					
						
							|  |  |  |       , m_capacity(holder.m_capacity) | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |    { | 
					
						
							|  |  |  |       holder.m_start = pointer(); | 
					
						
							|  |  |  |       holder.m_size = holder.m_capacity = 0; | 
					
						
							|  |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |    void first_allocation(size_type cap) | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |    { | 
					
						
							| 
									
										
										
										
											2013-09-26 18:05:25 +00:00
										 |  |  |       if(cap){ | 
					
						
							|  |  |  |          m_start = this->allocation_command | 
					
						
							|  |  |  |                (allocate_new, cap, cap, m_capacity, m_start).first; | 
					
						
							| 
									
										
										
										
											2014-09-20 17:28:41 +02:00
										 |  |  |          #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
 | 
					
						
							|  |  |  |          ++this->num_alloc; | 
					
						
							|  |  |  |          #endif
 | 
					
						
							| 
									
										
										
										
											2013-09-26 18:05:25 +00:00
										 |  |  |       } | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-02-24 13:13:36 +00:00
										 |  |  |    void first_allocation_same_allocator_type(size_type cap) | 
					
						
							|  |  |  |    {  this->first_allocation(cap);  } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |    ~vector_alloc_holder() BOOST_CONTAINER_NOEXCEPT | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    { | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |       if(this->m_capacity){ | 
					
						
							|  |  |  |          this->alloc().deallocate(this->m_start, this->m_capacity); | 
					
						
							|  |  |  |       } | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    std::pair<pointer, bool> | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |       allocation_command(boost::container::allocation_type command, | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  |                          size_type limit_size, | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |                          size_type preferred_size, | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |                          size_type &received_size, const pointer &reuse = pointer()) | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    { | 
					
						
							| 
									
										
										
										
											2012-11-24 21:08:18 +00:00
										 |  |  |       return allocator_version_traits<Allocator>::allocation_command | 
					
						
							|  |  |  |          (this->alloc(), command, limit_size, preferred_size, received_size, reuse); | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    size_type next_capacity(size_type additional_objects) const | 
					
						
							| 
									
										
										
										
											2011-12-22 20:08:24 +00:00
										 |  |  |    { | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |       return next_capacity_calculator | 
					
						
							| 
									
										
										
										
											2014-09-17 23:36:23 +02:00
										 |  |  |          <size_type, NextCapacityDouble //NextCapacity60Percent
 | 
					
						
							|  |  |  |          >::get( allocator_traits_type::max_size(this->alloc()) | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |                , this->m_capacity, additional_objects ); | 
					
						
							| 
									
										
										
										
											2011-12-22 20:08:24 +00:00
										 |  |  |    } | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |    pointer     m_start; | 
					
						
							|  |  |  |    size_type   m_size; | 
					
						
							|  |  |  |    size_type   m_capacity; | 
					
						
							| 
									
										
										
										
											2011-12-22 20:08:24 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |    void swap(vector_alloc_holder &x) BOOST_CONTAINER_NOEXCEPT | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |    { | 
					
						
							| 
									
										
										
										
											2013-03-03 12:26:48 +00:00
										 |  |  |       boost::container::swap_dispatch(this->m_start, x.m_start); | 
					
						
							|  |  |  |       boost::container::swap_dispatch(this->m_size, x.m_size); | 
					
						
							|  |  |  |       boost::container::swap_dispatch(this->m_capacity, x.m_capacity); | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |    } | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |    void move_from_empty(vector_alloc_holder &x) BOOST_CONTAINER_NOEXCEPT | 
					
						
							| 
									
										
										
										
											2011-12-22 20:08:24 +00:00
										 |  |  |    { | 
					
						
							| 
									
										
										
										
											2014-04-21 13:59:49 +02:00
										 |  |  |       //this->m_size was previously initialized
 | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |       this->m_start     = x.m_start; | 
					
						
							|  |  |  |       this->m_capacity  = x.m_capacity; | 
					
						
							|  |  |  |       x.m_start = pointer(); | 
					
						
							|  |  |  |       x.m_size = x.m_capacity = 0; | 
					
						
							| 
									
										
										
										
											2011-12-22 20:08:24 +00:00
										 |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |    Allocator &alloc() BOOST_CONTAINER_NOEXCEPT | 
					
						
							|  |  |  |    {  return *this;  } | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |    const Allocator &alloc() const BOOST_CONTAINER_NOEXCEPT | 
					
						
							|  |  |  |    {  return *this;  } | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-02-24 20:34:15 +00:00
										 |  |  |    const pointer   &start() const     BOOST_CONTAINER_NOEXCEPT {  return m_start;  } | 
					
						
							|  |  |  |    const size_type &capacity() const  BOOST_CONTAINER_NOEXCEPT {  return m_capacity;  } | 
					
						
							|  |  |  |    void start(const pointer &p)       BOOST_CONTAINER_NOEXCEPT {  m_start = p;  } | 
					
						
							|  |  |  |    void capacity(const size_type &c)  BOOST_CONTAINER_NOEXCEPT {  m_capacity = c;  } | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | //!This struct deallocates and allocated memory
 | 
					
						
							|  |  |  | template <class Allocator> | 
					
						
							|  |  |  | struct vector_alloc_holder<Allocator, container_detail::integral_constant<unsigned, 0> > | 
					
						
							|  |  |  |    : public Allocator | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |    private: | 
					
						
							|  |  |  |    BOOST_MOVABLE_BUT_NOT_COPYABLE(vector_alloc_holder) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    public: | 
					
						
							|  |  |  |    typedef boost::container::allocator_traits<Allocator> allocator_traits_type; | 
					
						
							|  |  |  |    typedef typename allocator_traits_type::pointer       pointer; | 
					
						
							|  |  |  |    typedef typename allocator_traits_type::size_type     size_type; | 
					
						
							|  |  |  |    typedef typename allocator_traits_type::value_type    value_type; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    template <class OtherAllocator, class OtherAllocatorVersion> | 
					
						
							|  |  |  |    friend struct vector_alloc_holder; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    //Constructor, does not throw
 | 
					
						
							|  |  |  |    vector_alloc_holder() | 
					
						
							|  |  |  |       BOOST_CONTAINER_NOEXCEPT_IF(::boost::has_nothrow_default_constructor<Allocator>::value) | 
					
						
							| 
									
										
										
										
											2013-02-24 13:13:36 +00:00
										 |  |  |       : Allocator(), m_size() | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |    {} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    //Constructor, does not throw
 | 
					
						
							|  |  |  |    template<class AllocConvertible> | 
					
						
							|  |  |  |    explicit vector_alloc_holder(BOOST_FWD_REF(AllocConvertible) a) BOOST_CONTAINER_NOEXCEPT | 
					
						
							| 
									
										
										
										
											2013-02-24 13:13:36 +00:00
										 |  |  |       : Allocator(boost::forward<AllocConvertible>(a)), m_size() | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |    {} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    //Constructor, does not throw
 | 
					
						
							|  |  |  |    template<class AllocConvertible> | 
					
						
							| 
									
										
										
										
											2013-09-29 11:37:30 +00:00
										 |  |  |    vector_alloc_holder(uninitialized_size_t, BOOST_FWD_REF(AllocConvertible) a, size_type initial_size) | 
					
						
							| 
									
										
										
										
											2013-02-24 13:13:36 +00:00
										 |  |  |       : Allocator(boost::forward<AllocConvertible>(a)) | 
					
						
							| 
									
										
										
										
											2013-09-26 18:05:25 +00:00
										 |  |  |       , m_size(initial_size)  //Size is initialized here...
 | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |    { | 
					
						
							| 
									
										
										
										
											2013-09-26 18:05:25 +00:00
										 |  |  |       //... and capacity here, so vector, must call uninitialized_xxx in the derived constructor
 | 
					
						
							| 
									
										
										
										
											2013-02-24 13:13:36 +00:00
										 |  |  |       this->first_allocation(initial_size); | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    //Constructor, does not throw
 | 
					
						
							| 
									
										
										
										
											2013-09-29 11:37:30 +00:00
										 |  |  |    vector_alloc_holder(uninitialized_size_t, size_type initial_size) | 
					
						
							| 
									
										
										
										
											2013-02-24 13:13:36 +00:00
										 |  |  |       : Allocator() | 
					
						
							| 
									
										
										
										
											2013-09-26 18:05:25 +00:00
										 |  |  |       , m_size(initial_size)  //Size is initialized here...
 | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |    { | 
					
						
							| 
									
										
										
										
											2013-09-26 18:05:25 +00:00
										 |  |  |       //... and capacity here, so vector, must call uninitialized_xxx in the derived constructor
 | 
					
						
							| 
									
										
										
										
											2013-02-24 13:13:36 +00:00
										 |  |  |       this->first_allocation(initial_size); | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    vector_alloc_holder(BOOST_RV_REF(vector_alloc_holder) holder) | 
					
						
							| 
									
										
										
										
											2014-11-01 20:03:25 +01:00
										 |  |  |       : Allocator(BOOST_MOVE_BASE(Allocator, holder)) | 
					
						
							| 
									
										
										
										
											2013-02-24 13:13:36 +00:00
										 |  |  |       , m_size(holder.m_size) //Size is initialized here so vector should only call uninitialized_xxx after this
 | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |    { | 
					
						
							| 
									
										
										
										
											2013-02-24 13:13:36 +00:00
										 |  |  |       ::boost::container::uninitialized_move_alloc_n | 
					
						
							| 
									
										
										
										
											2013-03-03 12:26:48 +00:00
										 |  |  |          (this->alloc(), container_detail::to_raw_pointer(holder.start()), m_size, container_detail::to_raw_pointer(this->start())); | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    template<class OtherAllocator, class OtherAllocatorVersion> | 
					
						
							|  |  |  |    vector_alloc_holder(BOOST_RV_REF_BEG vector_alloc_holder<OtherAllocator, OtherAllocatorVersion> BOOST_RV_REF_END holder) | 
					
						
							|  |  |  |       : Allocator() | 
					
						
							| 
									
										
										
										
											2013-02-24 13:13:36 +00:00
										 |  |  |       , m_size(holder.m_size) //Initialize it to m_size as first_allocation can only succeed or abort
 | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |    { | 
					
						
							| 
									
										
										
										
											2013-02-24 13:13:36 +00:00
										 |  |  |       //Different allocator type so we must check we have enough storage
 | 
					
						
							|  |  |  |       const size_type n = holder.m_size; | 
					
						
							|  |  |  |       this->first_allocation(n); | 
					
						
							|  |  |  |       ::boost::container::uninitialized_move_alloc_n | 
					
						
							| 
									
										
										
										
											2013-03-03 12:26:48 +00:00
										 |  |  |          (this->alloc(), container_detail::to_raw_pointer(holder.start()), n, container_detail::to_raw_pointer(this->start())); | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    void first_allocation(size_type cap) | 
					
						
							|  |  |  |    { | 
					
						
							|  |  |  |       if(cap > Allocator::internal_capacity){ | 
					
						
							|  |  |  |          throw_bad_alloc(); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-02-24 20:34:15 +00:00
										 |  |  |    void first_allocation_same_allocator_type(size_type) BOOST_CONTAINER_NOEXCEPT | 
					
						
							| 
									
										
										
										
											2013-02-24 13:13:36 +00:00
										 |  |  |    {} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |    //Destructor
 | 
					
						
							|  |  |  |    ~vector_alloc_holder() BOOST_CONTAINER_NOEXCEPT | 
					
						
							|  |  |  |    {} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    void swap(vector_alloc_holder &x) | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    { | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |       this->priv_swap_members_impl(x); | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |    template<class OtherAllocator, class OtherAllocatorVersion> | 
					
						
							|  |  |  |    void swap(vector_alloc_holder<OtherAllocator, OtherAllocatorVersion> &x) | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    { | 
					
						
							| 
									
										
										
										
											2013-02-24 13:13:36 +00:00
										 |  |  |       if(this->m_size > OtherAllocator::internal_capacity || x.m_size > Allocator::internal_capacity){ | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |          throw_bad_alloc(); | 
					
						
							| 
									
										
										
										
											2011-12-22 20:08:24 +00:00
										 |  |  |       } | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |       this->priv_swap_members_impl(x); | 
					
						
							|  |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-04-20 14:04:00 +00:00
										 |  |  |    void move_from_empty(vector_alloc_holder &) | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |    {  //Containers with version 0 allocators can't be moved without move elements one by one
 | 
					
						
							|  |  |  |       throw_bad_alloc(); | 
					
						
							|  |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    Allocator &alloc() BOOST_CONTAINER_NOEXCEPT | 
					
						
							|  |  |  |    {  return *this;  } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    const Allocator &alloc() const BOOST_CONTAINER_NOEXCEPT | 
					
						
							|  |  |  |    {  return *this;  } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-02-24 20:34:15 +00:00
										 |  |  |    pointer start() const       BOOST_CONTAINER_NOEXCEPT {  return Allocator::internal_storage();  } | 
					
						
							|  |  |  |    size_type  capacity() const BOOST_CONTAINER_NOEXCEPT {  return Allocator::internal_capacity;  } | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |    size_type   m_size; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    private: | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    template<class OtherAllocator, class OtherAllocatorVersion> | 
					
						
							|  |  |  |    void priv_swap_members_impl(vector_alloc_holder<OtherAllocator, OtherAllocatorVersion> &x) | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    { | 
					
						
							| 
									
										
										
										
											2014-11-26 07:08:06 +01:00
										 |  |  |       const size_type MaxTmpStorage = sizeof(value_type)*Allocator::internal_capacity; | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |       value_type *const first_this = container_detail::to_raw_pointer(this->start()); | 
					
						
							|  |  |  |       value_type *const first_x = container_detail::to_raw_pointer(x.start()); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       if(this->m_size < x.m_size){ | 
					
						
							| 
									
										
										
										
											2013-03-03 12:26:48 +00:00
										 |  |  |          boost::container::deep_swap_alloc_n<MaxTmpStorage>(this->alloc(), first_this, this->m_size, first_x, x.m_size); | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |       } | 
					
						
							|  |  |  |       else{ | 
					
						
							| 
									
										
										
										
											2013-03-03 12:26:48 +00:00
										 |  |  |          boost::container::deep_swap_alloc_n<MaxTmpStorage>(this->alloc(), first_x, x.m_size, first_this, this->m_size); | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |       } | 
					
						
							| 
									
										
										
										
											2013-03-03 12:26:48 +00:00
										 |  |  |       boost::container::swap_dispatch(this->m_size, x.m_size); | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    } | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-22 20:08:24 +00:00
										 |  |  | }  //namespace container_detail {
 | 
					
						
							| 
									
										
										
										
											2013-08-11 21:36:19 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  | #endif   //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  | //! 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
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | //! elements in a vector may vary dynamically; memory management is automatic.
 | 
					
						
							| 
									
										
										
										
											2014-01-05 22:25:12 +01:00
										 |  |  | //!
 | 
					
						
							|  |  |  | //! \tparam T The type of object that is stored in the vector
 | 
					
						
							|  |  |  | //! \tparam Allocator The allocator used for all internal memory management
 | 
					
						
							| 
									
										
										
										
											2014-09-20 17:28:41 +02:00
										 |  |  | template <class T, class Allocator BOOST_CONTAINER_DOCONLY(= std::allocator<T>) > | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  | class vector | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |    #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
 | 
					
						
							| 
									
										
										
										
											2014-04-21 13:59:49 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |    typedef typename container_detail::version<Allocator>::type alloc_version; | 
					
						
							| 
									
										
										
										
											2013-08-11 21:36:19 +00:00
										 |  |  |    boost::container::container_detail::vector_alloc_holder | 
					
						
							|  |  |  |       <Allocator, alloc_version>                            m_holder; | 
					
						
							|  |  |  |    typedef allocator_traits<Allocator>                      allocator_traits_type; | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |    template <class U, class UAllocator> | 
					
						
							|  |  |  |    friend class vector; | 
					
						
							| 
									
										
										
										
											2013-08-11 21:36:19 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |    typedef typename ::boost::container::allocator_traits | 
					
						
							|  |  |  |       <Allocator>::pointer                                     pointer_impl; | 
					
						
							|  |  |  |    typedef container_detail::vec_iterator<pointer_impl, false> iterator_impl; | 
					
						
							|  |  |  |    typedef container_detail::vec_iterator<pointer_impl, true > const_iterator_impl; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |    #endif   //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    public: | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  |    //////////////////////////////////////////////
 | 
					
						
							|  |  |  |    //
 | 
					
						
							|  |  |  |    //                    types
 | 
					
						
							|  |  |  |    //
 | 
					
						
							|  |  |  |    //////////////////////////////////////////////
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-30 20:38:04 +00:00
										 |  |  |    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 Allocator                                                                   stored_allocator_type; | 
					
						
							| 
									
										
										
										
											2014-09-20 17:28:41 +02:00
										 |  |  |    #if defined BOOST_CONTAINER_VECTOR_ITERATOR_IS_POINTER
 | 
					
						
							| 
									
										
										
										
											2013-02-24 20:34:15 +00:00
										 |  |  |    typedef BOOST_CONTAINER_IMPDEF(pointer)                                             iterator; | 
					
						
							|  |  |  |    typedef BOOST_CONTAINER_IMPDEF(const_pointer)                                       const_iterator; | 
					
						
							|  |  |  |    #else
 | 
					
						
							| 
									
										
										
										
											2013-08-11 21:36:19 +00:00
										 |  |  |    typedef BOOST_CONTAINER_IMPDEF(iterator_impl)                                       iterator; | 
					
						
							|  |  |  |    typedef BOOST_CONTAINER_IMPDEF(const_iterator_impl)                                 const_iterator; | 
					
						
							| 
									
										
										
										
											2013-02-24 20:34:15 +00:00
										 |  |  |    #endif
 | 
					
						
							| 
									
										
										
										
											2014-11-26 07:08:06 +01:00
										 |  |  |    typedef BOOST_CONTAINER_IMPDEF(boost::container::reverse_iterator<iterator>)        reverse_iterator; | 
					
						
							|  |  |  |    typedef BOOST_CONTAINER_IMPDEF(boost::container::reverse_iterator<const_iterator>)  const_reverse_iterator; | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |    #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    private: | 
					
						
							|  |  |  |    BOOST_COPYABLE_AND_MOVABLE(vector) | 
					
						
							| 
									
										
										
										
											2014-09-26 08:12:40 +02:00
										 |  |  |    typedef container_detail::vector_value_traits<Allocator> value_traits; | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |    typedef container_detail::integral_constant<unsigned, 0> allocator_v0; | 
					
						
							|  |  |  |    typedef container_detail::integral_constant<unsigned, 1> allocator_v1; | 
					
						
							|  |  |  |    typedef container_detail::integral_constant<unsigned, 2> allocator_v2; | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |    typedef constant_iterator<T, difference_type>            cvalue_iterator; | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |    #endif   //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |    public: | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  |    //////////////////////////////////////////////
 | 
					
						
							|  |  |  |    //
 | 
					
						
							|  |  |  |    //          construct/copy/destroy
 | 
					
						
							|  |  |  |    //
 | 
					
						
							|  |  |  |    //////////////////////////////////////////////
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |    //! <b>Effects</b>: Constructs a vector taking the allocator as parameter.
 | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2011-12-22 20:08:24 +00:00
										 |  |  |    //! <b>Throws</b>: If allocator_type's default constructor throws.
 | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //! <b>Complexity</b>: Constant.
 | 
					
						
							| 
									
										
										
										
											2011-12-22 20:08:24 +00:00
										 |  |  |    vector() | 
					
						
							| 
									
										
										
										
											2012-09-30 20:38:04 +00:00
										 |  |  |       BOOST_CONTAINER_NOEXCEPT_IF(::boost::has_nothrow_default_constructor<Allocator>::value) | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |       : m_holder() | 
					
						
							| 
									
										
										
										
											2011-12-22 20:08:24 +00:00
										 |  |  |    {} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    //! <b>Effects</b>: Constructs a vector taking the allocator as parameter.
 | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2011-12-22 20:08:24 +00:00
										 |  |  |    //! <b>Throws</b>: Nothing
 | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2011-12-22 20:08:24 +00:00
										 |  |  |    //! <b>Complexity</b>: Constant.
 | 
					
						
							| 
									
										
										
										
											2012-09-30 20:38:04 +00:00
										 |  |  |    explicit vector(const Allocator& a) BOOST_CONTAINER_NOEXCEPT | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |       : m_holder(a) | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    {} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    //! <b>Effects</b>: Constructs a vector that will use a copy of allocator a
 | 
					
						
							| 
									
										
										
										
											2013-09-26 18:05:25 +00:00
										 |  |  |    //!   and inserts n value initialized values.
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2011-12-22 20:08:24 +00:00
										 |  |  |    //! <b>Throws</b>: If allocator_type's default constructor or allocation
 | 
					
						
							| 
									
										
										
										
											2014-04-17 00:06:59 +02:00
										 |  |  |    //!   throws or T's value initialization throws.
 | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //! <b>Complexity</b>: Linear to n.
 | 
					
						
							| 
									
										
										
										
											2011-12-22 20:08:24 +00:00
										 |  |  |    explicit vector(size_type n) | 
					
						
							| 
									
										
										
										
											2013-09-29 11:37:30 +00:00
										 |  |  |       :  m_holder(container_detail::uninitialized_size, n) | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |    { | 
					
						
							| 
									
										
										
										
											2014-09-21 23:57:23 +02:00
										 |  |  |       #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
 | 
					
						
							|  |  |  |       this->num_alloc += n != 0; | 
					
						
							|  |  |  |       #endif
 | 
					
						
							| 
									
										
										
										
											2013-09-26 18:05:25 +00:00
										 |  |  |       boost::container::uninitialized_value_init_alloc_n | 
					
						
							|  |  |  |          (this->m_holder.alloc(), n, container_detail::to_raw_pointer(this->m_holder.start())); | 
					
						
							|  |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    //! <b>Effects</b>: Constructs a vector that will use a copy of allocator a
 | 
					
						
							|  |  |  |    //!   and inserts n default initialized values.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Throws</b>: If allocator_type's default constructor or allocation
 | 
					
						
							| 
									
										
										
										
											2014-04-17 00:06:59 +02:00
										 |  |  |    //!   throws or T's default initialization throws.
 | 
					
						
							| 
									
										
										
										
											2013-09-26 18:05:25 +00:00
										 |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Complexity</b>: Linear to n.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Note</b>: Non-standard extension
 | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |    vector(size_type n, default_init_t) | 
					
						
							| 
									
										
										
										
											2013-09-29 11:37:30 +00:00
										 |  |  |       :  m_holder(container_detail::uninitialized_size, n) | 
					
						
							| 
									
										
										
										
											2013-09-26 18:05:25 +00:00
										 |  |  |    { | 
					
						
							| 
									
										
										
										
											2014-09-21 23:57:23 +02:00
										 |  |  |       #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
 | 
					
						
							|  |  |  |       this->num_alloc += n != 0; | 
					
						
							|  |  |  |       #endif
 | 
					
						
							| 
									
										
										
										
											2013-09-26 18:05:25 +00:00
										 |  |  |       boost::container::uninitialized_default_init_alloc_n | 
					
						
							|  |  |  |          (this->m_holder.alloc(), n, container_detail::to_raw_pointer(this->m_holder.start())); | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |    } | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |    //! <b>Effects</b>: Constructs a vector
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //!   and inserts n copies of value.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2011-12-22 20:08:24 +00:00
										 |  |  |    //! <b>Throws</b>: If allocator_type's default constructor or allocation
 | 
					
						
							|  |  |  |    //!   throws or T's copy constructor throws.
 | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //! <b>Complexity</b>: Linear to n.
 | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |    vector(size_type n, const T& value) | 
					
						
							| 
									
										
										
										
											2013-09-29 11:37:30 +00:00
										 |  |  |       :  m_holder(container_detail::uninitialized_size, n) | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |    { | 
					
						
							| 
									
										
										
										
											2014-09-21 23:57:23 +02:00
										 |  |  |       #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
 | 
					
						
							|  |  |  |       this->num_alloc += n != 0; | 
					
						
							|  |  |  |       #endif
 | 
					
						
							| 
									
										
										
										
											2013-02-24 13:13:36 +00:00
										 |  |  |       boost::container::uninitialized_fill_alloc_n | 
					
						
							|  |  |  |          (this->m_holder.alloc(), value, n, container_detail::to_raw_pointer(this->m_holder.start())); | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    //! <b>Effects</b>: Constructs a vector that will use a copy of allocator a
 | 
					
						
							|  |  |  |    //!   and inserts n copies of value.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Throws</b>: If 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) | 
					
						
							| 
									
										
										
										
											2013-09-29 11:37:30 +00:00
										 |  |  |       :  m_holder(container_detail::uninitialized_size, a, n) | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |    { | 
					
						
							| 
									
										
										
										
											2014-09-21 23:57:23 +02:00
										 |  |  |       #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
 | 
					
						
							|  |  |  |       this->num_alloc += n != 0; | 
					
						
							|  |  |  |       #endif
 | 
					
						
							| 
									
										
										
										
											2013-02-24 13:13:36 +00:00
										 |  |  |       boost::container::uninitialized_fill_alloc_n | 
					
						
							|  |  |  |          (this->m_holder.alloc(), value, n, container_detail::to_raw_pointer(this->m_holder.start())); | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |    } | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |    //! <b>Effects</b>: Constructs a vector
 | 
					
						
							|  |  |  |    //!   and inserts a copy of the range [first, last) in the vector.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Throws</b>: If allocator_type's default constructor or allocation
 | 
					
						
							| 
									
										
										
										
											2014-04-17 00:06:59 +02:00
										 |  |  |    //!   throws or T's constructor taking a dereferenced InIt throws.
 | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Complexity</b>: Linear to the range [first, last).
 | 
					
						
							|  |  |  |    template <class InIt> | 
					
						
							|  |  |  |    vector(InIt first, InIt last) | 
					
						
							|  |  |  |       :  m_holder() | 
					
						
							|  |  |  |    {  this->insert(this->cend(), first, last); } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  |    //! <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.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Throws</b>: If allocator_type's default constructor or allocation
 | 
					
						
							| 
									
										
										
										
											2014-04-17 00:06:59 +02:00
										 |  |  |    //!   throws or T's constructor taking a dereferenced InIt throws.
 | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Complexity</b>: Linear to the range [first, last).
 | 
					
						
							|  |  |  |    template <class InIt> | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |    vector(InIt first, InIt last, const allocator_type& a) | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |       :  m_holder(a) | 
					
						
							|  |  |  |    {  this->insert(this->cend(), first, last); } | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |    //! <b>Effects</b>: Copy constructs a vector.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Postcondition</b>: x == *this.
 | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2011-12-22 20:08:24 +00:00
										 |  |  |    //! <b>Throws</b>: If allocator_type's default constructor or allocation
 | 
					
						
							|  |  |  |    //!   throws or T's copy constructor throws.
 | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //! <b>Complexity</b>: Linear to the elements x contains.
 | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  |    vector(const vector &x) | 
					
						
							| 
									
										
										
										
											2013-09-29 11:37:30 +00:00
										 |  |  |       :  m_holder( container_detail::uninitialized_size | 
					
						
							|  |  |  |                  , allocator_traits_type::select_on_container_copy_construction(x.m_holder.alloc()) | 
					
						
							|  |  |  |                  , x.size()) | 
					
						
							| 
									
										
										
										
											2011-12-22 20:08:24 +00:00
										 |  |  |    { | 
					
						
							| 
									
										
										
										
											2014-09-21 23:57:23 +02:00
										 |  |  |       #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
 | 
					
						
							|  |  |  |       this->num_alloc += x.size() != 0; | 
					
						
							|  |  |  |       #endif
 | 
					
						
							| 
									
										
										
										
											2013-03-03 12:26:48 +00:00
										 |  |  |       ::boost::container::uninitialized_copy_alloc_n | 
					
						
							| 
									
										
										
										
											2013-02-24 13:13:36 +00:00
										 |  |  |          ( this->m_holder.alloc(), container_detail::to_raw_pointer(x.m_holder.start()) | 
					
						
							|  |  |  |          , x.size(), container_detail::to_raw_pointer(this->m_holder.start())); | 
					
						
							| 
									
										
										
										
											2011-12-22 20:08:24 +00:00
										 |  |  |    } | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-08-15 20:15:01 +02:00
										 |  |  | #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
 | 
					
						
							|  |  |  |    //! <b>Effects</b>: Constructs a vector that will use a copy of allocator a
 | 
					
						
							|  |  |  |    //!  and inserts a copy of the range [il.begin(), il.last()) in the vector
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Throws</b>: If allocator_type's default constructor
 | 
					
						
							|  |  |  |    //!   throws or T's constructor taking a dereferenced initializer_list iterator throws.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Complexity</b>: Linear to the range [il.begin(), il.end()).
 | 
					
						
							|  |  |  |    vector(std::initializer_list<value_type> il, const allocator_type& a = allocator_type()) | 
					
						
							|  |  |  |       : m_holder(a) | 
					
						
							|  |  |  |    { | 
					
						
							|  |  |  |       insert(cend(), il.begin(), il.end()); | 
					
						
							|  |  |  |    } | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-04-21 13:59:49 +02:00
										 |  |  |    //! <b>Effects</b>: Move constructor. Moves x's resources to *this.
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2011-12-22 20:08:24 +00:00
										 |  |  |    //! <b>Throws</b>: Nothing
 | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //! <b>Complexity</b>: Constant.
 | 
					
						
							| 
									
										
										
										
											2014-04-21 13:59:49 +02:00
										 |  |  |    vector(BOOST_RV_REF(vector) x) BOOST_CONTAINER_NOEXCEPT | 
					
						
							|  |  |  |       :  m_holder(boost::move(x.m_holder)) | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |    {} | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |    #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-04-21 13:59:49 +02:00
										 |  |  |    //! <b>Effects</b>: Move constructor. Moves x's resources to *this.
 | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Throws</b>: If T's move constructor or allocation throws
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Complexity</b>: Linear.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2014-04-21 13:59:49 +02:00
										 |  |  |    //! <b>Note</b>: Non-standard extension to support static_vector
 | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |    template<class OtherAllocator> | 
					
						
							| 
									
										
										
										
											2014-04-21 13:59:49 +02:00
										 |  |  |    vector(BOOST_RV_REF_BEG vector<T, OtherAllocator> BOOST_RV_REF_END x | 
					
						
							|  |  |  |          , typename container_detail::enable_if_c | 
					
						
							|  |  |  |             < container_detail::is_version<OtherAllocator, 0>::value>::type * = 0 | 
					
						
							|  |  |  |          ) | 
					
						
							|  |  |  |       :  m_holder(boost::move(x.m_holder)) | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |    {} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    #endif   //!defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-03-22 18:46:55 +00:00
										 |  |  |    //! <b>Effects</b>: Copy constructs a vector using the specified allocator.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Postcondition</b>: x == *this.
 | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2012-03-22 18:46:55 +00:00
										 |  |  |    //! <b>Throws</b>: If allocation
 | 
					
						
							|  |  |  |    //!   throws or T's copy constructor throws.
 | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2012-03-22 18:46:55 +00:00
										 |  |  |    //! <b>Complexity</b>: Linear to the elements x contains.
 | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  |    vector(const vector &x, const allocator_type &a) | 
					
						
							| 
									
										
										
										
											2013-09-29 11:37:30 +00:00
										 |  |  |       :  m_holder(container_detail::uninitialized_size, a, x.size()) | 
					
						
							| 
									
										
										
										
											2012-03-22 18:46:55 +00:00
										 |  |  |    { | 
					
						
							| 
									
										
										
										
											2014-09-21 23:57:23 +02:00
										 |  |  |       #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
 | 
					
						
							|  |  |  |       this->num_alloc += x.size() != 0; | 
					
						
							|  |  |  |       #endif
 | 
					
						
							| 
									
										
										
										
											2013-03-03 12:26:48 +00:00
										 |  |  |       ::boost::container::uninitialized_copy_alloc_n_source | 
					
						
							| 
									
										
										
										
											2013-02-24 13:13:36 +00:00
										 |  |  |          ( this->m_holder.alloc(), container_detail::to_raw_pointer(x.m_holder.start()) | 
					
						
							|  |  |  |          , x.size(), container_detail::to_raw_pointer(this->m_holder.start())); | 
					
						
							| 
									
										
										
										
											2012-03-22 18:46:55 +00:00
										 |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    //! <b>Effects</b>: Move constructor using the specified allocator.
 | 
					
						
							| 
									
										
										
										
											2014-04-21 13:59:49 +02:00
										 |  |  |    //!                 Moves x's resources to *this if a == allocator_type().
 | 
					
						
							| 
									
										
										
										
											2012-03-22 18:46:55 +00:00
										 |  |  |    //!                 Otherwise copies values from x to *this.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Throws</b>: If allocation or T's copy constructor throws.
 | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2014-04-21 13:59:49 +02:00
										 |  |  |    //! <b>Complexity</b>: Constant if a == x.get_allocator(), linear otherwise.
 | 
					
						
							|  |  |  |    vector(BOOST_RV_REF(vector) x, const allocator_type &a) | 
					
						
							|  |  |  |       :  m_holder(container_detail::uninitialized_size, a, x.size()) | 
					
						
							| 
									
										
										
										
											2012-03-22 18:46:55 +00:00
										 |  |  |    { | 
					
						
							| 
									
										
										
										
											2014-09-21 23:57:23 +02:00
										 |  |  |       #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
 | 
					
						
							|  |  |  |       this->num_alloc += x.size() != 0; | 
					
						
							|  |  |  |       #endif
 | 
					
						
							| 
									
										
										
										
											2014-04-21 13:59:49 +02:00
										 |  |  |       if(x.m_holder.alloc() == a){ | 
					
						
							|  |  |  |          this->m_holder.move_from_empty(x.m_holder); | 
					
						
							| 
									
										
										
										
											2012-03-22 18:46:55 +00:00
										 |  |  |       } | 
					
						
							|  |  |  |       else{ | 
					
						
							| 
									
										
										
										
											2014-04-21 13:59:49 +02:00
										 |  |  |          const size_type n = x.size(); | 
					
						
							| 
									
										
										
										
											2013-02-24 13:13:36 +00:00
										 |  |  |          this->m_holder.first_allocation_same_allocator_type(n); | 
					
						
							|  |  |  |          ::boost::container::uninitialized_move_alloc_n_source | 
					
						
							| 
									
										
										
										
											2014-04-21 13:59:49 +02:00
										 |  |  |             ( this->m_holder.alloc(), container_detail::to_raw_pointer(x.m_holder.start()) | 
					
						
							| 
									
										
										
										
											2013-02-24 13:13:36 +00:00
										 |  |  |             , n, container_detail::to_raw_pointer(this->m_holder.start())); | 
					
						
							| 
									
										
										
										
											2012-03-22 18:46:55 +00:00
										 |  |  |       } | 
					
						
							|  |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //! <b>Effects</b>: Destroys the vector. All stored values are destroyed
 | 
					
						
							|  |  |  |    //!   and used memory is deallocated.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Throws</b>: Nothing.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Complexity</b>: Linear to the number of elements.
 | 
					
						
							| 
									
										
										
										
											2011-12-22 20:08:24 +00:00
										 |  |  |    ~vector() BOOST_CONTAINER_NOEXCEPT | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |    { | 
					
						
							| 
									
										
										
										
											2013-03-03 12:26:48 +00:00
										 |  |  |       boost::container::destroy_alloc_n | 
					
						
							|  |  |  |          (this->get_stored_allocator(), container_detail::to_raw_pointer(this->m_holder.start()), this->m_holder.m_size); | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |       //vector_alloc_holder deallocates the data
 | 
					
						
							| 
									
										
										
										
											2014-05-28 15:50:13 +02:00
										 |  |  |    } | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  |    //! <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>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) | 
					
						
							|  |  |  |    { | 
					
						
							|  |  |  |       if (&x != this){ | 
					
						
							| 
									
										
										
										
											2014-04-21 13:59:49 +02:00
										 |  |  |          this->priv_copy_assign(x); | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  |       } | 
					
						
							|  |  |  |       return *this; | 
					
						
							|  |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-08-15 20:15:01 +02:00
										 |  |  | #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) | 
					
						
							|  |  |  |    { | 
					
						
							|  |  |  |       assign(il.begin(), il.end()); | 
					
						
							|  |  |  |       return *this; | 
					
						
							|  |  |  |    } | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-04-21 13:59:49 +02:00
										 |  |  |    //! <b>Effects</b>: Move assignment. All x's values are transferred to *this.
 | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Postcondition</b>: x.empty(). *this contains a the elements x had
 | 
					
						
							|  |  |  |    //!   before the function.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2014-04-21 13:59:49 +02:00
										 |  |  |    //! <b>Throws</b>: If allocator_traits_type::propagate_on_container_move_assignment
 | 
					
						
							|  |  |  |    //!   is false and (allocation throws or value_type's move constructor throws)
 | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2014-04-21 13:59:49 +02:00
										 |  |  |    //! <b>Complexity</b>: Constant if allocator_traits_type::
 | 
					
						
							|  |  |  |    //!   propagate_on_container_move_assignment is true or
 | 
					
						
							|  |  |  |    //!   this->get>allocator() == x.get_allocator(). Linear otherwise.
 | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  |    vector& operator=(BOOST_RV_REF(vector) x) | 
					
						
							| 
									
										
										
										
											2014-04-23 23:18:18 +02:00
										 |  |  |       BOOST_CONTAINER_NOEXCEPT_IF(allocator_traits_type::propagate_on_container_move_assignment::value) | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  |    { | 
					
						
							| 
									
										
										
										
											2014-04-21 13:59:49 +02:00
										 |  |  |       this->priv_move_assign(boost::move(x)); | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  |       return *this; | 
					
						
							|  |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |    #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-04-21 13:59:49 +02:00
										 |  |  |    //! <b>Effects</b>: Move assignment. All x's values are transferred to *this.
 | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Postcondition</b>: x.empty(). *this contains a the elements x had
 | 
					
						
							|  |  |  |    //!   before the function.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Throws</b>: If move constructor/assignment of T throws or allocation throws
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Complexity</b>: Linear.
 | 
					
						
							| 
									
										
										
										
											2014-04-21 13:59:49 +02:00
										 |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Note</b>: Non-standard extension to support static_vector
 | 
					
						
							|  |  |  |    template<class OtherAllocator> | 
					
						
							|  |  |  |    typename container_detail::enable_if_c | 
					
						
							|  |  |  |                            < container_detail::is_version<OtherAllocator, 0>::value && | 
					
						
							|  |  |  |                             !container_detail::is_same<OtherAllocator, allocator_type>::value | 
					
						
							|  |  |  |                            , vector& >::type | 
					
						
							|  |  |  |       operator=(BOOST_RV_REF_BEG vector<value_type, OtherAllocator> BOOST_RV_REF_END x) | 
					
						
							|  |  |  |    { | 
					
						
							|  |  |  |       this->priv_move_assign(boost::move(x)); | 
					
						
							|  |  |  |       return *this; | 
					
						
							|  |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    //! <b>Effects</b>: Copy assignment. All x's values are copied to *this.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Postcondition</b>: x.empty(). *this contains a the elements x had
 | 
					
						
							|  |  |  |    //!   before the function.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Throws</b>: If move constructor/assignment of T throws or allocation throws
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Complexity</b>: Linear.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Note</b>: Non-standard extension to support static_vector
 | 
					
						
							|  |  |  |    template<class OtherAllocator> | 
					
						
							|  |  |  |    typename container_detail::enable_if_c | 
					
						
							|  |  |  |                            < container_detail::is_version<OtherAllocator, 0>::value && | 
					
						
							|  |  |  |                             !container_detail::is_same<OtherAllocator, allocator_type>::value | 
					
						
							|  |  |  |                            , vector& >::type | 
					
						
							|  |  |  |       operator=(const vector<value_type, OtherAllocator> &x) | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |    { | 
					
						
							| 
									
										
										
										
											2014-04-21 13:59:49 +02:00
										 |  |  |       this->priv_copy_assign(x); | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |       return *this; | 
					
						
							|  |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  |    //! <b>Effects</b>: Assigns the the range [first, last) to *this.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Throws</b>: If memory allocation throws or T's copy/move constructor/assignment or
 | 
					
						
							|  |  |  |    //!   T's constructor/assignment from dereferencing InpIt throws.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Complexity</b>: Linear to n.
 | 
					
						
							|  |  |  |    template <class InIt> | 
					
						
							|  |  |  |    void assign(InIt first, InIt last | 
					
						
							| 
									
										
										
										
											2014-09-20 17:28:41 +02:00
										 |  |  |       BOOST_CONTAINER_DOCIGN(BOOST_CONTAINER_I typename container_detail::enable_if_c | 
					
						
							|  |  |  |          < !container_detail::is_convertible<InIt BOOST_CONTAINER_I size_type>::value && | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |             ( container_detail::is_input_iterator<InIt>::value || | 
					
						
							| 
									
										
										
										
											2014-09-20 17:28:41 +02:00
										 |  |  |               container_detail::is_same<alloc_version BOOST_CONTAINER_I allocator_v0>::value ) | 
					
						
							|  |  |  |          >::type * = 0) ) | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  |    { | 
					
						
							|  |  |  |       //Overwrite all elements we can from [first, last)
 | 
					
						
							|  |  |  |       iterator cur = this->begin(); | 
					
						
							| 
									
										
										
										
											2013-03-03 12:26:48 +00:00
										 |  |  |       const iterator end_it = this->end(); | 
					
						
							|  |  |  |       for ( ; first != last && cur != end_it; ++cur, ++first){ | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  |          *cur = *first; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       if (first == last){ | 
					
						
							|  |  |  |          //There are no more elements in the sequence, erase remaining
 | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |          T* const end_pos = container_detail::to_raw_pointer(this->m_holder.start()) + this->m_holder.m_size; | 
					
						
							| 
									
										
										
										
											2014-09-21 23:57:23 +02:00
										 |  |  |          const size_type n = static_cast<size_type>(end_pos - container_detail::iterator_to_raw_pointer(cur)); | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |          this->priv_destroy_last_n(n); | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  |       } | 
					
						
							|  |  |  |       else{ | 
					
						
							|  |  |  |          //There are more elements in the range, insert the remaining ones
 | 
					
						
							|  |  |  |          this->insert(this->cend(), first, last); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-08-15 20:15:01 +02:00
										 |  |  | #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
 | 
					
						
							|  |  |  |    //! <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) | 
					
						
							|  |  |  |    { | 
					
						
							|  |  |  |       assign(il.begin(), il.end()); | 
					
						
							|  |  |  |    } | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |    //! <b>Effects</b>: Assigns the the range [first, last) to *this.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Throws</b>: If memory allocation throws or T's copy/move constructor/assignment or
 | 
					
						
							|  |  |  |    //!   T's constructor/assignment from dereferencing InpIt throws.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Complexity</b>: Linear to n.
 | 
					
						
							|  |  |  |    template <class FwdIt> | 
					
						
							|  |  |  |    void assign(FwdIt first, FwdIt last | 
					
						
							| 
									
										
										
										
											2014-09-20 17:28:41 +02:00
										 |  |  |       BOOST_CONTAINER_DOCIGN(BOOST_CONTAINER_I typename container_detail::enable_if_c | 
					
						
							|  |  |  |          < !container_detail::is_convertible<FwdIt BOOST_CONTAINER_I size_type>::value && | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |             ( !container_detail::is_input_iterator<FwdIt>::value && | 
					
						
							| 
									
										
										
										
											2014-09-20 17:28:41 +02:00
										 |  |  |               !container_detail::is_same<alloc_version BOOST_CONTAINER_I allocator_v0>::value ) | 
					
						
							|  |  |  |          >::type * = 0) | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |       ) | 
					
						
							|  |  |  |    { | 
					
						
							| 
									
										
										
										
											2014-04-21 13:59:49 +02:00
										 |  |  |       //For Fwd iterators the standard only requires EmplaceConstructible and assignable from *first
 | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |       //so we can't do any backwards allocation
 | 
					
						
							| 
									
										
										
										
											2014-11-26 07:08:06 +01:00
										 |  |  |       const size_type input_sz = static_cast<size_type>(boost::container::iterator_distance(first, last)); | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |       const size_type old_capacity = this->capacity(); | 
					
						
							|  |  |  |       if(input_sz > old_capacity){  //If input range is too big, we need to reallocate
 | 
					
						
							| 
									
										
										
										
											2014-05-28 15:50:13 +02:00
										 |  |  |          size_type real_cap = 0; | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |          std::pair<pointer, bool> ret = | 
					
						
							| 
									
										
										
										
											2014-09-20 17:28:41 +02:00
										 |  |  |             this->m_holder.allocation_command(allocate_new|expand_fwd, input_sz, input_sz, real_cap, this->m_holder.start()); | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |          if(!ret.second){  //New allocation, just emplace new values
 | 
					
						
							| 
									
										
										
										
											2014-09-20 17:28:41 +02:00
										 |  |  |             #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
 | 
					
						
							|  |  |  |             ++this->num_alloc; | 
					
						
							|  |  |  |             #endif
 | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |             pointer const old_p = this->m_holder.start(); | 
					
						
							|  |  |  |             if(old_p){ | 
					
						
							|  |  |  |                this->priv_destroy_all(); | 
					
						
							|  |  |  |                this->m_holder.alloc().deallocate(old_p, old_capacity); | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |             this->m_holder.start(ret.first); | 
					
						
							|  |  |  |             this->m_holder.capacity(real_cap); | 
					
						
							|  |  |  |             this->m_holder.m_size = 0; | 
					
						
							|  |  |  |             this->priv_uninitialized_construct_at_end(first, last); | 
					
						
							|  |  |  |             return; | 
					
						
							|  |  |  |          } | 
					
						
							| 
									
										
										
										
											2014-05-28 15:50:13 +02:00
										 |  |  |          else{ | 
					
						
							| 
									
										
										
										
											2014-09-20 17:28:41 +02:00
										 |  |  |             #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
 | 
					
						
							|  |  |  |             ++this->num_expand_fwd; | 
					
						
							|  |  |  |             #endif
 | 
					
						
							| 
									
										
										
										
											2014-09-21 23:57:23 +02:00
										 |  |  |             this->m_holder.capacity(real_cap); | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |             //Forward expansion, use assignment + back deletion/construction that comes later
 | 
					
						
							|  |  |  |          } | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       //Overwrite all elements we can from [first, last)
 | 
					
						
							|  |  |  |       iterator cur = this->begin(); | 
					
						
							|  |  |  |       const iterator end_it = this->end(); | 
					
						
							|  |  |  |       for ( ; first != last && cur != end_it; ++cur, ++first){ | 
					
						
							|  |  |  |          *cur = *first; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       if (first == last){ | 
					
						
							|  |  |  |          //There are no more elements in the sequence, erase remaining
 | 
					
						
							|  |  |  |          this->priv_destroy_last_n(this->size() - input_sz); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       else{ | 
					
						
							|  |  |  |          //Uninitialized construct at end the remaining range
 | 
					
						
							|  |  |  |          this->priv_uninitialized_construct_at_end(first, last); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  |    //! <b>Effects</b>: Assigns the n copies of val to *this.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <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) | 
					
						
							|  |  |  |    {  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.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Complexity</b>: Constant.
 | 
					
						
							|  |  |  |    allocator_type get_allocator() const BOOST_CONTAINER_NOEXCEPT | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |    { return this->m_holder.alloc();  } | 
					
						
							| 
									
										
										
										
											2012-09-28 21:07:02 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  |    //! <b>Effects</b>: Returns a reference to the internal allocator.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Throws</b>: Nothing
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Complexity</b>: Constant.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Note</b>: Non-standard extension.
 | 
					
						
							| 
									
										
										
										
											2012-09-28 21:07:02 +00:00
										 |  |  |    stored_allocator_type &get_stored_allocator() BOOST_CONTAINER_NOEXCEPT | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |    {  return this->m_holder.alloc(); } | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |    //! <b>Effects</b>: Returns a reference to the internal allocator.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Throws</b>: Nothing
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Complexity</b>: Constant.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Note</b>: Non-standard extension.
 | 
					
						
							| 
									
										
										
										
											2012-09-28 21:07:02 +00:00
										 |  |  |    const stored_allocator_type &get_stored_allocator() const BOOST_CONTAINER_NOEXCEPT | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |    {  return this->m_holder.alloc(); } | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |    //////////////////////////////////////////////
 | 
					
						
							|  |  |  |    //
 | 
					
						
							|  |  |  |    //                iterators
 | 
					
						
							|  |  |  |    //
 | 
					
						
							|  |  |  |    //////////////////////////////////////////////
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //! <b>Effects</b>: Returns an iterator to the first element contained in the vector.
 | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //! <b>Throws</b>: Nothing.
 | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //! <b>Complexity</b>: Constant.
 | 
					
						
							| 
									
										
										
										
											2011-12-22 20:08:24 +00:00
										 |  |  |    iterator begin() BOOST_CONTAINER_NOEXCEPT | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |    { return iterator(this->m_holder.start()); } | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |    //! <b>Effects</b>: Returns a const_iterator to the first element contained in the vector.
 | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //! <b>Throws</b>: Nothing.
 | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //! <b>Complexity</b>: Constant.
 | 
					
						
							| 
									
										
										
										
											2011-12-22 20:08:24 +00:00
										 |  |  |    const_iterator begin() const BOOST_CONTAINER_NOEXCEPT | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |    { return const_iterator(this->m_holder.start()); } | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |    //! <b>Effects</b>: Returns an iterator to the end of the vector.
 | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //! <b>Throws</b>: Nothing.
 | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //! <b>Complexity</b>: Constant.
 | 
					
						
							| 
									
										
										
										
											2011-12-22 20:08:24 +00:00
										 |  |  |    iterator end() BOOST_CONTAINER_NOEXCEPT | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |    { return iterator(this->m_holder.start() + this->m_holder.m_size); } | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |    //! <b>Effects</b>: Returns a const_iterator to the end of the vector.
 | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //! <b>Throws</b>: Nothing.
 | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //! <b>Complexity</b>: Constant.
 | 
					
						
							| 
									
										
										
										
											2011-12-22 20:08:24 +00:00
										 |  |  |    const_iterator end() const BOOST_CONTAINER_NOEXCEPT | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    { return this->cend(); } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  |    //! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning
 | 
					
						
							|  |  |  |    //! of the reversed vector.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //! <b>Throws</b>: Nothing.
 | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //! <b>Complexity</b>: Constant.
 | 
					
						
							| 
									
										
										
										
											2011-12-22 20:08:24 +00:00
										 |  |  |    reverse_iterator rbegin() BOOST_CONTAINER_NOEXCEPT | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    { return reverse_iterator(this->end());      } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  |    //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
 | 
					
						
							|  |  |  |    //! of the reversed vector.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //! <b>Throws</b>: Nothing.
 | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //! <b>Complexity</b>: Constant.
 | 
					
						
							| 
									
										
										
										
											2011-12-22 20:08:24 +00:00
										 |  |  |    const_reverse_iterator rbegin() const BOOST_CONTAINER_NOEXCEPT | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    { return this->crbegin(); } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    //! <b>Effects</b>: Returns a reverse_iterator pointing to the end
 | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  |    //! of the reversed vector.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //! <b>Throws</b>: Nothing.
 | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //! <b>Complexity</b>: Constant.
 | 
					
						
							| 
									
										
										
										
											2011-12-22 20:08:24 +00:00
										 |  |  |    reverse_iterator rend() BOOST_CONTAINER_NOEXCEPT | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    { return reverse_iterator(this->begin());       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
 | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  |    //! of the reversed vector.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //! <b>Throws</b>: Nothing.
 | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //! <b>Complexity</b>: Constant.
 | 
					
						
							| 
									
										
										
										
											2011-12-22 20:08:24 +00:00
										 |  |  |    const_reverse_iterator rend() const BOOST_CONTAINER_NOEXCEPT | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    { return this->crend(); } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    //! <b>Effects</b>: Returns a const_iterator to the first element contained in the vector.
 | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //! <b>Throws</b>: Nothing.
 | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //! <b>Complexity</b>: Constant.
 | 
					
						
							| 
									
										
										
										
											2011-12-22 20:08:24 +00:00
										 |  |  |    const_iterator cbegin() const BOOST_CONTAINER_NOEXCEPT | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |    { return const_iterator(this->m_holder.start()); } | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |    //! <b>Effects</b>: Returns a const_iterator to the end of the vector.
 | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //! <b>Throws</b>: Nothing.
 | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //! <b>Complexity</b>: Constant.
 | 
					
						
							| 
									
										
										
										
											2011-12-22 20:08:24 +00:00
										 |  |  |    const_iterator cend() const BOOST_CONTAINER_NOEXCEPT | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |    { return const_iterator(this->m_holder.start() + this->m_holder.m_size); } | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  |    //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
 | 
					
						
							|  |  |  |    //! of the reversed vector.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //! <b>Throws</b>: Nothing.
 | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //! <b>Complexity</b>: Constant.
 | 
					
						
							| 
									
										
										
										
											2011-12-22 20:08:24 +00:00
										 |  |  |    const_reverse_iterator crbegin() const BOOST_CONTAINER_NOEXCEPT | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    { return const_reverse_iterator(this->end());} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
 | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  |    //! of the reversed vector.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //! <b>Throws</b>: Nothing.
 | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //! <b>Complexity</b>: Constant.
 | 
					
						
							| 
									
										
										
										
											2011-12-22 20:08:24 +00:00
										 |  |  |    const_reverse_iterator crend() const BOOST_CONTAINER_NOEXCEPT | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    { return const_reverse_iterator(this->begin()); } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  |    //////////////////////////////////////////////
 | 
					
						
							|  |  |  |    //
 | 
					
						
							|  |  |  |    //                capacity
 | 
					
						
							|  |  |  |    //
 | 
					
						
							|  |  |  |    //////////////////////////////////////////////
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  |    //! <b>Effects</b>: Returns true if the vector contains no elements.
 | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //! <b>Throws</b>: Nothing.
 | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //! <b>Complexity</b>: Constant.
 | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  |    bool empty() const BOOST_CONTAINER_NOEXCEPT | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |    { return !this->m_holder.m_size; } | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |    //! <b>Effects</b>: Returns the number of the elements contained in the vector.
 | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //! <b>Throws</b>: Nothing.
 | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //! <b>Complexity</b>: Constant.
 | 
					
						
							| 
									
										
										
										
											2011-12-22 20:08:24 +00:00
										 |  |  |    size_type size() const BOOST_CONTAINER_NOEXCEPT | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |    { return this->m_holder.m_size; } | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |    //! <b>Effects</b>: Returns the largest possible size of the vector.
 | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //! <b>Throws</b>: Nothing.
 | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //! <b>Complexity</b>: Constant.
 | 
					
						
							| 
									
										
										
										
											2011-12-22 20:08:24 +00:00
										 |  |  |    size_type max_size() const BOOST_CONTAINER_NOEXCEPT | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |    { return allocator_traits_type::max_size(this->m_holder.alloc()); } | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  |    //! <b>Effects</b>: Inserts or erases elements at the end such that
 | 
					
						
							| 
									
										
										
										
											2013-09-26 18:05:25 +00:00
										 |  |  |    //!   the size becomes n. New elements are value initialized.
 | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2014-04-17 00:06:59 +02:00
										 |  |  |    //! <b>Throws</b>: If memory allocation throws, or T's copy/move or value initialization throws.
 | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  |    //! <b>Complexity</b>: Linear to the difference between size() and new_size.
 | 
					
						
							|  |  |  |    void resize(size_type new_size) | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |    {  this->priv_resize(new_size, value_init);  } | 
					
						
							| 
									
										
										
										
											2013-09-26 18:05:25 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |    //! <b>Effects</b>: Inserts or erases elements at the end such that
 | 
					
						
							| 
									
										
										
										
											2014-04-21 13:59:49 +02:00
										 |  |  |    //!   the size becomes n. New elements are default initialized.
 | 
					
						
							| 
									
										
										
										
											2013-09-26 18:05:25 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2014-04-17 00:06:59 +02:00
										 |  |  |    //! <b>Throws</b>: If memory allocation throws, or T's copy/move or default initialization throws.
 | 
					
						
							| 
									
										
										
										
											2013-09-26 18:05:25 +00:00
										 |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Complexity</b>: Linear to the difference between size() and new_size.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Note</b>: Non-standard extension
 | 
					
						
							|  |  |  |    void resize(size_type new_size, default_init_t) | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |    {  this->priv_resize(new_size, default_init);  } | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  |    //! <b>Effects</b>: Inserts or erases elements at the end such that
 | 
					
						
							|  |  |  |    //!   the size becomes n. New elements are copy constructed from x.
 | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2014-04-17 00:06:59 +02:00
										 |  |  |    //! <b>Throws</b>: If memory allocation throws, or T's copy/move constructor throws.
 | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  |    //! <b>Complexity</b>: Linear to the difference between size() and new_size.
 | 
					
						
							|  |  |  |    void resize(size_type new_size, const T& x) | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |    {  this->priv_resize(new_size, x);  } | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  |    //! <b>Effects</b>: Number of elements for which memory has been allocated.
 | 
					
						
							|  |  |  |    //!   capacity() is always greater than or equal to size().
 | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //! <b>Throws</b>: Nothing.
 | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //! <b>Complexity</b>: Constant.
 | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  |    size_type capacity() const BOOST_CONTAINER_NOEXCEPT | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |    { return this->m_holder.capacity(); } | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |    //! <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.
 | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //! <b>Throws</b>: If memory allocation allocation throws or T's copy/move constructor throws.
 | 
					
						
							|  |  |  |    void reserve(size_type new_cap) | 
					
						
							|  |  |  |    { | 
					
						
							|  |  |  |       if (this->capacity() < new_cap){ | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |          this->priv_reserve(new_cap, alloc_version()); | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |       } | 
					
						
							|  |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  |    //! <b>Effects</b>: Tries to deallocate the excess of memory created
 | 
					
						
							|  |  |  |    //!   with previous allocations. The size of the vector is unchanged
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  |    //! <b>Throws</b>: If memory allocation throws, or T's copy/move constructor throws.
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  |    //! <b>Complexity</b>: Linear to size().
 | 
					
						
							|  |  |  |    void shrink_to_fit() | 
					
						
							| 
									
										
										
										
											2012-09-28 21:07:02 +00:00
										 |  |  |    {  this->priv_shrink_to_fit(alloc_version());   } | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |    //////////////////////////////////////////////
 | 
					
						
							|  |  |  |    //
 | 
					
						
							|  |  |  |    //               element access
 | 
					
						
							|  |  |  |    //
 | 
					
						
							|  |  |  |    //////////////////////////////////////////////
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    //! <b>Requires</b>: !empty()
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  |    //! <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 | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |    { return *this->m_holder.start(); } | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |    //! <b>Requires</b>: !empty()
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <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 | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |    { return *this->m_holder.start(); } | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |    //! <b>Requires</b>: !empty()
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <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 | 
					
						
							| 
									
										
										
										
											2014-11-01 20:03:25 +01:00
										 |  |  |    { | 
					
						
							|  |  |  |       BOOST_ASSERT(this->m_holder.m_size > 0); | 
					
						
							|  |  |  |       return this->m_holder.start()[this->m_holder.m_size - 1]; | 
					
						
							|  |  |  |    } | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |    //! <b>Requires</b>: !empty()
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <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 | 
					
						
							| 
									
										
										
										
											2014-11-01 20:03:25 +01:00
										 |  |  |    { | 
					
						
							|  |  |  |       BOOST_ASSERT(this->m_holder.m_size > 0); | 
					
						
							|  |  |  |       return this->m_holder.start()[this->m_holder.m_size - 1]; | 
					
						
							|  |  |  |    } | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |    //! <b>Requires</b>: size() > n.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Effects</b>: Returns a reference to the nth element
 | 
					
						
							|  |  |  |    //!   from the beginning of the container.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Throws</b>: Nothing.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Complexity</b>: Constant.
 | 
					
						
							| 
									
										
										
										
											2012-11-24 21:08:18 +00:00
										 |  |  |    reference operator[](size_type n) BOOST_CONTAINER_NOEXCEPT | 
					
						
							| 
									
										
										
										
											2014-11-01 20:03:25 +01:00
										 |  |  |    { | 
					
						
							|  |  |  |       BOOST_ASSERT(this->m_holder.m_size > n); | 
					
						
							|  |  |  |       return this->m_holder.start()[n]; | 
					
						
							|  |  |  |    } | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  |    //! <b>Requires</b>: size() > n.
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  |    //! <b>Effects</b>: Returns a const reference to the nth element
 | 
					
						
							|  |  |  |    //!   from the beginning of the container.
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  |    //! <b>Throws</b>: Nothing.
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  |    //! <b>Complexity</b>: Constant.
 | 
					
						
							|  |  |  |    const_reference operator[](size_type n) const BOOST_CONTAINER_NOEXCEPT | 
					
						
							| 
									
										
										
										
											2014-11-01 20:03:25 +01:00
										 |  |  |    { | 
					
						
							|  |  |  |        return this->m_holder.start()[n]; | 
					
						
							|  |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    //! <b>Requires</b>: size() >= n.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Effects</b>: Returns an iterator to the nth element
 | 
					
						
							|  |  |  |    //!   from the beginning of the container. Returns end()
 | 
					
						
							|  |  |  |    //!   if n == size().
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Throws</b>: Nothing.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Complexity</b>: Constant.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Note</b>: Non-standard extension
 | 
					
						
							|  |  |  |    iterator nth(size_type n) BOOST_CONTAINER_NOEXCEPT | 
					
						
							|  |  |  |    { | 
					
						
							|  |  |  |       BOOST_ASSERT(this->m_holder.m_size >= n); | 
					
						
							|  |  |  |       return iterator(this->m_holder.start()+n); | 
					
						
							|  |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    //! <b>Requires</b>: size() >= n.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Effects</b>: Returns a const_iterator to the nth element
 | 
					
						
							|  |  |  |    //!   from the beginning of the container. Returns end()
 | 
					
						
							|  |  |  |    //!   if n == size().
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Throws</b>: Nothing.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Complexity</b>: Constant.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Note</b>: Non-standard extension
 | 
					
						
							|  |  |  |    const_iterator nth(size_type n) const BOOST_CONTAINER_NOEXCEPT | 
					
						
							|  |  |  |    { | 
					
						
							|  |  |  |       BOOST_ASSERT(this->m_holder.m_size >= n); | 
					
						
							|  |  |  |       return const_iterator(this->m_holder.start()+n); | 
					
						
							|  |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    //! <b>Requires</b>: size() >= n.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Effects</b>: Returns an iterator to the nth element
 | 
					
						
							|  |  |  |    //!   from the beginning of the container. Returns end()
 | 
					
						
							|  |  |  |    //!   if n == size().
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Throws</b>: Nothing.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Complexity</b>: Constant.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Note</b>: Non-standard extension
 | 
					
						
							|  |  |  |    size_type index_of(iterator p) BOOST_CONTAINER_NOEXCEPT | 
					
						
							|  |  |  |    {  return this->priv_index_of(vector_iterator_get_ptr(p));  } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    //! <b>Requires</b>: begin() <= p <= end().
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <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.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Note</b>: Non-standard extension
 | 
					
						
							|  |  |  |    size_type index_of(const_iterator p) const BOOST_CONTAINER_NOEXCEPT | 
					
						
							|  |  |  |    {  return this->priv_index_of(vector_iterator_get_ptr(p));  } | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  |    //! <b>Requires</b>: size() > n.
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  |    //! <b>Effects</b>: Returns a reference to the nth element
 | 
					
						
							|  |  |  |    //!   from the beginning of the container.
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  |    //! <b>Throws</b>: std::range_error if n >= size()
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Complexity</b>: Constant.
 | 
					
						
							|  |  |  |    reference at(size_type n) | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |    { this->priv_check_range(n); return this->m_holder.start()[n]; } | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  |    //! <b>Requires</b>: size() > n.
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  |    //! <b>Effects</b>: Returns a const reference to the nth element
 | 
					
						
							|  |  |  |    //!   from the beginning of the container.
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  |    //! <b>Throws</b>: std::range_error if n >= size()
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Complexity</b>: Constant.
 | 
					
						
							|  |  |  |    const_reference at(size_type n) const | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |    { this->priv_check_range(n); return this->m_holder.start()[n]; } | 
					
						
							| 
									
										
										
										
											2012-09-01 11:01:03 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  |    //////////////////////////////////////////////
 | 
					
						
							|  |  |  |    //
 | 
					
						
							|  |  |  |    //                 data access
 | 
					
						
							|  |  |  |    //
 | 
					
						
							|  |  |  |    //////////////////////////////////////////////
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-30 20:38:04 +00:00
										 |  |  |    //! <b>Returns</b>: Allocator pointer such that [data(),data() + size()) is a valid range.
 | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  |    //!   For a non-empty vector, data() == &front().
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  |    //! <b>Throws</b>: Nothing.
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  |    //! <b>Complexity</b>: Constant.
 | 
					
						
							|  |  |  |    T* data() BOOST_CONTAINER_NOEXCEPT | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |    { return container_detail::to_raw_pointer(this->m_holder.start()); } | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-30 20:38:04 +00:00
										 |  |  |    //! <b>Returns</b>: Allocator pointer such that [data(),data() + size()) is a valid range.
 | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  |    //!   For a non-empty vector, data() == &front().
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  |    //! <b>Throws</b>: Nothing.
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  |    //! <b>Complexity</b>: Constant.
 | 
					
						
							|  |  |  |    const T * data()  const BOOST_CONTAINER_NOEXCEPT | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |    { return container_detail::to_raw_pointer(this->m_holder.start()); } | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |    //////////////////////////////////////////////
 | 
					
						
							|  |  |  |    //
 | 
					
						
							|  |  |  |    //                modifiers
 | 
					
						
							|  |  |  |    //
 | 
					
						
							|  |  |  |    //////////////////////////////////////////////
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-22 20:08:24 +00:00
										 |  |  |    #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //! <b>Effects</b>: Inserts an object of type T constructed with
 | 
					
						
							|  |  |  |    //!   std::forward<Args>(args)... in the end of the vector.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2011-12-22 20:08:24 +00:00
										 |  |  |    //! <b>Throws</b>: If memory allocation throws or the in-place constructor throws or
 | 
					
						
							| 
									
										
										
										
											2014-04-17 00:06:59 +02:00
										 |  |  |    //!   T's copy/move constructor throws.
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Complexity</b>: Amortized constant time.
 | 
					
						
							|  |  |  |    template<class ...Args> | 
					
						
							|  |  |  |    void emplace_back(Args &&...args) | 
					
						
							|  |  |  |    { | 
					
						
							| 
									
										
										
										
											2014-09-26 08:12:40 +02:00
										 |  |  |       if (BOOST_LIKELY(this->m_holder.m_size < this->m_holder.capacity())){ | 
					
						
							| 
									
										
										
										
											2014-09-17 21:52:34 +02:00
										 |  |  |          T* const back_pos = container_detail::to_raw_pointer(this->m_holder.start()) + this->m_holder.m_size; | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |          //There is more memory, just construct a new object at the end
 | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |          allocator_traits_type::construct(this->m_holder.alloc(), back_pos, ::boost::forward<Args>(args)...); | 
					
						
							|  |  |  |          ++this->m_holder.m_size; | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |       } | 
					
						
							|  |  |  |       else{ | 
					
						
							| 
									
										
										
										
											2012-11-24 21:08:18 +00:00
										 |  |  |          typedef container_detail::insert_emplace_proxy<Allocator, T*, Args...> type; | 
					
						
							| 
									
										
										
										
											2013-02-24 13:13:36 +00:00
										 |  |  |          this->priv_forward_range_insert_no_capacity | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |             (vector_iterator_get_ptr(this->cend()), 1, type(::boost::forward<Args>(args)...), alloc_version()); | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |       } | 
					
						
							|  |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    //! <b>Requires</b>: position must be a valid iterator of *this.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Effects</b>: Inserts an object of type T constructed with
 | 
					
						
							|  |  |  |    //!   std::forward<Args>(args)... before position
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2011-12-22 20:08:24 +00:00
										 |  |  |    //! <b>Throws</b>: If memory allocation throws or the in-place constructor throws or
 | 
					
						
							| 
									
										
										
										
											2014-04-17 00:06:59 +02:00
										 |  |  |    //!   T's copy/move constructor/assignment throws.
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Complexity</b>: If position is end(), amortized constant time
 | 
					
						
							|  |  |  |    //!   Linear time otherwise.
 | 
					
						
							|  |  |  |    template<class ...Args> | 
					
						
							|  |  |  |    iterator emplace(const_iterator position, Args && ...args) | 
					
						
							|  |  |  |    { | 
					
						
							|  |  |  |       //Just call more general insert(pos, size, value) and return iterator
 | 
					
						
							| 
									
										
										
										
											2012-11-24 21:08:18 +00:00
										 |  |  |       typedef container_detail::insert_emplace_proxy<Allocator, T*, Args...> type; | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |       return this->priv_forward_range_insert( vector_iterator_get_ptr(position), 1 | 
					
						
							|  |  |  |                                             , type(::boost::forward<Args>(args)...), alloc_version()); | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    #else
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |    #define BOOST_PP_LOCAL_MACRO(n)                                                                    \
 | 
					
						
							|  |  |  |    BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >)             \ | 
					
						
							|  |  |  |    void emplace_back(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _))                              \ | 
					
						
							|  |  |  |    {                                                                                                  \ | 
					
						
							| 
									
										
										
										
											2014-09-17 21:52:34 +02:00
										 |  |  |       T* const back_pos = container_detail::to_raw_pointer                                            \ | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |          (this->m_holder.start()) + this->m_holder.m_size;                                            \ | 
					
						
							| 
									
										
										
										
											2014-11-09 21:06:36 +01:00
										 |  |  |       if (BOOST_LIKELY(this->m_holder.m_size < this->m_holder.capacity())){                           \ | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |          allocator_traits_type::construct (this->m_holder.alloc()                                     \ | 
					
						
							|  |  |  |             , back_pos BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) );              \ | 
					
						
							|  |  |  |          ++this->m_holder.m_size;                                                                     \ | 
					
						
							|  |  |  |       }                                                                                               \ | 
					
						
							|  |  |  |       else{                                                                                           \ | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |          typedef container_detail::BOOST_PP_CAT(insert_emplace_proxy_arg, n)                          \ | 
					
						
							|  |  |  |             <Allocator, T* BOOST_PP_ENUM_TRAILING_PARAMS(n, P)> type;                                 \ | 
					
						
							| 
									
										
										
										
											2013-02-24 13:13:36 +00:00
										 |  |  |          this->priv_forward_range_insert_no_capacity                                                  \ | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |             ( vector_iterator_get_ptr(this->cend()), 1                                                \ | 
					
						
							|  |  |  |             , type(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)), alloc_version());          \ | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |       }                                                                                               \ | 
					
						
							|  |  |  |    }                                                                                                  \ | 
					
						
							|  |  |  |                                                                                                       \ | 
					
						
							|  |  |  |    BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >)             \ | 
					
						
							|  |  |  |    iterator emplace(const_iterator pos                                                                \ | 
					
						
							|  |  |  |                     BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _))                      \ | 
					
						
							|  |  |  |    {                                                                                                  \ | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |       typedef container_detail::BOOST_PP_CAT(insert_emplace_proxy_arg, n)                             \ | 
					
						
							|  |  |  |          <Allocator, T* BOOST_PP_ENUM_TRAILING_PARAMS(n, P)> type;                                    \ | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |       return this->priv_forward_range_insert                                                          \ | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |          ( container_detail::to_raw_pointer(vector_iterator_get_ptr(pos)), 1                          \ | 
					
						
							|  |  |  |          , type(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)), alloc_version());             \ | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |    }                                                                                                  \ | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2011-12-22 20:08:24 +00:00
										 |  |  |    #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    #include BOOST_PP_LOCAL_ITERATE()
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-22 20:08:24 +00:00
										 |  |  |    #endif   //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |    #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 | 
					
						
							|  |  |  |    //! <b>Effects</b>: Inserts a copy of x at the end of the vector.
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  |    //! <b>Throws</b>: If memory allocation throws or
 | 
					
						
							|  |  |  |    //!   T's copy/move constructor throws.
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  |    //! <b>Complexity</b>: Amortized constant time.
 | 
					
						
							|  |  |  |    void push_back(const T &x); | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  |    //! <b>Effects</b>: Constructs a new element in the end of the vector
 | 
					
						
							| 
									
										
										
										
											2014-04-17 00:06:59 +02:00
										 |  |  |    //!   and moves the resources of x to this new element.
 | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Throws</b>: If memory allocation throws or
 | 
					
						
							| 
									
										
										
										
											2014-04-17 00:06:59 +02:00
										 |  |  |    //!   T's copy/move constructor throws.
 | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Complexity</b>: Amortized constant time.
 | 
					
						
							|  |  |  |    void push_back(T &&x); | 
					
						
							|  |  |  |    #else
 | 
					
						
							|  |  |  |    BOOST_MOVE_CONVERSION_AWARE_CATCH(push_back, T, void, priv_push_back) | 
					
						
							|  |  |  |    #endif
 | 
					
						
							| 
									
										
										
										
											2014-05-28 15:50:13 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 | 
					
						
							|  |  |  |    //! <b>Requires</b>: position must be a valid iterator of *this.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Effects</b>: Insert a copy of x before position.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2011-12-22 20:08:24 +00:00
										 |  |  |    //! <b>Throws</b>: If memory allocation throws or T's copy/move constructor/assignment throws.
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Complexity</b>: If position is end(), amortized constant time
 | 
					
						
							|  |  |  |    //!   Linear time otherwise.
 | 
					
						
							|  |  |  |    iterator insert(const_iterator position, const T &x); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    //! <b>Requires</b>: position must be a valid iterator of *this.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2014-04-21 13:59:49 +02:00
										 |  |  |    //! <b>Effects</b>: Insert a new element before position with x's resources.
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Throws</b>: If memory allocation throws.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Complexity</b>: If position is end(), amortized constant time
 | 
					
						
							|  |  |  |    //!   Linear time otherwise.
 | 
					
						
							|  |  |  |    iterator insert(const_iterator position, T &&x); | 
					
						
							|  |  |  |    #else
 | 
					
						
							| 
									
										
										
										
											2013-09-12 22:00:51 +00:00
										 |  |  |    BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert, T, iterator, priv_insert, const_iterator, const_iterator) | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  |    //! <b>Requires</b>: p must be a valid iterator of *this.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Effects</b>: Insert n copies of x before pos.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Returns</b>: an iterator to the first inserted element or p if n is 0.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2014-04-17 00:06:59 +02:00
										 |  |  |    //! <b>Throws</b>: If memory allocation throws or T's copy/move constructor throws.
 | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Complexity</b>: Linear to n.
 | 
					
						
							|  |  |  |    iterator insert(const_iterator p, size_type n, const T& x) | 
					
						
							| 
									
										
										
										
											2012-11-24 21:08:18 +00:00
										 |  |  |    { | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |       container_detail::insert_n_copies_proxy<Allocator, T*> proxy(x); | 
					
						
							| 
									
										
										
										
											2013-02-24 20:34:15 +00:00
										 |  |  |       return this->priv_forward_range_insert(vector_iterator_get_ptr(p), n, proxy, alloc_version()); | 
					
						
							| 
									
										
										
										
											2012-11-24 21:08:18 +00:00
										 |  |  |    } | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-01 11:01:03 +00:00
										 |  |  |    //! <b>Requires</b>: p must be a valid iterator of *this.
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Effects</b>: Insert a copy of the [first, last) range before pos.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2012-09-01 11:01:03 +00:00
										 |  |  |    //! <b>Returns</b>: an iterator to the first inserted element or pos if first == last.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //! <b>Throws</b>: If memory allocation throws, T's constructor from a
 | 
					
						
							| 
									
										
										
										
											2011-12-22 20:08:24 +00:00
										 |  |  |    //!   dereferenced InpIt throws or T's copy/move constructor/assignment throws.
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2014-11-26 07:08:06 +01:00
										 |  |  |    //! <b>Complexity</b>: Linear to boost::container::iterator_distance [first, last).
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    template <class InIt> | 
					
						
							| 
									
										
										
										
											2012-09-01 11:01:03 +00:00
										 |  |  |    iterator insert(const_iterator pos, InIt first, InIt last | 
					
						
							| 
									
										
										
										
											2014-09-20 17:28:41 +02:00
										 |  |  |       BOOST_CONTAINER_DOCIGN(BOOST_CONTAINER_I typename container_detail::enable_if_c | 
					
						
							|  |  |  |          < !container_detail::is_convertible<InIt BOOST_CONTAINER_I size_type>::value | 
					
						
							| 
									
										
										
										
											2012-09-01 11:01:03 +00:00
										 |  |  |             && container_detail::is_input_iterator<InIt>::value | 
					
						
							| 
									
										
										
										
											2014-09-20 17:28:41 +02:00
										 |  |  |          >::type * = 0) | 
					
						
							| 
									
										
										
										
											2012-09-01 11:01:03 +00:00
										 |  |  |       ) | 
					
						
							|  |  |  |    { | 
					
						
							|  |  |  |       const size_type n_pos = pos - this->cbegin(); | 
					
						
							| 
									
										
										
										
											2013-02-24 20:34:15 +00:00
										 |  |  |       iterator it(vector_iterator_get_ptr(pos)); | 
					
						
							| 
									
										
										
										
											2012-09-01 11:01:03 +00:00
										 |  |  |       for(;first != last; ++first){ | 
					
						
							|  |  |  |          it = this->emplace(it, *first); | 
					
						
							|  |  |  |          ++it; | 
					
						
							|  |  |  |       } | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |       return iterator(this->m_holder.start() + n_pos); | 
					
						
							| 
									
										
										
										
											2012-09-01 11:01:03 +00:00
										 |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 | 
					
						
							|  |  |  |    template <class FwdIt> | 
					
						
							|  |  |  |    iterator insert(const_iterator pos, FwdIt first, FwdIt last | 
					
						
							|  |  |  |       , typename container_detail::enable_if_c | 
					
						
							|  |  |  |          < !container_detail::is_convertible<FwdIt, size_type>::value | 
					
						
							|  |  |  |             && !container_detail::is_input_iterator<FwdIt>::value | 
					
						
							|  |  |  |          >::type * = 0 | 
					
						
							|  |  |  |       ) | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    { | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |       container_detail::insert_range_proxy<Allocator, FwdIt, T*> proxy(first); | 
					
						
							| 
									
										
										
										
											2014-11-26 07:08:06 +01:00
										 |  |  |       return this->priv_forward_range_insert(vector_iterator_get_ptr(pos), boost::container::iterator_distance(first, last), proxy, alloc_version()); | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    } | 
					
						
							| 
									
										
										
										
											2012-09-01 11:01:03 +00:00
										 |  |  |    #endif
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-04-23 23:18:18 +02:00
										 |  |  |    //! <b>Requires</b>: p must be a valid iterator of *this. num, must
 | 
					
						
							| 
									
										
										
										
											2014-11-26 07:08:06 +01:00
										 |  |  |    //!   be equal to boost::container::iterator_distance(first, last)
 | 
					
						
							| 
									
										
										
										
											2014-04-23 23:18:18 +02:00
										 |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Effects</b>: Insert a copy of the [first, last) range before pos.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Returns</b>: an iterator to the first inserted element or pos if first == last.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Throws</b>: If memory allocation throws, T's constructor from a
 | 
					
						
							|  |  |  |    //!   dereferenced InpIt throws or T's copy/move constructor/assignment throws.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2014-11-26 07:08:06 +01:00
										 |  |  |    //! <b>Complexity</b>: Linear to boost::container::iterator_distance [first, last).
 | 
					
						
							| 
									
										
										
										
											2014-04-23 23:18:18 +02:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2014-11-26 07:08:06 +01:00
										 |  |  |    //! <b>Note</b>: This function avoids a linear operation to calculate boost::container::iterator_distance[first, last)
 | 
					
						
							| 
									
										
										
										
											2014-04-23 23:18:18 +02:00
										 |  |  |    //!   for forward and bidirectional iterators, and a one by one insertion for input iterators. This is a
 | 
					
						
							|  |  |  |    //!   a non-standard extension.
 | 
					
						
							|  |  |  |    #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 | 
					
						
							|  |  |  |    template <class InIt> | 
					
						
							|  |  |  |    iterator insert(const_iterator pos, size_type num, InIt first, InIt last) | 
					
						
							|  |  |  |    { | 
					
						
							|  |  |  |       BOOST_ASSERT(container_detail::is_input_iterator<InIt>::value || | 
					
						
							| 
									
										
										
										
											2014-11-26 07:08:06 +01:00
										 |  |  |                    num == static_cast<size_type>(boost::container::iterator_distance(first, last))); | 
					
						
							| 
									
										
										
										
											2014-09-22 22:31:34 +02:00
										 |  |  |       (void)last; | 
					
						
							| 
									
										
										
										
											2014-04-23 23:18:18 +02:00
										 |  |  |       container_detail::insert_range_proxy<Allocator, InIt, T*> proxy(first); | 
					
						
							|  |  |  |       return this->priv_forward_range_insert(vector_iterator_get_ptr(pos), num, proxy, alloc_version()); | 
					
						
							|  |  |  |    } | 
					
						
							|  |  |  |    #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-08-15 20:15:01 +02:00
										 |  |  | #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
 | 
					
						
							|  |  |  |    //! <b>Requires</b>: position must be a valid iterator of *this.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Effects</b>: Insert a copy of the [il.begin(), il.end()) range before position.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Returns</b>: an iterator to the first inserted element or position if first == last.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Complexity</b>: Linear to the range [il.begin(), il.end()).
 | 
					
						
							|  |  |  |    iterator insert(const_iterator position, std::initializer_list<value_type> il) | 
					
						
							|  |  |  |    { | 
					
						
							|  |  |  |       return insert(position, il.begin(), il.end()); | 
					
						
							|  |  |  |    } | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //! <b>Effects</b>: Removes the last element from the vector.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Throws</b>: Nothing.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Complexity</b>: Constant time.
 | 
					
						
							| 
									
										
										
										
											2012-11-24 21:08:18 +00:00
										 |  |  |    void pop_back() BOOST_CONTAINER_NOEXCEPT | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    { | 
					
						
							|  |  |  |       //Destroy last element
 | 
					
						
							| 
									
										
										
										
											2014-09-21 23:57:23 +02:00
										 |  |  |       this->priv_destroy_last(); | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    //! <b>Effects</b>: Erases the element at position pos.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Throws</b>: Nothing.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  |    //! <b>Complexity</b>: Linear to the elements between pos and the
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //!   last element. Constant if pos is the last element.
 | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  |    iterator erase(const_iterator position) | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    { | 
					
						
							| 
									
										
										
										
											2014-09-21 23:57:23 +02:00
										 |  |  |       const pointer p = vector_iterator_get_ptr(position); | 
					
						
							|  |  |  |       T *const pos_ptr = container_detail::to_raw_pointer(p); | 
					
						
							|  |  |  |       T *const beg_ptr = container_detail::to_raw_pointer(this->m_holder.start()); | 
					
						
							|  |  |  |       T *const new_end_ptr = ::boost::move(pos_ptr + 1, beg_ptr + this->m_holder.m_size, pos_ptr); | 
					
						
							| 
									
										
										
										
											2013-02-11 11:31:02 +00:00
										 |  |  |       //Move elements forward and destroy last
 | 
					
						
							| 
									
										
										
										
											2014-09-21 23:57:23 +02:00
										 |  |  |       this->priv_destroy_last(pos_ptr == new_end_ptr); | 
					
						
							|  |  |  |       return iterator(p); | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    //! <b>Effects</b>: Erases the elements pointed by [first, last).
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Throws</b>: Nothing.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Complexity</b>: Linear to the distance between first and last
 | 
					
						
							|  |  |  |    //!   plus linear to the elements between pos and the last element.
 | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  |    iterator erase(const_iterator first, const_iterator last) | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    { | 
					
						
							| 
									
										
										
										
											2012-11-24 21:08:18 +00:00
										 |  |  |       if (first != last){ | 
					
						
							| 
									
										
										
										
											2014-09-21 23:57:23 +02:00
										 |  |  |          T* const old_end_ptr = container_detail::to_raw_pointer(this->m_holder.start()) + this->m_holder.m_size; | 
					
						
							|  |  |  |          T* const first_ptr = container_detail::to_raw_pointer(vector_iterator_get_ptr(first)); | 
					
						
							|  |  |  |          T* const last_ptr = container_detail::to_raw_pointer(vector_iterator_get_ptr(last)); | 
					
						
							|  |  |  |          T* const ptr = container_detail::to_raw_pointer(boost::move(last_ptr, old_end_ptr, first_ptr)); | 
					
						
							|  |  |  |          this->priv_destroy_last_n(old_end_ptr - ptr, last_ptr == old_end_ptr); | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |       } | 
					
						
							| 
									
										
										
										
											2013-02-24 20:34:15 +00:00
										 |  |  |       return iterator(vector_iterator_get_ptr(first)); | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  |    //! <b>Effects</b>: Swaps the contents of *this and x.
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  |    //! <b>Throws</b>: Nothing.
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2012-09-24 10:27:02 +00:00
										 |  |  |    //! <b>Complexity</b>: Constant.
 | 
					
						
							| 
									
										
										
										
											2014-04-21 13:59:49 +02:00
										 |  |  |    void swap(vector& x) BOOST_CONTAINER_NOEXCEPT_IF((!container_detail::is_version<Allocator, 0>::value)) | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    { | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |       //Just swap internals in case of !allocator_v0. Otherwise, deep swap
 | 
					
						
							|  |  |  |       this->m_holder.swap(x.m_holder); | 
					
						
							| 
									
										
										
										
											2013-02-24 20:34:15 +00:00
										 |  |  |       //And now the allocator
 | 
					
						
							|  |  |  |       container_detail::bool_<allocator_traits_type::propagate_on_container_swap::value> flag; | 
					
						
							|  |  |  |       container_detail::swap_alloc(this->m_holder.alloc(), x.m_holder.alloc(), flag); | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |    #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    //! <b>Effects</b>: Swaps the contents of *this and x.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2014-04-17 00:06:59 +02:00
										 |  |  |    //! <b>Throws</b>: Nothing.
 | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Complexity</b>: Linear
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2014-04-21 13:59:49 +02:00
										 |  |  |    //! <b>Note</b>: Non-standard extension to support static_vector
 | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |    template<class OtherAllocator> | 
					
						
							| 
									
										
										
										
											2014-04-21 13:59:49 +02:00
										 |  |  |    void swap(vector<T, OtherAllocator> & x | 
					
						
							|  |  |  |             , typename container_detail::enable_if_c | 
					
						
							|  |  |  |                      < container_detail::is_version<OtherAllocator, 0>::value && | 
					
						
							|  |  |  |                       !container_detail::is_same<OtherAllocator, allocator_type>::value >::type * = 0 | 
					
						
							|  |  |  |             ) | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |    {  this->m_holder.swap(x.m_holder); } | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |    #endif   //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    //! <b>Effects</b>: Erases all the elements of the vector.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Throws</b>: Nothing.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							| 
									
										
										
										
											2014-01-03 12:43:03 +01:00
										 |  |  |    //! <b>Complexity</b>: Linear to the number of elements in the container.
 | 
					
						
							| 
									
										
										
										
											2011-12-22 20:08:24 +00:00
										 |  |  |    void clear() BOOST_CONTAINER_NOEXCEPT | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |    {  this->priv_destroy_all();  } | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-01-03 12:43:03 +01:00
										 |  |  |    //! <b>Effects</b>: Returns true if x and y are equal
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Complexity</b>: Linear to the number of elements in the container.
 | 
					
						
							| 
									
										
										
										
											2013-12-23 23:34:28 +01:00
										 |  |  |    friend bool operator==(const vector& x, const vector& y) | 
					
						
							| 
									
										
										
										
											2014-11-26 07:08:06 +01:00
										 |  |  |    {  return x.size() == y.size() && ::boost::container::algo_equal(x.begin(), x.end(), y.begin());  } | 
					
						
							| 
									
										
										
										
											2013-12-23 23:34:28 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-01-03 12:43:03 +01:00
										 |  |  |    //! <b>Effects</b>: Returns true if x and y are unequal
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Complexity</b>: Linear to the number of elements in the container.
 | 
					
						
							| 
									
										
										
										
											2013-12-23 23:34:28 +01:00
										 |  |  |    friend bool operator!=(const vector& x, const vector& y) | 
					
						
							|  |  |  |    {  return !(x == y); } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-01-03 12:43:03 +01:00
										 |  |  |    //! <b>Effects</b>: Returns true if x is less than y
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Complexity</b>: Linear to the number of elements in the container.
 | 
					
						
							| 
									
										
										
										
											2013-12-23 23:34:28 +01:00
										 |  |  |    friend bool operator<(const vector& x, const vector& y) | 
					
						
							| 
									
										
										
										
											2014-09-26 08:12:40 +02:00
										 |  |  |    { | 
					
						
							|  |  |  |       const_iterator first1(x.cbegin()), first2(y.cbegin()); | 
					
						
							|  |  |  |       const const_iterator last1(x.cend()), last2(y.cend()); | 
					
						
							|  |  |  |       for ( ; (first1 != last1) && (first2 != last2); ++first1, ++first2 ) { | 
					
						
							|  |  |  |          if (*first1 < *first2) return true; | 
					
						
							|  |  |  |          if (*first2 < *first1) return false; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       return (first1 == last1) && (first2 != last2); | 
					
						
							|  |  |  |    } | 
					
						
							| 
									
										
										
										
											2013-12-23 23:34:28 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-01-03 12:43:03 +01:00
										 |  |  |    //! <b>Effects</b>: Returns true if x is greater than y
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Complexity</b>: Linear to the number of elements in the container.
 | 
					
						
							| 
									
										
										
										
											2013-12-23 23:34:28 +01:00
										 |  |  |    friend bool operator>(const vector& x, const vector& y) | 
					
						
							|  |  |  |    {  return y < x;  } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-01-03 12:43:03 +01:00
										 |  |  |    //! <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.
 | 
					
						
							| 
									
										
										
										
											2013-12-23 23:34:28 +01:00
										 |  |  |    friend bool operator<=(const vector& x, const vector& y) | 
					
						
							|  |  |  |    {  return !(y < x);  } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-01-03 12:43:03 +01:00
										 |  |  |    //! <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.
 | 
					
						
							| 
									
										
										
										
											2013-12-23 23:34:28 +01:00
										 |  |  |    friend bool operator>=(const vector& x, const vector& y) | 
					
						
							|  |  |  |    {  return !(x < y);  } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-01-03 12:43:03 +01:00
										 |  |  |    //! <b>Effects</b>: x.swap(y)
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Complexity</b>: Constant.
 | 
					
						
							| 
									
										
										
										
											2013-12-23 23:34:28 +01:00
										 |  |  |    friend void swap(vector& x, vector& y) | 
					
						
							|  |  |  |    {  x.swap(y);  } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-01-03 12:43:03 +01:00
										 |  |  |    #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
 | 
					
						
							| 
									
										
										
										
											2014-09-17 21:52:34 +02:00
										 |  |  |    //! <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
 | 
					
						
							|  |  |  |    //!   (memory expansion) that will not invalidate iterators.
 | 
					
						
							|  |  |  |    //!   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.
 | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    //! <b>Note</b>: Non-standard extension.
 | 
					
						
							|  |  |  |    bool stable_reserve(size_type new_cap) | 
					
						
							|  |  |  |    { | 
					
						
							|  |  |  |       const bool room_enough = this->capacity() < new_cap; | 
					
						
							|  |  |  |       if(!room_enough && alloc_version::value < 2){ | 
					
						
							|  |  |  |          return false; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       else{ | 
					
						
							|  |  |  |          //There is not enough memory, try to expand the old one
 | 
					
						
							|  |  |  |          size_type real_cap = 0; | 
					
						
							|  |  |  |          std::pair<pointer, bool> ret = this->m_holder.allocation_command | 
					
						
							|  |  |  |             (expand_fwd, new_cap, new_cap, real_cap, this->m_holder.start()); | 
					
						
							|  |  |  |          //Check for forward expansion
 | 
					
						
							|  |  |  |          if(ret.second){ | 
					
						
							|  |  |  |             #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
 | 
					
						
							|  |  |  |             ++this->num_expand_fwd; | 
					
						
							|  |  |  |             #endif
 | 
					
						
							|  |  |  |             this->m_holder.capacity(real_cap); | 
					
						
							|  |  |  |          } | 
					
						
							|  |  |  |          return ret.second; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |    } | 
					
						
							| 
									
										
										
										
											2014-01-03 12:43:03 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |    //Absolutely experimental. This function might change, disappear or simply crash!
 | 
					
						
							|  |  |  |    template<class BiDirPosConstIt, class BiDirValueIt> | 
					
						
							| 
									
										
										
										
											2014-09-17 21:52:34 +02:00
										 |  |  |    void insert_ordered_at(const size_type element_count, BiDirPosConstIt last_position_it, BiDirValueIt last_value_it) | 
					
						
							| 
									
										
										
										
											2014-01-03 12:43:03 +01:00
										 |  |  |    { | 
					
						
							| 
									
										
										
										
											2014-09-17 21:52:34 +02:00
										 |  |  |       const size_type old_size_pos = this->size(); | 
					
						
							|  |  |  |       this->reserve(old_size_pos + element_count); | 
					
						
							|  |  |  |       T* const begin_ptr = container_detail::to_raw_pointer(this->m_holder.start()); | 
					
						
							|  |  |  |       size_type insertions_left = element_count; | 
					
						
							|  |  |  |       size_type next_pos = old_size_pos; | 
					
						
							|  |  |  |       size_type hole_size = element_count; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       //Exception rollback. If any copy throws before the hole is filled, values
 | 
					
						
							|  |  |  |       //already inserted/copied at the end of the buffer will be destroyed.
 | 
					
						
							|  |  |  |       typename value_traits::ArrayDestructor past_hole_values_destroyer | 
					
						
							|  |  |  |          (begin_ptr + old_size_pos + element_count, this->m_holder.alloc(), size_type(0u)); | 
					
						
							|  |  |  |       //Loop for each insertion backwards, first moving the elements after the insertion point,
 | 
					
						
							|  |  |  |       //then inserting the element.
 | 
					
						
							|  |  |  |       while(insertions_left){ | 
					
						
							|  |  |  |          size_type pos = static_cast<size_type>(*(--last_position_it)); | 
					
						
							|  |  |  |          while(pos == size_type(-1)){ | 
					
						
							|  |  |  |             --last_value_it; | 
					
						
							|  |  |  |             pos = static_cast<size_type>(*(--last_position_it)); | 
					
						
							|  |  |  |          } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |          BOOST_ASSERT(pos != size_type(-1) && pos <= old_size_pos); | 
					
						
							|  |  |  |          //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 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->m_holder.alloc(), begin_ptr + pos + insertions_left - 1, *(--last_value_it)); | 
					
						
							|  |  |  |             --new_hole_size; | 
					
						
							|  |  |  |             if(new_hole_size == 0){ | 
					
						
							|  |  |  |                //Hole was just filled, disable exception rollback and change vector size
 | 
					
						
							|  |  |  |                past_hole_values_destroyer.release(); | 
					
						
							|  |  |  |                this->m_holder.m_size += element_count; | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |             else{ | 
					
						
							|  |  |  |                //The hole was reduced by the new insertion by one
 | 
					
						
							|  |  |  |                past_hole_values_destroyer.increment_size_backwards(size_type(1u)); | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |          } | 
					
						
							|  |  |  |          else{ | 
					
						
							|  |  |  |             if(hole_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->m_holder.m_size += element_count; | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |             //Insert the new value in the already constructed range
 | 
					
						
							|  |  |  |             begin_ptr[pos + insertions_left - 1] = *(--last_value_it); | 
					
						
							|  |  |  |          } | 
					
						
							|  |  |  |          --insertions_left; | 
					
						
							|  |  |  |          hole_size = new_hole_size; | 
					
						
							|  |  |  |          next_pos = pos; | 
					
						
							|  |  |  |       } | 
					
						
							| 
									
										
										
										
											2014-01-03 12:43:03 +01:00
										 |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-09-17 21:52:34 +02:00
										 |  |  |    #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || 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>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> | 
					
						
							|  |  |  |    bool stable_emplace_back(Args &&...args) | 
					
						
							| 
									
										
										
										
											2014-01-03 12:43:03 +01:00
										 |  |  |    { | 
					
						
							| 
									
										
										
										
											2014-09-17 21:52:34 +02:00
										 |  |  |       const bool room_enough = this->m_holder.m_size < this->m_holder.capacity(); | 
					
						
							| 
									
										
										
										
											2014-09-26 08:12:40 +02:00
										 |  |  |       if (BOOST_LIKELY(room_enough)){ | 
					
						
							| 
									
										
										
										
											2014-09-17 21:52:34 +02:00
										 |  |  |          T* const back_pos = container_detail::to_raw_pointer(this->m_holder.start()) + this->m_holder.m_size; | 
					
						
							|  |  |  |          //There is more memory, just construct a new object at the end
 | 
					
						
							|  |  |  |          allocator_traits_type::construct(this->m_holder.alloc(), back_pos, ::boost::forward<Args>(args)...); | 
					
						
							|  |  |  |          ++this->m_holder.m_size; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       return room_enough; | 
					
						
							| 
									
										
										
										
											2014-01-03 12:43:03 +01:00
										 |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-09-17 21:52:34 +02:00
										 |  |  |    #else
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    #define BOOST_PP_LOCAL_MACRO(n)                                                           \
 | 
					
						
							|  |  |  |    BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >)    \ | 
					
						
							|  |  |  |    bool stable_emplace_back(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _))              \ | 
					
						
							|  |  |  |    {                                                                                         \ | 
					
						
							|  |  |  |       const bool room_enough = this->m_holder.m_size < this->m_holder.capacity();            \ | 
					
						
							| 
									
										
										
										
											2014-11-09 21:06:36 +01:00
										 |  |  |       if (BOOST_LIKELY(room_enough)){                                                        \ | 
					
						
							| 
									
										
										
										
											2014-09-17 21:52:34 +02:00
										 |  |  |          T* const back_pos = container_detail::to_raw_pointer                                \ | 
					
						
							|  |  |  |             (this->m_holder.start()) + this->m_holder.m_size;                                \ | 
					
						
							|  |  |  |          allocator_traits_type::construct (this->m_holder.alloc()                            \ | 
					
						
							|  |  |  |             , back_pos BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) );     \ | 
					
						
							|  |  |  |          ++this->m_holder.m_size;                                                            \ | 
					
						
							|  |  |  |       }                                                                                      \ | 
					
						
							|  |  |  |       return room_enough;                                                                    \ | 
					
						
							|  |  |  |    }                                                                                         \ | 
					
						
							|  |  |  |    //!
 | 
					
						
							|  |  |  |    #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
 | 
					
						
							|  |  |  |    #include BOOST_PP_LOCAL_ITERATE()
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    #endif   //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    private: | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-11-01 20:03:25 +01:00
										 |  |  |    size_type priv_index_of(pointer p) const | 
					
						
							|  |  |  |    { | 
					
						
							|  |  |  |       BOOST_ASSERT(this->m_holder.start() <= p); | 
					
						
							| 
									
										
										
										
											2014-11-09 21:06:36 +01:00
										 |  |  |       BOOST_ASSERT(p <= (this->m_holder.start()+this->size())); | 
					
						
							| 
									
										
										
										
											2014-11-01 20:03:25 +01:00
										 |  |  |       return static_cast<size_type>(p - this->m_holder.start()); | 
					
						
							|  |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-04-21 13:59:49 +02:00
										 |  |  |    template<class OtherAllocator> | 
					
						
							| 
									
										
										
										
											2013-02-24 13:13:36 +00:00
										 |  |  |    void priv_move_assign(BOOST_RV_REF_BEG vector<T, OtherAllocator> BOOST_RV_REF_END x | 
					
						
							|  |  |  |       , typename container_detail::enable_if_c | 
					
						
							| 
									
										
										
										
											2014-04-21 13:59:49 +02:00
										 |  |  |          < container_detail::is_version<OtherAllocator, 0>::value >::type * = 0) | 
					
						
							| 
									
										
										
										
											2013-02-24 13:13:36 +00:00
										 |  |  |    { | 
					
						
							| 
									
										
										
										
											2014-04-21 13:59:49 +02:00
										 |  |  |       if(!container_detail::is_same<OtherAllocator, allocator_type>::value && | 
					
						
							|  |  |  |           this->capacity() < x.size()){ | 
					
						
							| 
									
										
										
										
											2013-02-24 13:13:36 +00:00
										 |  |  |          throw_bad_alloc(); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       T* const this_start  = container_detail::to_raw_pointer(m_holder.start()); | 
					
						
							|  |  |  |       T* const other_start = container_detail::to_raw_pointer(x.m_holder.start()); | 
					
						
							|  |  |  |       const size_type this_sz  = m_holder.m_size; | 
					
						
							|  |  |  |       const size_type other_sz = static_cast<size_type>(x.m_holder.m_size); | 
					
						
							| 
									
										
										
										
											2013-03-03 12:26:48 +00:00
										 |  |  |       boost::container::move_assign_range_alloc_n(this->m_holder.alloc(), other_start, other_sz, this_start, this_sz); | 
					
						
							| 
									
										
										
										
											2013-02-24 13:13:36 +00:00
										 |  |  |       this->m_holder.m_size = other_sz; | 
					
						
							|  |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-04-21 13:59:49 +02:00
										 |  |  |    template<class OtherAllocator> | 
					
						
							|  |  |  |    void priv_move_assign(BOOST_RV_REF_BEG vector<T, OtherAllocator> BOOST_RV_REF_END x | 
					
						
							| 
									
										
										
										
											2013-02-24 13:13:36 +00:00
										 |  |  |       , typename container_detail::enable_if_c | 
					
						
							| 
									
										
										
										
											2014-04-21 13:59:49 +02:00
										 |  |  |          < !container_detail::is_version<OtherAllocator, 0>::value && | 
					
						
							|  |  |  |            container_detail::is_same<OtherAllocator, allocator_type>::value>::type * = 0) | 
					
						
							| 
									
										
										
										
											2013-02-24 13:13:36 +00:00
										 |  |  |    { | 
					
						
							|  |  |  |       //for move constructor, no aliasing (&x != this) is assummed.
 | 
					
						
							| 
									
										
										
										
											2014-04-21 13:59:49 +02:00
										 |  |  |       BOOST_ASSERT(this != &x); | 
					
						
							| 
									
										
										
										
											2013-02-24 13:13:36 +00:00
										 |  |  |       allocator_type &this_alloc = this->m_holder.alloc(); | 
					
						
							|  |  |  |       allocator_type &x_alloc    = x.m_holder.alloc(); | 
					
						
							| 
									
										
										
										
											2014-04-21 13:59:49 +02:00
										 |  |  |       const bool propagate_alloc = allocator_traits_type:: | 
					
						
							|  |  |  |             propagate_on_container_move_assignment::value; | 
					
						
							|  |  |  |       container_detail::bool_<propagate_alloc> flag; | 
					
						
							|  |  |  |       const bool allocators_equal = this_alloc == x_alloc; (void)allocators_equal; | 
					
						
							|  |  |  |       //Resources can be transferred if both allocators are
 | 
					
						
							|  |  |  |       //going to be equal after this function (either propagated or already equal)
 | 
					
						
							|  |  |  |       if(propagate_alloc || allocators_equal){ | 
					
						
							| 
									
										
										
										
											2013-02-24 13:13:36 +00:00
										 |  |  |          //Destroy objects but retain memory in case x reuses it in the future
 | 
					
						
							|  |  |  |          this->clear(); | 
					
						
							|  |  |  |          //Move allocator if needed
 | 
					
						
							|  |  |  |          container_detail::move_alloc(this_alloc, x_alloc, flag); | 
					
						
							| 
									
										
										
										
											2014-04-21 13:59:49 +02:00
										 |  |  |          //Nothrow swap
 | 
					
						
							|  |  |  |          this->m_holder.swap(x.m_holder); | 
					
						
							| 
									
										
										
										
											2013-02-24 13:13:36 +00:00
										 |  |  |       } | 
					
						
							| 
									
										
										
										
											2014-04-21 13:59:49 +02:00
										 |  |  |       //Else do a one by one move
 | 
					
						
							| 
									
										
										
										
											2013-02-24 13:13:36 +00:00
										 |  |  |       else{ | 
					
						
							| 
									
										
										
										
											2014-04-21 13:59:49 +02:00
										 |  |  |          this->assign( boost::make_move_iterator(x.begin()) | 
					
						
							|  |  |  |                      , boost::make_move_iterator(x.end())); | 
					
						
							| 
									
										
										
										
											2013-02-24 13:13:36 +00:00
										 |  |  |       } | 
					
						
							|  |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-04-21 13:59:49 +02:00
										 |  |  |    template<class OtherAllocator> | 
					
						
							|  |  |  |    void priv_copy_assign(const vector<T, OtherAllocator> &x | 
					
						
							| 
									
										
										
										
											2013-02-24 13:13:36 +00:00
										 |  |  |       , typename container_detail::enable_if_c | 
					
						
							| 
									
										
										
										
											2014-04-21 13:59:49 +02:00
										 |  |  |          < container_detail::is_version<OtherAllocator, 0>::value >::type * = 0) | 
					
						
							| 
									
										
										
										
											2013-02-24 13:13:36 +00:00
										 |  |  |    { | 
					
						
							| 
									
										
										
										
											2014-04-21 13:59:49 +02:00
										 |  |  |       if(!container_detail::is_same<OtherAllocator, allocator_type>::value && | 
					
						
							|  |  |  |          this->capacity() < x.size()){ | 
					
						
							|  |  |  |          throw_bad_alloc(); | 
					
						
							|  |  |  |       } | 
					
						
							| 
									
										
										
										
											2013-02-24 13:13:36 +00:00
										 |  |  |       T* const this_start  = container_detail::to_raw_pointer(m_holder.start()); | 
					
						
							|  |  |  |       T* const other_start = container_detail::to_raw_pointer(x.m_holder.start()); | 
					
						
							|  |  |  |       const size_type this_sz  = m_holder.m_size; | 
					
						
							|  |  |  |       const size_type other_sz = static_cast<size_type>(x.m_holder.m_size); | 
					
						
							| 
									
										
										
										
											2013-03-03 12:26:48 +00:00
										 |  |  |       boost::container::copy_assign_range_alloc_n(this->m_holder.alloc(), other_start, other_sz, this_start, this_sz); | 
					
						
							| 
									
										
										
										
											2013-02-24 13:13:36 +00:00
										 |  |  |       this->m_holder.m_size = other_sz; | 
					
						
							|  |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-04-21 13:59:49 +02:00
										 |  |  |    template<class OtherAllocator> | 
					
						
							|  |  |  |    void priv_copy_assign(const vector<T, OtherAllocator> &x | 
					
						
							| 
									
										
										
										
											2013-02-24 13:13:36 +00:00
										 |  |  |       , typename container_detail::enable_if_c | 
					
						
							| 
									
										
										
										
											2014-04-21 13:59:49 +02:00
										 |  |  |          < !container_detail::is_version<OtherAllocator, 0>::value && | 
					
						
							|  |  |  |            container_detail::is_same<OtherAllocator, allocator_type>::value >::type * = 0) | 
					
						
							| 
									
										
										
										
											2013-02-24 13:13:36 +00:00
										 |  |  |    { | 
					
						
							|  |  |  |       allocator_type &this_alloc     = this->m_holder.alloc(); | 
					
						
							|  |  |  |       const allocator_type &x_alloc  = x.m_holder.alloc(); | 
					
						
							|  |  |  |       container_detail::bool_<allocator_traits_type:: | 
					
						
							|  |  |  |          propagate_on_container_copy_assignment::value> flag; | 
					
						
							|  |  |  |       if(flag && this_alloc != x_alloc){ | 
					
						
							|  |  |  |          this->clear(); | 
					
						
							|  |  |  |          this->shrink_to_fit(); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       container_detail::assign_alloc(this_alloc, x_alloc, flag); | 
					
						
							|  |  |  |       this->assign( container_detail::to_raw_pointer(x.m_holder.start()) | 
					
						
							|  |  |  |                   , container_detail::to_raw_pointer(x.m_holder.start() + x.m_holder.m_size)); | 
					
						
							|  |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |    void priv_reserve(size_type, allocator_v0) | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |    {  throw_bad_alloc();  } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    container_detail::insert_range_proxy<Allocator, boost::move_iterator<T*>, T*> priv_dummy_empty_proxy() | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |    { | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |       return container_detail::insert_range_proxy<Allocator, boost::move_iterator<T*>, T*> | 
					
						
							|  |  |  |          (::boost::make_move_iterator((T *)0)); | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    void priv_reserve(size_type new_cap, allocator_v1) | 
					
						
							|  |  |  |    { | 
					
						
							|  |  |  |       //There is not enough memory, allocate a new buffer
 | 
					
						
							|  |  |  |       pointer p = this->m_holder.allocate(new_cap); | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |       //We will reuse insert code, so create a dummy input iterator
 | 
					
						
							|  |  |  |       this->priv_forward_range_insert_new_allocation | 
					
						
							|  |  |  |          ( container_detail::to_raw_pointer(p), new_cap | 
					
						
							|  |  |  |          , container_detail::to_raw_pointer(this->m_holder.start()) + this->m_holder.m_size | 
					
						
							|  |  |  |          , 0, this->priv_dummy_empty_proxy()); | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    void priv_reserve(size_type new_cap, allocator_v2) | 
					
						
							|  |  |  |    { | 
					
						
							|  |  |  |       //There is not enough memory, allocate a new
 | 
					
						
							|  |  |  |       //buffer or expand the old one.
 | 
					
						
							|  |  |  |       bool same_buffer_start; | 
					
						
							|  |  |  |       size_type real_cap = 0; | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |       std::pair<pointer, bool> ret = this->m_holder.allocation_command | 
					
						
							|  |  |  |          (allocate_new | expand_fwd | expand_bwd, new_cap, new_cap, real_cap, this->m_holder.start()); | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |       //Check for forward expansion
 | 
					
						
							|  |  |  |       same_buffer_start = ret.second && this->m_holder.start() == ret.first; | 
					
						
							|  |  |  |       if(same_buffer_start){ | 
					
						
							|  |  |  |          #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
 | 
					
						
							|  |  |  |          ++this->num_expand_fwd; | 
					
						
							|  |  |  |          #endif
 | 
					
						
							|  |  |  |          this->m_holder.capacity(real_cap); | 
					
						
							|  |  |  |       } | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |       else{ //If there is no forward expansion, move objects, we will reuse insertion code
 | 
					
						
							|  |  |  |          T * const new_mem = container_detail::to_raw_pointer(ret.first); | 
					
						
							|  |  |  |          T * const ins_pos = container_detail::to_raw_pointer(this->m_holder.start()) + this->m_holder.m_size; | 
					
						
							|  |  |  |          if(ret.second){   //Backwards (and possibly forward) expansion
 | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |             #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
 | 
					
						
							|  |  |  |             ++this->num_expand_bwd; | 
					
						
							|  |  |  |             #endif
 | 
					
						
							| 
									
										
										
										
											2013-03-03 12:26:48 +00:00
										 |  |  |             this->priv_forward_range_insert_expand_backwards | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |                ( new_mem , real_cap, ins_pos, 0, this->priv_dummy_empty_proxy()); | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |          } | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |          else{ //New buffer
 | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |             #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
 | 
					
						
							|  |  |  |             ++this->num_alloc; | 
					
						
							|  |  |  |             #endif
 | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |             this->priv_forward_range_insert_new_allocation | 
					
						
							|  |  |  |                ( new_mem, real_cap, ins_pos, 0, this->priv_dummy_empty_proxy()); | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |          } | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-09-21 23:57:23 +02:00
										 |  |  |    void priv_destroy_last() BOOST_CONTAINER_NOEXCEPT | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |    { | 
					
						
							| 
									
										
										
										
											2014-09-21 23:57:23 +02:00
										 |  |  |       if(!value_traits::trivial_dctr){ | 
					
						
							|  |  |  |          value_type* const p = container_detail::to_raw_pointer(this->m_holder.start()) + this->m_holder.m_size - 1; | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |          allocator_traits_type::destroy(this->get_stored_allocator(), p); | 
					
						
							| 
									
										
										
										
											2014-09-21 23:57:23 +02:00
										 |  |  |       } | 
					
						
							|  |  |  |       --this->m_holder.m_size; | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-09-21 23:57:23 +02:00
										 |  |  |    void priv_destroy_last(const bool moved) BOOST_CONTAINER_NOEXCEPT | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |    { | 
					
						
							| 
									
										
										
										
											2014-09-21 23:57:23 +02:00
										 |  |  |       (void)moved; | 
					
						
							|  |  |  |       if(!(value_traits::trivial_dctr || (value_traits::trivial_dctr_after_move && moved))){ | 
					
						
							|  |  |  |          value_type* const p = container_detail::to_raw_pointer(this->m_holder.start()) + this->m_holder.m_size - 1; | 
					
						
							|  |  |  |          allocator_traits_type::destroy(this->get_stored_allocator(), p); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       --this->m_holder.m_size; | 
					
						
							|  |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    void priv_destroy_last_n(const size_type n) BOOST_CONTAINER_NOEXCEPT | 
					
						
							|  |  |  |    { | 
					
						
							|  |  |  |       BOOST_ASSERT(n <= this->m_holder.m_size); | 
					
						
							|  |  |  |       if(!value_traits::trivial_dctr){ | 
					
						
							|  |  |  |          T* const destroy_pos = container_detail::to_raw_pointer(this->m_holder.start()) + (this->m_holder.m_size-n); | 
					
						
							|  |  |  |          boost::container::destroy_alloc_n(this->get_stored_allocator(), destroy_pos, n); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       this->m_holder.m_size -= n; | 
					
						
							|  |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    void priv_destroy_last_n(const size_type n, const bool moved) BOOST_CONTAINER_NOEXCEPT | 
					
						
							|  |  |  |    { | 
					
						
							|  |  |  |       BOOST_ASSERT(n <= this->m_holder.m_size); | 
					
						
							|  |  |  |       (void)moved; | 
					
						
							|  |  |  |       if(!(value_traits::trivial_dctr || (value_traits::trivial_dctr_after_move && moved))){ | 
					
						
							|  |  |  |          T* const destroy_pos = container_detail::to_raw_pointer(this->m_holder.start()) + (this->m_holder.m_size-n); | 
					
						
							|  |  |  |          boost::container::destroy_alloc_n(this->get_stored_allocator(), destroy_pos, n); | 
					
						
							|  |  |  |       } | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |       this->m_holder.m_size -= n; | 
					
						
							|  |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |    template<class InpIt> | 
					
						
							|  |  |  |    void priv_uninitialized_construct_at_end(InpIt first, InpIt last) | 
					
						
							|  |  |  |    { | 
					
						
							| 
									
										
										
										
											2014-09-21 23:57:23 +02:00
										 |  |  |       T* const old_end_pos = container_detail::to_raw_pointer(this->m_holder.start()) + this->m_holder.m_size; | 
					
						
							|  |  |  |       T* const new_end_pos = boost::container::uninitialized_copy_alloc(this->m_holder.alloc(), first, last, old_end_pos); | 
					
						
							|  |  |  |       this->m_holder.m_size += new_end_pos - old_end_pos; | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |    void priv_destroy_all() BOOST_CONTAINER_NOEXCEPT | 
					
						
							|  |  |  |    { | 
					
						
							| 
									
										
										
										
											2013-03-03 12:26:48 +00:00
										 |  |  |       boost::container::destroy_alloc_n | 
					
						
							|  |  |  |          (this->get_stored_allocator(), container_detail::to_raw_pointer(this->m_holder.start()), this->m_holder.m_size); | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |       this->m_holder.m_size = 0; | 
					
						
							|  |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-11-24 21:08:18 +00:00
										 |  |  |    template<class U> | 
					
						
							|  |  |  |    iterator priv_insert(const const_iterator &p, BOOST_FWD_REF(U) x) | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    { | 
					
						
							| 
									
										
										
										
											2012-11-24 21:08:18 +00:00
										 |  |  |       return this->priv_forward_range_insert | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |          ( vector_iterator_get_ptr(p), 1, container_detail::get_insert_value_proxy<T*, Allocator> | 
					
						
							|  |  |  |             (::boost::forward<U>(x)), alloc_version()); | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |    container_detail::insert_copy_proxy<Allocator, T*> priv_single_insert_proxy(const T &x) | 
					
						
							|  |  |  |    {  return container_detail::insert_copy_proxy<Allocator, T*> (x);  } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    container_detail::insert_move_proxy<Allocator, T*> priv_single_insert_proxy(BOOST_RV_REF(T) x) | 
					
						
							|  |  |  |    {  return container_detail::insert_move_proxy<Allocator, T*> (x);  } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    template <class U> | 
					
						
							|  |  |  |    void priv_push_back(BOOST_FWD_REF(U) u) | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    { | 
					
						
							| 
									
										
										
										
											2014-09-26 08:12:40 +02:00
										 |  |  |       if (BOOST_LIKELY(this->m_holder.m_size < this->m_holder.capacity())){ | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |          //There is more memory, just construct a new object at the end
 | 
					
						
							| 
									
										
										
										
											2011-12-22 20:08:24 +00:00
										 |  |  |          allocator_traits_type::construct | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |             ( this->m_holder.alloc() | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |             , container_detail::to_raw_pointer(this->m_holder.start() + this->m_holder.m_size) | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |             , ::boost::forward<U>(u) ); | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |          ++this->m_holder.m_size; | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |       } | 
					
						
							|  |  |  |       else{ | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |          this->priv_forward_range_insert_no_capacity | 
					
						
							|  |  |  |             ( vector_iterator_get_ptr(this->cend()), 1 | 
					
						
							|  |  |  |             , this->priv_single_insert_proxy(::boost::forward<U>(u)), alloc_version()); | 
					
						
							| 
									
										
										
										
											2013-02-24 13:13:36 +00:00
										 |  |  |       } | 
					
						
							|  |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |    container_detail::insert_n_copies_proxy<Allocator, T*> priv_resize_proxy(const T &x) | 
					
						
							|  |  |  |    {  return container_detail::insert_n_copies_proxy<Allocator, T*>(x);   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    container_detail::insert_default_initialized_n_proxy<Allocator, T*> priv_resize_proxy(default_init_t) | 
					
						
							|  |  |  |    {  return container_detail::insert_default_initialized_n_proxy<Allocator, T*>();  } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    container_detail::insert_value_initialized_n_proxy<Allocator, T*> priv_resize_proxy(value_init_t) | 
					
						
							|  |  |  |    {  return container_detail::insert_value_initialized_n_proxy<Allocator, T*>(); } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    template <class U> | 
					
						
							|  |  |  |    void priv_resize(size_type new_size, const U& u) | 
					
						
							| 
									
										
										
										
											2013-02-24 13:13:36 +00:00
										 |  |  |    { | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |       const size_type sz = this->size(); | 
					
						
							|  |  |  |       if (new_size < sz){ | 
					
						
							|  |  |  |          //Destroy last elements
 | 
					
						
							|  |  |  |          this->priv_destroy_last_n(sz - new_size); | 
					
						
							| 
									
										
										
										
											2013-02-24 13:13:36 +00:00
										 |  |  |       } | 
					
						
							|  |  |  |       else{ | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |          const size_type n = new_size - this->size(); | 
					
						
							|  |  |  |          this->priv_forward_range_insert_at_end(n, this->priv_resize_proxy(u), alloc_version()); | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |       } | 
					
						
							|  |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-03-03 12:26:48 +00:00
										 |  |  |    void priv_shrink_to_fit(allocator_v0) BOOST_CONTAINER_NOEXCEPT | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |    {} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-30 20:38:04 +00:00
										 |  |  |    void priv_shrink_to_fit(allocator_v1) | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    { | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |       const size_type cp = this->m_holder.capacity(); | 
					
						
							|  |  |  |       if(cp){ | 
					
						
							|  |  |  |          const size_type sz = this->size(); | 
					
						
							|  |  |  |          if(!sz){ | 
					
						
							| 
									
										
										
										
											2013-03-03 12:26:48 +00:00
										 |  |  |             this->m_holder.alloc().deallocate(this->m_holder.m_start, cp); | 
					
						
							|  |  |  |             this->m_holder.m_start     = pointer(); | 
					
						
							|  |  |  |             this->m_holder.m_capacity  = 0; | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |          } | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |          else if(sz < cp){ | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |             //Allocate a new buffer.
 | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |             pointer p = this->m_holder.allocate(sz); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             //We will reuse insert code, so create a dummy input iterator
 | 
					
						
							|  |  |  |             #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
 | 
					
						
							|  |  |  |             ++this->num_alloc; | 
					
						
							|  |  |  |             #endif
 | 
					
						
							| 
									
										
										
										
											2013-03-03 12:26:48 +00:00
										 |  |  |             this->priv_forward_range_insert_new_allocation | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |                ( container_detail::to_raw_pointer(p), sz | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |                , container_detail::to_raw_pointer(this->m_holder.start()) | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |                , 0, this->priv_dummy_empty_proxy()); | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |          } | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-03-03 12:26:48 +00:00
										 |  |  |    void priv_shrink_to_fit(allocator_v2) BOOST_CONTAINER_NOEXCEPT | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    { | 
					
						
							| 
									
										
										
										
											2013-03-03 12:26:48 +00:00
										 |  |  |       const size_type cp = this->m_holder.capacity(); | 
					
						
							|  |  |  |       if(cp){ | 
					
						
							|  |  |  |          const size_type sz = this->size(); | 
					
						
							|  |  |  |          if(!sz){ | 
					
						
							|  |  |  |             this->m_holder.alloc().deallocate(this->m_holder.m_start, cp); | 
					
						
							|  |  |  |             this->m_holder.m_start     = pointer(); | 
					
						
							|  |  |  |             this->m_holder.m_capacity  = 0; | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |          } | 
					
						
							|  |  |  |          else{ | 
					
						
							|  |  |  |             size_type received_size; | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |             if(this->m_holder.allocation_command | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |                ( shrink_in_place | nothrow_allocation | 
					
						
							| 
									
										
										
										
											2013-03-03 12:26:48 +00:00
										 |  |  |                , cp, sz, received_size, this->m_holder.start()).first){ | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |                this->m_holder.capacity(received_size); | 
					
						
							| 
									
										
										
										
											2011-12-22 20:08:24 +00:00
										 |  |  |                #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |                ++this->num_shrink; | 
					
						
							|  |  |  |                #endif
 | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |          } | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-02-24 13:13:36 +00:00
										 |  |  |    template <class InsertionProxy> | 
					
						
							|  |  |  |    iterator priv_forward_range_insert_no_capacity | 
					
						
							|  |  |  |       (const pointer &pos, const size_type, const InsertionProxy , allocator_v0) | 
					
						
							|  |  |  |    { | 
					
						
							|  |  |  |       throw_bad_alloc(); | 
					
						
							|  |  |  |       return iterator(pos); | 
					
						
							|  |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    template <class InsertionProxy> | 
					
						
							|  |  |  |    iterator priv_forward_range_insert_no_capacity | 
					
						
							|  |  |  |       (const pointer &pos, const size_type n, const InsertionProxy insert_range_proxy, allocator_v1) | 
					
						
							|  |  |  |    { | 
					
						
							|  |  |  |       //Check if we have enough memory or try to expand current memory
 | 
					
						
							|  |  |  |       const size_type n_pos = pos - this->m_holder.start(); | 
					
						
							|  |  |  |       T *const raw_pos = container_detail::to_raw_pointer(pos); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       const size_type new_cap = this->m_holder.next_capacity(n); | 
					
						
							|  |  |  |       T * new_buf = container_detail::to_raw_pointer(this->m_holder.alloc().allocate(new_cap)); | 
					
						
							|  |  |  |       #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
 | 
					
						
							|  |  |  |       ++this->num_alloc; | 
					
						
							|  |  |  |       #endif
 | 
					
						
							| 
									
										
										
										
											2013-03-03 12:26:48 +00:00
										 |  |  |       this->priv_forward_range_insert_new_allocation | 
					
						
							| 
									
										
										
										
											2013-02-24 13:13:36 +00:00
										 |  |  |          ( new_buf, new_cap, raw_pos, n, insert_range_proxy); | 
					
						
							|  |  |  |       return iterator(this->m_holder.start() + n_pos); | 
					
						
							|  |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |    template <class InsertionProxy> | 
					
						
							| 
									
										
										
										
											2013-02-24 13:13:36 +00:00
										 |  |  |    iterator priv_forward_range_insert_no_capacity | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |       (const pointer &pos, const size_type n, const InsertionProxy insert_range_proxy, allocator_v2) | 
					
						
							|  |  |  |    { | 
					
						
							|  |  |  |       //Check if we have enough memory or try to expand current memory
 | 
					
						
							|  |  |  |       T *const raw_pos = container_detail::to_raw_pointer(pos); | 
					
						
							| 
									
										
										
										
											2013-03-03 12:26:48 +00:00
										 |  |  |       const size_type n_pos = raw_pos - container_detail::to_raw_pointer(this->m_holder.start()); | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-02-24 13:13:36 +00:00
										 |  |  |       size_type real_cap = 0; | 
					
						
							|  |  |  |       //There is not enough memory, allocate a new
 | 
					
						
							|  |  |  |       //buffer or expand the old one.
 | 
					
						
							|  |  |  |       std::pair<pointer, bool> ret = (this->m_holder.allocation_command | 
					
						
							|  |  |  |             (allocate_new | expand_fwd | expand_bwd, | 
					
						
							|  |  |  |                this->m_holder.m_size + n, this->m_holder.next_capacity(n), real_cap, this->m_holder.start())); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       //Buffer reallocated
 | 
					
						
							|  |  |  |       if(ret.second){ | 
					
						
							|  |  |  |          //Forward expansion, delay insertion
 | 
					
						
							|  |  |  |          if(this->m_holder.start() == ret.first){ | 
					
						
							|  |  |  |             #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
 | 
					
						
							|  |  |  |             ++this->num_expand_fwd; | 
					
						
							|  |  |  |             #endif
 | 
					
						
							|  |  |  |             this->m_holder.capacity(real_cap); | 
					
						
							|  |  |  |             //Expand forward
 | 
					
						
							| 
									
										
										
										
											2013-03-03 12:26:48 +00:00
										 |  |  |             this->priv_forward_range_insert_expand_forward(raw_pos, n, insert_range_proxy); | 
					
						
							| 
									
										
										
										
											2012-11-24 21:08:18 +00:00
										 |  |  |          } | 
					
						
							| 
									
										
										
										
											2013-02-24 13:13:36 +00:00
										 |  |  |          //Backwards (and possibly forward) expansion
 | 
					
						
							| 
									
										
										
										
											2012-11-24 21:08:18 +00:00
										 |  |  |          else{ | 
					
						
							|  |  |  |             #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
 | 
					
						
							| 
									
										
										
										
											2013-02-24 13:13:36 +00:00
										 |  |  |             ++this->num_expand_bwd; | 
					
						
							| 
									
										
										
										
											2012-11-24 21:08:18 +00:00
										 |  |  |             #endif
 | 
					
						
							| 
									
										
										
										
											2013-03-03 12:26:48 +00:00
										 |  |  |             this->priv_forward_range_insert_expand_backwards | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |                ( container_detail::to_raw_pointer(ret.first) | 
					
						
							|  |  |  |                , real_cap, raw_pos, n, insert_range_proxy); | 
					
						
							| 
									
										
										
										
											2012-11-24 21:08:18 +00:00
										 |  |  |          } | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |       } | 
					
						
							| 
									
										
										
										
											2013-02-24 13:13:36 +00:00
										 |  |  |       //New buffer
 | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |       else{ | 
					
						
							| 
									
										
										
										
											2013-02-24 13:13:36 +00:00
										 |  |  |          #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
 | 
					
						
							|  |  |  |          ++this->num_alloc; | 
					
						
							|  |  |  |          #endif
 | 
					
						
							| 
									
										
										
										
											2013-03-03 12:26:48 +00:00
										 |  |  |          this->priv_forward_range_insert_new_allocation | 
					
						
							| 
									
										
										
										
											2013-02-24 13:13:36 +00:00
										 |  |  |             ( container_detail::to_raw_pointer(ret.first) | 
					
						
							|  |  |  |             , real_cap, raw_pos, n, insert_range_proxy); | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       return iterator(this->m_holder.start() + n_pos); | 
					
						
							|  |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-03-03 12:26:48 +00:00
										 |  |  |    template <class InsertionProxy> | 
					
						
							|  |  |  |    iterator priv_forward_range_insert | 
					
						
							|  |  |  |       (const pointer &pos, const size_type n, const InsertionProxy insert_range_proxy, allocator_v0) | 
					
						
							|  |  |  |    { | 
					
						
							|  |  |  |       //Check if we have enough memory or try to expand current memory
 | 
					
						
							|  |  |  |       const size_type remaining = this->m_holder.capacity() - this->m_holder.m_size; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       if (n > remaining){ | 
					
						
							|  |  |  |          //This will trigger an error
 | 
					
						
							|  |  |  |          throw_bad_alloc(); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       const size_type n_pos = pos - this->m_holder.start(); | 
					
						
							|  |  |  |       T *const raw_pos = container_detail::to_raw_pointer(pos); | 
					
						
							|  |  |  |       this->priv_forward_range_insert_expand_forward(raw_pos, n, insert_range_proxy); | 
					
						
							|  |  |  |       return iterator(this->m_holder.start() + n_pos); | 
					
						
							|  |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    template <class InsertionProxy> | 
					
						
							|  |  |  |    iterator priv_forward_range_insert | 
					
						
							|  |  |  |       (const pointer &pos, const size_type n, const InsertionProxy insert_range_proxy, allocator_v1) | 
					
						
							|  |  |  |    { | 
					
						
							|  |  |  |       //Check if we have enough memory or try to expand current memory
 | 
					
						
							|  |  |  |       const size_type remaining = this->m_holder.capacity() - this->m_holder.m_size; | 
					
						
							|  |  |  |       T *const raw_pos = container_detail::to_raw_pointer(pos); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       if (n <= remaining){ | 
					
						
							|  |  |  |          const size_type n_pos = raw_pos - container_detail::to_raw_pointer(this->m_holder.start()); | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |          this->priv_forward_range_insert_expand_forward(raw_pos, n, insert_range_proxy); | 
					
						
							| 
									
										
										
										
											2013-03-03 12:26:48 +00:00
										 |  |  |          return iterator(this->m_holder.start() + n_pos); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       else{ | 
					
						
							|  |  |  |          return this->priv_forward_range_insert_no_capacity(pos, n, insert_range_proxy, alloc_version()); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-02-24 13:13:36 +00:00
										 |  |  |    template <class InsertionProxy> | 
					
						
							|  |  |  |    iterator priv_forward_range_insert | 
					
						
							|  |  |  |       (const pointer &pos, const size_type n, const InsertionProxy insert_range_proxy, allocator_v2) | 
					
						
							|  |  |  |    { | 
					
						
							| 
									
										
										
										
											2014-09-21 23:57:23 +02:00
										 |  |  |       BOOST_ASSERT(this->m_holder.capacity() >= this->m_holder.m_size); | 
					
						
							| 
									
										
										
										
											2013-02-24 13:13:36 +00:00
										 |  |  |       //Check if we have enough memory or try to expand current memory
 | 
					
						
							|  |  |  |       const size_type remaining = this->m_holder.capacity() - this->m_holder.m_size; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       bool same_buffer_start = n <= remaining; | 
					
						
							|  |  |  |       if (!same_buffer_start){ | 
					
						
							|  |  |  |          return priv_forward_range_insert_no_capacity(pos, n, insert_range_proxy, alloc_version()); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       else{ | 
					
						
							|  |  |  |          //Expand forward
 | 
					
						
							|  |  |  |          T *const raw_pos = container_detail::to_raw_pointer(pos); | 
					
						
							| 
									
										
										
										
											2013-03-03 12:26:48 +00:00
										 |  |  |          const size_type n_pos = raw_pos - container_detail::to_raw_pointer(this->m_holder.start()); | 
					
						
							|  |  |  |          this->priv_forward_range_insert_expand_forward(raw_pos, n, insert_range_proxy); | 
					
						
							| 
									
										
										
										
											2013-02-24 13:13:36 +00:00
										 |  |  |          return iterator(this->m_holder.start() + n_pos); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-03-03 12:26:48 +00:00
										 |  |  |    template <class InsertionProxy> | 
					
						
							|  |  |  |    iterator priv_forward_range_insert_at_end | 
					
						
							|  |  |  |       (const size_type n, const InsertionProxy insert_range_proxy, allocator_v0) | 
					
						
							|  |  |  |    { | 
					
						
							|  |  |  |       //Check if we have enough memory or try to expand current memory
 | 
					
						
							|  |  |  |       const size_type remaining = this->m_holder.capacity() - this->m_holder.m_size; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       if (n > remaining){ | 
					
						
							|  |  |  |          //This will trigger an error
 | 
					
						
							|  |  |  |          throw_bad_alloc(); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       this->priv_forward_range_insert_at_end_expand_forward(n, insert_range_proxy); | 
					
						
							|  |  |  |       return this->end(); | 
					
						
							|  |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    template <class InsertionProxy> | 
					
						
							|  |  |  |    iterator priv_forward_range_insert_at_end | 
					
						
							|  |  |  |       (const size_type n, const InsertionProxy insert_range_proxy, allocator_v1) | 
					
						
							|  |  |  |    { | 
					
						
							|  |  |  |       return this->priv_forward_range_insert(vector_iterator_get_ptr(this->cend()), n, insert_range_proxy, allocator_v1()); | 
					
						
							|  |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |    template <class InsertionProxy> | 
					
						
							|  |  |  |    iterator priv_forward_range_insert_at_end | 
					
						
							|  |  |  |       (const size_type n, const InsertionProxy insert_range_proxy, allocator_v2) | 
					
						
							|  |  |  |    { | 
					
						
							| 
									
										
										
										
											2013-02-24 20:34:15 +00:00
										 |  |  |       return this->priv_forward_range_insert(vector_iterator_get_ptr(this->cend()), n, insert_range_proxy, allocator_v2()); | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-04-11 06:26:20 +00:00
										 |  |  |    //Absolutely experimental. This function might change, disappear or simply crash!
 | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  |    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) | 
					
						
							| 
									
										
										
										
											2012-03-22 18:46:55 +00:00
										 |  |  |    { | 
					
						
							|  |  |  |       const size_type old_size_pos = this->size(); | 
					
						
							|  |  |  |       this->reserve(old_size_pos + element_count); | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |       T* const begin_ptr = container_detail::to_raw_pointer(this->m_holder.start()); | 
					
						
							| 
									
										
										
										
											2012-03-22 18:46:55 +00:00
										 |  |  |       size_type insertions_left = element_count; | 
					
						
							|  |  |  |       size_type next_pos = old_size_pos; | 
					
						
							|  |  |  |       size_type hole_size = element_count; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       //Exception rollback. If any copy throws before the hole is filled, values
 | 
					
						
							|  |  |  |       //already inserted/copied at the end of the buffer will be destroyed.
 | 
					
						
							|  |  |  |       typename value_traits::ArrayDestructor past_hole_values_destroyer | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |          (begin_ptr + old_size_pos + element_count, this->m_holder.alloc(), size_type(0u)); | 
					
						
							| 
									
										
										
										
											2012-03-22 18:46:55 +00:00
										 |  |  |       //Loop for each insertion backwards, first moving the elements after the insertion point,
 | 
					
						
							|  |  |  |       //then inserting the element.
 | 
					
						
							|  |  |  |       while(insertions_left){ | 
					
						
							| 
									
										
										
										
											2012-09-28 21:07:02 +00:00
										 |  |  |          if(do_skip){ | 
					
						
							|  |  |  |             size_type n = *(--last_skip_it); | 
					
						
							| 
									
										
										
										
											2014-11-26 07:08:06 +01:00
										 |  |  |             boost::container::iterator_advance(last_value_it, -difference_type(n)); | 
					
						
							| 
									
										
										
										
											2012-09-28 21:07:02 +00:00
										 |  |  |          } | 
					
						
							| 
									
										
										
										
											2012-04-11 06:26:20 +00:00
										 |  |  |          const size_type pos = static_cast<size_type>(*(--last_position_it)); | 
					
						
							| 
									
										
										
										
											2012-03-22 18:46:55 +00:00
										 |  |  |          BOOST_ASSERT(pos <= old_size_pos); | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  |          //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 | 
					
						
							|  |  |  |             ; | 
					
						
							| 
									
										
										
										
											2012-03-22 18:46:55 +00:00
										 |  |  |          if(new_hole_size > 0){ | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  |             //The hole was reduced by priv_insert_ordered_at_shift_range so expand exception rollback range backwards
 | 
					
						
							| 
									
										
										
										
											2012-03-22 18:46:55 +00:00
										 |  |  |             past_hole_values_destroyer.increment_size_backwards(next_pos - pos); | 
					
						
							|  |  |  |             //Insert the new value in the hole
 | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |             allocator_traits_type::construct(this->m_holder.alloc(), begin_ptr + pos + insertions_left - 1, *(--last_value_it)); | 
					
						
							| 
									
										
										
										
											2012-03-22 18:46:55 +00:00
										 |  |  |             --new_hole_size; | 
					
						
							|  |  |  |             if(new_hole_size == 0){ | 
					
						
							|  |  |  |                //Hole was just filled, disable exception rollback and change vector size
 | 
					
						
							|  |  |  |                past_hole_values_destroyer.release(); | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |                this->m_holder.m_size += element_count; | 
					
						
							| 
									
										
										
										
											2012-03-22 18:46:55 +00:00
										 |  |  |             } | 
					
						
							|  |  |  |             else{ | 
					
						
							|  |  |  |                //The hole was reduced by the new insertion by one
 | 
					
						
							|  |  |  |                past_hole_values_destroyer.increment_size_backwards(size_type(1u)); | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |          } | 
					
						
							|  |  |  |          else{ | 
					
						
							|  |  |  |             if(hole_size){ | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  |                //Hole was just filled by priv_insert_ordered_at_shift_range, disable exception rollback and change vector size
 | 
					
						
							| 
									
										
										
										
											2012-03-22 18:46:55 +00:00
										 |  |  |                past_hole_values_destroyer.release(); | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |                this->m_holder.m_size += element_count; | 
					
						
							| 
									
										
										
										
											2012-03-22 18:46:55 +00:00
										 |  |  |             } | 
					
						
							|  |  |  |             //Insert the new value in the already constructed range
 | 
					
						
							| 
									
										
										
										
											2012-04-11 06:26:20 +00:00
										 |  |  |             begin_ptr[pos + insertions_left - 1] = *(--last_value_it); | 
					
						
							| 
									
										
										
										
											2012-03-22 18:46:55 +00:00
										 |  |  |          } | 
					
						
							|  |  |  |          --insertions_left; | 
					
						
							|  |  |  |          hole_size = new_hole_size; | 
					
						
							|  |  |  |          next_pos = pos; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-04-11 06:26:20 +00:00
										 |  |  |    //Takes the range pointed by [first_pos, last_pos) and shifts it to the right
 | 
					
						
							|  |  |  |    //by 'shift_count'. 'limit_pos' marks the end of constructed elements.
 | 
					
						
							|  |  |  |    //
 | 
					
						
							|  |  |  |    //Precondition: first_pos <= last_pos <= limit_pos
 | 
					
						
							|  |  |  |    //
 | 
					
						
							|  |  |  |    //The shift operation might cross limit_pos so elements to moved beyond limit_pos
 | 
					
						
							|  |  |  |    //are uninitialized_moved with an allocator. Other elements are moved.
 | 
					
						
							|  |  |  |    //
 | 
					
						
							|  |  |  |    //The shift operation might left uninitialized elements after limit_pos
 | 
					
						
							|  |  |  |    //and the number of uninitialized elements is returned by the function.
 | 
					
						
							|  |  |  |    //
 | 
					
						
							|  |  |  |    //Old situation:
 | 
					
						
							|  |  |  |    //       first_pos   last_pos         old_limit
 | 
					
						
							| 
									
										
										
										
											2014-05-28 15:50:13 +02:00
										 |  |  |    //             |       |                  |
 | 
					
						
							| 
									
										
										
										
											2012-04-11 06:26:20 +00:00
										 |  |  |    // ____________V_______V__________________V_____________
 | 
					
						
							|  |  |  |    //|   prefix   | range |     suffix       |raw_mem      ~
 | 
					
						
							|  |  |  |    //|____________|_______|__________________|_____________~
 | 
					
						
							|  |  |  |    //
 | 
					
						
							| 
									
										
										
										
											2012-09-30 20:38:04 +00:00
										 |  |  |    //New situation in Case Allocator (hole_size == 0):
 | 
					
						
							| 
									
										
										
										
											2012-04-11 06:26:20 +00:00
										 |  |  |    // range is moved through move assignments
 | 
					
						
							|  |  |  |    //
 | 
					
						
							| 
									
										
										
										
											2012-09-13 18:54:58 +00:00
										 |  |  |    //       first_pos   last_pos         limit_pos
 | 
					
						
							| 
									
										
										
										
											2014-05-28 15:50:13 +02:00
										 |  |  |    //             |       |                  |
 | 
					
						
							| 
									
										
										
										
											2012-04-11 06:26:20 +00:00
										 |  |  |    // ____________V_______V__________________V_____________
 | 
					
						
							|  |  |  |    //|   prefix'  |       |  | range |suffix'|raw_mem      ~
 | 
					
						
							|  |  |  |    //|________________+______|___^___|_______|_____________~
 | 
					
						
							|  |  |  |    //                 |          |
 | 
					
						
							| 
									
										
										
										
											2014-05-28 15:50:13 +02:00
										 |  |  |    //                 |_>_>_>_>_>^
 | 
					
						
							| 
									
										
										
										
											2012-04-11 06:26:20 +00:00
										 |  |  |    //
 | 
					
						
							|  |  |  |    //
 | 
					
						
							| 
									
										
										
										
											2012-09-01 11:01:03 +00:00
										 |  |  |    //New situation in Case B (hole_size > 0):
 | 
					
						
							| 
									
										
										
										
											2012-04-11 06:26:20 +00:00
										 |  |  |    // range is moved through uninitialized moves
 | 
					
						
							|  |  |  |    //
 | 
					
						
							| 
									
										
										
										
											2012-09-13 18:54:58 +00:00
										 |  |  |    //       first_pos   last_pos         limit_pos
 | 
					
						
							| 
									
										
										
										
											2014-05-28 15:50:13 +02:00
										 |  |  |    //             |       |                  |
 | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  |    // ____________V_______V__________________V________________
 | 
					
						
							| 
									
										
										
										
											2012-04-11 06:26:20 +00:00
										 |  |  |    //|    prefix' |       |                  | [hole] | range |
 | 
					
						
							|  |  |  |    //|_______________________________________|________|___^___|
 | 
					
						
							|  |  |  |    //                 |                                   |
 | 
					
						
							|  |  |  |    //                 |_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_^
 | 
					
						
							|  |  |  |    //
 | 
					
						
							|  |  |  |    //New situation in Case C (hole_size == 0):
 | 
					
						
							|  |  |  |    // range is moved through move assignments and uninitialized moves
 | 
					
						
							|  |  |  |    //
 | 
					
						
							| 
									
										
										
										
											2012-09-13 18:54:58 +00:00
										 |  |  |    //       first_pos   last_pos         limit_pos
 | 
					
						
							| 
									
										
										
										
											2014-05-28 15:50:13 +02:00
										 |  |  |    //             |       |                  |
 | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  |    // ____________V_______V__________________V___
 | 
					
						
							| 
									
										
										
										
											2012-04-11 06:26:20 +00:00
										 |  |  |    //|   prefix'  |       |              | range |
 | 
					
						
							|  |  |  |    //|___________________________________|___^___|
 | 
					
						
							|  |  |  |    //                 |                      |
 | 
					
						
							|  |  |  |    //                 |_>_>_>_>_>_>_>_>_>_>_>^
 | 
					
						
							| 
									
										
										
										
											2012-09-13 18:54:58 +00:00
										 |  |  |    size_type priv_insert_ordered_at_shift_range | 
					
						
							|  |  |  |       (size_type first_pos, size_type last_pos, size_type limit_pos, size_type shift_count) | 
					
						
							| 
									
										
										
										
											2012-03-22 18:46:55 +00:00
										 |  |  |    { | 
					
						
							|  |  |  |       BOOST_ASSERT(first_pos <= last_pos); | 
					
						
							|  |  |  |       BOOST_ASSERT(last_pos <= limit_pos); | 
					
						
							|  |  |  |       //
 | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |       T* const begin_ptr = container_detail::to_raw_pointer(this->m_holder.start()); | 
					
						
							| 
									
										
										
										
											2012-09-13 18:54:58 +00:00
										 |  |  |       T* const first_ptr = begin_ptr + first_pos; | 
					
						
							|  |  |  |       T* const last_ptr  = begin_ptr + last_pos; | 
					
						
							| 
									
										
										
										
											2012-03-22 18:46:55 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |       size_type hole_size = 0; | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |       //Case A:
 | 
					
						
							| 
									
										
										
										
											2012-04-11 06:26:20 +00:00
										 |  |  |       if((last_pos + shift_count) <= limit_pos){ | 
					
						
							|  |  |  |          //All move assigned
 | 
					
						
							| 
									
										
										
										
											2012-09-13 18:54:58 +00:00
										 |  |  |          boost::move_backward(first_ptr, last_ptr, last_ptr + shift_count); | 
					
						
							| 
									
										
										
										
											2012-03-22 18:46:55 +00:00
										 |  |  |       } | 
					
						
							| 
									
										
										
										
											2012-04-11 06:26:20 +00:00
										 |  |  |       //Case B:
 | 
					
						
							| 
									
										
										
										
											2012-03-22 18:46:55 +00:00
										 |  |  |       else if((first_pos + shift_count) >= limit_pos){ | 
					
						
							| 
									
										
										
										
											2012-04-11 06:26:20 +00:00
										 |  |  |          //All uninitialized_moved
 | 
					
						
							| 
									
										
										
										
											2013-02-24 13:13:36 +00:00
										 |  |  |          ::boost::container::uninitialized_move_alloc | 
					
						
							|  |  |  |             (this->m_holder.alloc(), first_ptr, last_ptr, first_ptr + shift_count); | 
					
						
							| 
									
										
										
										
											2012-03-22 18:46:55 +00:00
										 |  |  |          hole_size = last_pos + shift_count - limit_pos; | 
					
						
							|  |  |  |       } | 
					
						
							| 
									
										
										
										
											2012-04-11 06:26:20 +00:00
										 |  |  |       //Case C:
 | 
					
						
							| 
									
										
										
										
											2012-03-22 18:46:55 +00:00
										 |  |  |       else{ | 
					
						
							| 
									
										
										
										
											2012-04-11 06:26:20 +00:00
										 |  |  |          //Some uninitialized_moved
 | 
					
						
							|  |  |  |          T* const limit_ptr    = begin_ptr + limit_pos; | 
					
						
							|  |  |  |          T* const boundary_ptr = limit_ptr - shift_count; | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |          ::boost::container::uninitialized_move_alloc(this->m_holder.alloc(), boundary_ptr, last_ptr, limit_ptr); | 
					
						
							| 
									
										
										
										
											2012-04-11 06:26:20 +00:00
										 |  |  |          //The rest is move assigned
 | 
					
						
							| 
									
										
										
										
											2012-09-13 18:54:58 +00:00
										 |  |  |          boost::move_backward(first_ptr, boundary_ptr, limit_ptr); | 
					
						
							| 
									
										
										
										
											2012-03-22 18:46:55 +00:00
										 |  |  |       } | 
					
						
							|  |  |  |       return hole_size; | 
					
						
							|  |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    private: | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |    template <class InsertionProxy> | 
					
						
							| 
									
										
										
										
											2013-03-03 12:26:48 +00:00
										 |  |  |    void priv_forward_range_insert_at_end_expand_forward(const size_type n, InsertionProxy insert_range_proxy) | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |    { | 
					
						
							|  |  |  |       T* const old_finish = container_detail::to_raw_pointer(this->m_holder.start()) + this->m_holder.m_size; | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |       insert_range_proxy.uninitialized_copy_n_and_update(this->m_holder.alloc(), old_finish, n); | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |       this->m_holder.m_size += n; | 
					
						
							|  |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-11-24 21:08:18 +00:00
										 |  |  |    template <class InsertionProxy> | 
					
						
							| 
									
										
										
										
											2013-03-03 12:26:48 +00:00
										 |  |  |    void priv_forward_range_insert_expand_forward(T* const pos, const size_type n, InsertionProxy insert_range_proxy) | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    { | 
					
						
							|  |  |  |       //n can't be 0, because there is nothing to do in that case
 | 
					
						
							|  |  |  |       if(!n) return; | 
					
						
							|  |  |  |       //There is enough memory
 | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |       T* const old_finish = container_detail::to_raw_pointer(this->m_holder.start()) + this->m_holder.m_size; | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |       const size_type elems_after = old_finish - pos; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-11-24 21:08:18 +00:00
										 |  |  |       if (!elems_after){ | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |          insert_range_proxy.uninitialized_copy_n_and_update(this->m_holder.alloc(), old_finish, n); | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |          this->m_holder.m_size += n; | 
					
						
							| 
									
										
										
										
											2012-11-24 21:08:18 +00:00
										 |  |  |       } | 
					
						
							|  |  |  |       else if (elems_after >= n){ | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |          //New elements can be just copied.
 | 
					
						
							|  |  |  |          //Move to uninitialized memory last objects
 | 
					
						
							| 
									
										
										
										
											2011-12-22 20:08:24 +00:00
										 |  |  |          ::boost::container::uninitialized_move_alloc | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |             (this->m_holder.alloc(), old_finish - n, old_finish, old_finish); | 
					
						
							|  |  |  |          this->m_holder.m_size += n; | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |          //Copy previous to last objects to the initialized end
 | 
					
						
							|  |  |  |          boost::move_backward(pos, old_finish - n, old_finish); | 
					
						
							|  |  |  |          //Insert new objects in the pos
 | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |          insert_range_proxy.copy_n_and_update(this->m_holder.alloc(), pos, n); | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |       } | 
					
						
							|  |  |  |       else { | 
					
						
							| 
									
										
										
										
											2012-11-24 21:08:18 +00:00
										 |  |  |          //The new elements don't fit in the [pos, end()) range.
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |          //Copy old [pos, end()) elements to the uninitialized memory (a gap is created)
 | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |          ::boost::container::uninitialized_move_alloc(this->m_holder.alloc(), pos, old_finish, pos + n); | 
					
						
							| 
									
										
										
										
											2012-11-24 21:08:18 +00:00
										 |  |  |          BOOST_TRY{ | 
					
						
							|  |  |  |             //Copy first new elements in pos (gap is still there)
 | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |             insert_range_proxy.copy_n_and_update(this->m_holder.alloc(), pos, elems_after); | 
					
						
							| 
									
										
										
										
											2012-11-24 21:08:18 +00:00
										 |  |  |             //Copy to the beginning of the unallocated zone the last new elements (the gap is closed).
 | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |             insert_range_proxy.uninitialized_copy_n_and_update(this->m_holder.alloc(), old_finish, n - elems_after); | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |             this->m_holder.m_size += n; | 
					
						
							| 
									
										
										
										
											2012-11-24 21:08:18 +00:00
										 |  |  |          } | 
					
						
							|  |  |  |          BOOST_CATCH(...){ | 
					
						
							| 
									
										
										
										
											2013-03-03 12:26:48 +00:00
										 |  |  |             boost::container::destroy_alloc_n(this->get_stored_allocator(), pos + n, elems_after); | 
					
						
							| 
									
										
										
										
											2012-11-24 21:08:18 +00:00
										 |  |  |             BOOST_RETHROW | 
					
						
							|  |  |  |          } | 
					
						
							|  |  |  |          BOOST_CATCH_END | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |       } | 
					
						
							|  |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-11-24 21:08:18 +00:00
										 |  |  |    template <class InsertionProxy> | 
					
						
							| 
									
										
										
										
											2013-03-03 12:26:48 +00:00
										 |  |  |    void priv_forward_range_insert_new_allocation | 
					
						
							| 
									
										
										
										
											2012-11-24 21:08:18 +00:00
										 |  |  |       (T* const new_start, size_type new_cap, T* const pos, const size_type n, InsertionProxy insert_range_proxy) | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    { | 
					
						
							|  |  |  |       //n can be zero, if we want to reallocate!
 | 
					
						
							|  |  |  |       T *new_finish = new_start; | 
					
						
							|  |  |  |       T *old_finish; | 
					
						
							|  |  |  |       //Anti-exception rollbacks
 | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |       typename value_traits::ArrayDeallocator new_buffer_deallocator(new_start, this->m_holder.alloc(), new_cap); | 
					
						
							|  |  |  |       typename value_traits::ArrayDestructor  new_values_destroyer(new_start, this->m_holder.alloc(), 0u); | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  |       //Initialize with [begin(), pos) old buffer
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |       //the start of the new buffer
 | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |       T * const old_buffer = container_detail::to_raw_pointer(this->m_holder.start()); | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |       if(old_buffer){ | 
					
						
							| 
									
										
										
										
											2011-12-22 20:08:24 +00:00
										 |  |  |          new_finish = ::boost::container::uninitialized_move_alloc | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |             (this->m_holder.alloc(), container_detail::to_raw_pointer(this->m_holder.start()), pos, old_finish = new_finish); | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |          new_values_destroyer.increment_size(new_finish - old_finish); | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |       } | 
					
						
							|  |  |  |       //Initialize new objects, starting from previous point
 | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |       old_finish = new_finish; | 
					
						
							|  |  |  |       insert_range_proxy.uninitialized_copy_n_and_update(this->m_holder.alloc(), old_finish, n); | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |       new_finish += n; | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |       new_values_destroyer.increment_size(new_finish - old_finish); | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  |       //Initialize from the rest of the old buffer,
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |       //starting from previous point
 | 
					
						
							|  |  |  |       if(old_buffer){ | 
					
						
							| 
									
										
										
										
											2011-12-22 20:08:24 +00:00
										 |  |  |          new_finish = ::boost::container::uninitialized_move_alloc | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |             (this->m_holder.alloc(), pos, old_buffer + this->m_holder.m_size, new_finish); | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |          //Destroy and deallocate old elements
 | 
					
						
							|  |  |  |          //If there is allocated memory, destroy and deallocate
 | 
					
						
							|  |  |  |          if(!value_traits::trivial_dctr_after_move) | 
					
						
							| 
									
										
										
										
											2013-03-03 12:26:48 +00:00
										 |  |  |             boost::container::destroy_alloc_n(this->get_stored_allocator(), old_buffer, this->m_holder.m_size); | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |          this->m_holder.alloc().deallocate(this->m_holder.start(), this->m_holder.capacity()); | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |       } | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |       this->m_holder.start(new_start); | 
					
						
							|  |  |  |       this->m_holder.m_size = new_finish - new_start; | 
					
						
							|  |  |  |       this->m_holder.capacity(new_cap); | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |       //All construction successful, disable rollbacks
 | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |       new_values_destroyer.release(); | 
					
						
							|  |  |  |       new_buffer_deallocator.release(); | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-11-24 21:08:18 +00:00
										 |  |  |    template <class InsertionProxy> | 
					
						
							| 
									
										
										
										
											2013-03-03 12:26:48 +00:00
										 |  |  |    void priv_forward_range_insert_expand_backwards | 
					
						
							| 
									
										
										
										
											2012-11-24 21:08:18 +00:00
										 |  |  |          (T* const new_start, const size_type new_capacity, | 
					
						
							|  |  |  |           T* const pos, const size_type n, InsertionProxy insert_range_proxy) | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    { | 
					
						
							|  |  |  |       //n can be zero to just expand capacity
 | 
					
						
							|  |  |  |       //Backup old data
 | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |       T* const old_start  = container_detail::to_raw_pointer(this->m_holder.start()); | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |       const size_type old_size = this->m_holder.m_size; | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |       T* const old_finish = old_start + old_size; | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |       //We can have 8 possibilities:
 | 
					
						
							| 
									
										
										
										
											2012-11-24 21:08:18 +00:00
										 |  |  |       const size_type elemsbefore = static_cast<size_type>(pos - old_start); | 
					
						
							|  |  |  |       const size_type s_before    = static_cast<size_type>(old_start - new_start); | 
					
						
							|  |  |  |       const size_type before_plus_new = elemsbefore + n; | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |       //Update the vector buffer information to a safe state
 | 
					
						
							| 
									
										
										
										
											2013-02-19 21:35:46 +00:00
										 |  |  |       this->m_holder.start(new_start); | 
					
						
							|  |  |  |       this->m_holder.capacity(new_capacity); | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |       this->m_holder.m_size = 0; | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |       //If anything goes wrong, this object will destroy
 | 
					
						
							|  |  |  |       //all the old objects to fulfill previous vector state
 | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |       typename value_traits::ArrayDestructor old_values_destroyer(old_start, this->m_holder.alloc(), old_size); | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |       //Check if s_before is big enough to hold the beginning of old data + new data
 | 
					
						
							| 
									
										
										
										
											2012-11-24 21:08:18 +00:00
										 |  |  |       if(s_before >= before_plus_new){ | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |          //Copy first old values before pos, after that the new objects
 | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |          T *const new_elem_pos = | 
					
						
							|  |  |  |             ::boost::container::uninitialized_move_alloc(this->m_holder.alloc(), old_start, pos, new_start); | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |          this->m_holder.m_size = elemsbefore; | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |          insert_range_proxy.uninitialized_copy_n_and_update(this->m_holder.alloc(), new_elem_pos, n); | 
					
						
							|  |  |  |          this->m_holder.m_size = before_plus_new; | 
					
						
							|  |  |  |          const size_type new_size = old_size + n; | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |          //Check if s_before is so big that even copying the old data + new data
 | 
					
						
							|  |  |  |          //there is a gap between the new data and the old data
 | 
					
						
							| 
									
										
										
										
											2012-11-24 21:08:18 +00:00
										 |  |  |          if(s_before >= new_size){ | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |             //Old situation:
 | 
					
						
							|  |  |  |             // _________________________________________________________
 | 
					
						
							|  |  |  |             //|            raw_mem                | old_begin | old_end |
 | 
					
						
							|  |  |  |             //| __________________________________|___________|_________|
 | 
					
						
							|  |  |  |             //
 | 
					
						
							|  |  |  |             //New situation:
 | 
					
						
							|  |  |  |             // _________________________________________________________
 | 
					
						
							|  |  |  |             //| old_begin |    new   | old_end |         raw_mem        |
 | 
					
						
							|  |  |  |             //|___________|__________|_________|________________________|
 | 
					
						
							|  |  |  |             //
 | 
					
						
							|  |  |  |             //Now initialize the rest of memory with the last old values
 | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |             if(before_plus_new != new_size){ //Special case to avoid operations in back insertion
 | 
					
						
							|  |  |  |                ::boost::container::uninitialized_move_alloc | 
					
						
							|  |  |  |                   (this->m_holder.alloc(), pos, old_finish, new_start + before_plus_new); | 
					
						
							|  |  |  |                //All new elements correctly constructed, avoid new element destruction
 | 
					
						
							|  |  |  |                this->m_holder.m_size = new_size; | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |             //Old values destroyed automatically with "old_values_destroyer"
 | 
					
						
							|  |  |  |             //when "old_values_destroyer" goes out of scope unless the have trivial
 | 
					
						
							|  |  |  |             //destructor after move.
 | 
					
						
							|  |  |  |             if(value_traits::trivial_dctr_after_move) | 
					
						
							|  |  |  |                old_values_destroyer.release(); | 
					
						
							|  |  |  |          } | 
					
						
							|  |  |  |          //s_before is so big that divides old_end
 | 
					
						
							|  |  |  |          else{ | 
					
						
							|  |  |  |             //Old situation:
 | 
					
						
							|  |  |  |             // __________________________________________________
 | 
					
						
							|  |  |  |             //|            raw_mem         | old_begin | old_end |
 | 
					
						
							|  |  |  |             //| ___________________________|___________|_________|
 | 
					
						
							|  |  |  |             //
 | 
					
						
							|  |  |  |             //New situation:
 | 
					
						
							|  |  |  |             // __________________________________________________
 | 
					
						
							|  |  |  |             //| old_begin |   new    | old_end |  raw_mem        |
 | 
					
						
							|  |  |  |             //|___________|__________|_________|_________________|
 | 
					
						
							|  |  |  |             //
 | 
					
						
							|  |  |  |             //Now initialize the rest of memory with the last old values
 | 
					
						
							|  |  |  |             //All new elements correctly constructed, avoid new element destruction
 | 
					
						
							| 
									
										
										
										
											2012-11-24 21:08:18 +00:00
										 |  |  |             const size_type raw_gap = s_before - before_plus_new; | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |             if(!value_traits::trivial_dctr){ | 
					
						
							|  |  |  |                //Now initialize the rest of s_before memory with the
 | 
					
						
							|  |  |  |                //first of elements after new values
 | 
					
						
							|  |  |  |                ::boost::container::uninitialized_move_alloc_n | 
					
						
							|  |  |  |                   (this->m_holder.alloc(), pos, raw_gap, new_start + before_plus_new); | 
					
						
							|  |  |  |                //Now we have a contiguous buffer so program trailing element destruction
 | 
					
						
							|  |  |  |                //and update size to the final size.
 | 
					
						
							| 
									
										
										
										
											2014-09-17 21:52:34 +02:00
										 |  |  |                old_values_destroyer.shrink_forward(new_size-s_before); | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |                this->m_holder.m_size = new_size; | 
					
						
							|  |  |  |                //Now move remaining last objects in the old buffer begin
 | 
					
						
							|  |  |  |                ::boost::move(pos + raw_gap, 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.m_size = new_size; | 
					
						
							|  |  |  |                old_values_destroyer.release(); | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |          } | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       else{ | 
					
						
							|  |  |  |          //Check if we have to do the insertion in two phases
 | 
					
						
							|  |  |  |          //since maybe s_before is not big enough and
 | 
					
						
							|  |  |  |          //the buffer was expanded both sides
 | 
					
						
							|  |  |  |          //
 | 
					
						
							|  |  |  |          //Old situation:
 | 
					
						
							|  |  |  |          // _________________________________________________
 | 
					
						
							|  |  |  |          //| raw_mem | old_begin + old_end |  raw_mem        |
 | 
					
						
							|  |  |  |          //|_________|_____________________|_________________|
 | 
					
						
							|  |  |  |          //
 | 
					
						
							|  |  |  |          //New situation with do_after:
 | 
					
						
							|  |  |  |          // _________________________________________________
 | 
					
						
							|  |  |  |          //|     old_begin + new + old_end     |  raw_mem    |
 | 
					
						
							|  |  |  |          //|___________________________________|_____________|
 | 
					
						
							|  |  |  |          //
 | 
					
						
							|  |  |  |          //New without do_after:
 | 
					
						
							|  |  |  |          // _________________________________________________
 | 
					
						
							|  |  |  |          //| old_begin + new + old_end  |  raw_mem           |
 | 
					
						
							|  |  |  |          //|____________________________|____________________|
 | 
					
						
							|  |  |  |          //
 | 
					
						
							| 
									
										
										
										
											2012-11-24 21:08:18 +00:00
										 |  |  |          const bool do_after = n > s_before; | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |          //Now we can have two situations: the raw_mem of the
 | 
					
						
							|  |  |  |          //beginning divides the old_begin, or the new elements:
 | 
					
						
							|  |  |  |          if (s_before <= elemsbefore) { | 
					
						
							|  |  |  |             //The raw memory divides the old_begin group:
 | 
					
						
							|  |  |  |             //
 | 
					
						
							|  |  |  |             //If we need two phase construction (do_after)
 | 
					
						
							|  |  |  |             //new group is divided in new = new_beg + new_end groups
 | 
					
						
							|  |  |  |             //In this phase only new_beg will be inserted
 | 
					
						
							|  |  |  |             //
 | 
					
						
							|  |  |  |             //Old situation:
 | 
					
						
							|  |  |  |             // _________________________________________________
 | 
					
						
							|  |  |  |             //| raw_mem | old_begin | old_end |  raw_mem        |
 | 
					
						
							|  |  |  |             //|_________|___________|_________|_________________|
 | 
					
						
							|  |  |  |             //
 | 
					
						
							|  |  |  |             //New situation with do_after(1):
 | 
					
						
							|  |  |  |             //This is not definitive situation, the second phase
 | 
					
						
							|  |  |  |             //will include
 | 
					
						
							|  |  |  |             // _________________________________________________
 | 
					
						
							|  |  |  |             //| old_begin | new_beg | old_end |  raw_mem        |
 | 
					
						
							|  |  |  |             //|___________|_________|_________|_________________|
 | 
					
						
							|  |  |  |             //
 | 
					
						
							|  |  |  |             //New situation without do_after:
 | 
					
						
							|  |  |  |             // _________________________________________________
 | 
					
						
							|  |  |  |             //| old_begin | new | old_end |  raw_mem            |
 | 
					
						
							|  |  |  |             //|___________|_____|_________|_____________________|
 | 
					
						
							|  |  |  |             //
 | 
					
						
							|  |  |  |             //Copy the first part of old_begin to raw_mem
 | 
					
						
							| 
									
										
										
										
											2012-11-24 21:08:18 +00:00
										 |  |  |             ::boost::container::uninitialized_move_alloc_n | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |                (this->m_holder.alloc(), old_start, s_before, new_start); | 
					
						
							| 
									
										
										
										
											2014-09-21 23:57:23 +02:00
										 |  |  |             //The buffer is all constructed until old_end,
 | 
					
						
							|  |  |  |             //so program trailing destruction and assign final size
 | 
					
						
							|  |  |  |             //if !do_after, s_before+n otherwise.
 | 
					
						
							|  |  |  |             size_type new_1st_range; | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |             if(do_after){ | 
					
						
							| 
									
										
										
										
											2014-09-21 23:57:23 +02:00
										 |  |  |                new_1st_range = s_before; | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |                //release destroyer and update size
 | 
					
						
							|  |  |  |                old_values_destroyer.release(); | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |             } | 
					
						
							|  |  |  |             else{ | 
					
						
							| 
									
										
										
										
											2014-09-21 23:57:23 +02:00
										 |  |  |                new_1st_range = n; | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |                if(value_traits::trivial_dctr_after_move) | 
					
						
							|  |  |  |                   old_values_destroyer.release(); | 
					
						
							| 
									
										
										
										
											2014-09-21 23:57:23 +02:00
										 |  |  |                else{ | 
					
						
							|  |  |  |                   old_values_destroyer.shrink_forward(old_size - (s_before - n)); | 
					
						
							|  |  |  |                } | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |             this->m_holder.m_size = old_size + new_1st_range; | 
					
						
							|  |  |  |             //Now copy the second part of old_begin overwriting itself
 | 
					
						
							|  |  |  |             T *const next = ::boost::move(old_start + s_before, pos, old_start); | 
					
						
							|  |  |  |             //Now copy the new_beg elements
 | 
					
						
							|  |  |  |             insert_range_proxy.copy_n_and_update(this->m_holder.alloc(), next, new_1st_range); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             //If there is no after work and the last old part needs to be moved to front, do it
 | 
					
						
							|  |  |  |             if(!do_after && (n != s_before)){ | 
					
						
							|  |  |  |                //Now displace old_end elements
 | 
					
						
							|  |  |  |                ::boost::move(pos, old_finish, next + new_1st_range); | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |             } | 
					
						
							|  |  |  |          } | 
					
						
							|  |  |  |          else { | 
					
						
							|  |  |  |             //If we have to expand both sides,
 | 
					
						
							|  |  |  |             //we will play if the first new values so
 | 
					
						
							|  |  |  |             //calculate the upper bound of new values
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             //The raw memory divides the new elements
 | 
					
						
							|  |  |  |             //
 | 
					
						
							|  |  |  |             //If we need two phase construction (do_after)
 | 
					
						
							|  |  |  |             //new group is divided in new = new_beg + new_end groups
 | 
					
						
							|  |  |  |             //In this phase only new_beg will be inserted
 | 
					
						
							|  |  |  |             //
 | 
					
						
							|  |  |  |             //Old situation:
 | 
					
						
							|  |  |  |             // _______________________________________________________
 | 
					
						
							|  |  |  |             //|   raw_mem     | old_begin | old_end |  raw_mem        |
 | 
					
						
							|  |  |  |             //|_______________|___________|_________|_________________|
 | 
					
						
							|  |  |  |             //
 | 
					
						
							|  |  |  |             //New situation with do_after():
 | 
					
						
							|  |  |  |             // ____________________________________________________
 | 
					
						
							|  |  |  |             //| old_begin |    new_beg    | old_end |  raw_mem     |
 | 
					
						
							|  |  |  |             //|___________|_______________|_________|______________|
 | 
					
						
							|  |  |  |             //
 | 
					
						
							|  |  |  |             //New situation without do_after:
 | 
					
						
							|  |  |  |             // ______________________________________________________
 | 
					
						
							|  |  |  |             //| old_begin | new | old_end |  raw_mem                 |
 | 
					
						
							|  |  |  |             //|___________|_____|_________|__________________________|
 | 
					
						
							|  |  |  |             //
 | 
					
						
							|  |  |  |             //First copy whole old_begin and part of new to raw_mem
 | 
					
						
							| 
									
										
										
										
											2012-11-24 21:08:18 +00:00
										 |  |  |             T * const new_pos = ::boost::container::uninitialized_move_alloc | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |                (this->m_holder.alloc(), old_start, pos, new_start); | 
					
						
							|  |  |  |             this->m_holder.m_size = elemsbefore; | 
					
						
							| 
									
										
										
										
											2012-11-24 21:08:18 +00:00
										 |  |  |             const size_type mid_n = s_before - elemsbefore; | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |             insert_range_proxy.uninitialized_copy_n_and_update(this->m_holder.alloc(), new_pos, mid_n); | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |             //The buffer is all constructed until old_end,
 | 
					
						
							| 
									
										
										
										
											2012-11-24 21:08:18 +00:00
										 |  |  |             //release destroyer
 | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |             this->m_holder.m_size = old_size + s_before; | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |             old_values_destroyer.release(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             if(do_after){ | 
					
						
							|  |  |  |                //Copy new_beg part
 | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |                insert_range_proxy.copy_n_and_update(this->m_holder.alloc(), old_start, elemsbefore); | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |             } | 
					
						
							|  |  |  |             else{ | 
					
						
							|  |  |  |                //Copy all new elements
 | 
					
						
							| 
									
										
										
										
											2012-11-24 21:08:18 +00:00
										 |  |  |                const size_type rest_new = n - mid_n; | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |                insert_range_proxy.copy_n_and_update(this->m_holder.alloc(), old_start, rest_new); | 
					
						
							|  |  |  |                T* const move_start = old_start + rest_new; | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |                //Displace old_end
 | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |                T* const move_end = ::boost::move(pos, old_finish, move_start); | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |                //Destroy remaining moved elements from old_end except if they
 | 
					
						
							|  |  |  |                //have trivial destructor after being moved
 | 
					
						
							| 
									
										
										
										
											2012-11-24 21:08:18 +00:00
										 |  |  |                size_type n_destroy = s_before - n; | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |                if(!value_traits::trivial_dctr_after_move) | 
					
						
							| 
									
										
										
										
											2013-03-03 12:26:48 +00:00
										 |  |  |                   boost::container::destroy_alloc_n(this->get_stored_allocator(), move_end, n_destroy); | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |                this->m_holder.m_size -= n_destroy; | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |             } | 
					
						
							|  |  |  |          } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |          //This is only executed if two phase construction is needed
 | 
					
						
							|  |  |  |          if(do_after){ | 
					
						
							|  |  |  |             //The raw memory divides the new elements
 | 
					
						
							|  |  |  |             //
 | 
					
						
							|  |  |  |             //Old situation:
 | 
					
						
							|  |  |  |             // ______________________________________________________
 | 
					
						
							|  |  |  |             //|   raw_mem    | old_begin |  old_end   |  raw_mem     |
 | 
					
						
							|  |  |  |             //|______________|___________|____________|______________|
 | 
					
						
							|  |  |  |             //
 | 
					
						
							|  |  |  |             //New situation with do_after(1):
 | 
					
						
							|  |  |  |             // _______________________________________________________
 | 
					
						
							|  |  |  |             //| old_begin   +   new_beg  | new_end |old_end | raw_mem |
 | 
					
						
							|  |  |  |             //|__________________________|_________|________|_________|
 | 
					
						
							|  |  |  |             //
 | 
					
						
							|  |  |  |             //New situation with do_after(2):
 | 
					
						
							|  |  |  |             // ______________________________________________________
 | 
					
						
							|  |  |  |             //| old_begin      +       new            | old_end |raw |
 | 
					
						
							|  |  |  |             //|_______________________________________|_________|____|
 | 
					
						
							|  |  |  |             //
 | 
					
						
							| 
									
										
										
										
											2012-11-24 21:08:18 +00:00
										 |  |  |             const size_type n_after    = n - s_before; | 
					
						
							|  |  |  |             const size_type elemsafter = old_size - elemsbefore; | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |             //We can have two situations:
 | 
					
						
							| 
									
										
										
										
											2012-11-24 21:08:18 +00:00
										 |  |  |             if (elemsafter >= n_after){ | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |                //The raw_mem from end will divide displaced old_end
 | 
					
						
							|  |  |  |                //
 | 
					
						
							|  |  |  |                //Old situation:
 | 
					
						
							|  |  |  |                // ______________________________________________________
 | 
					
						
							|  |  |  |                //|   raw_mem    | old_begin |  old_end   |  raw_mem     |
 | 
					
						
							|  |  |  |                //|______________|___________|____________|______________|
 | 
					
						
							|  |  |  |                //
 | 
					
						
							|  |  |  |                //New situation with do_after(1):
 | 
					
						
							|  |  |  |                // _______________________________________________________
 | 
					
						
							|  |  |  |                //| old_begin   +   new_beg  | new_end |old_end | raw_mem |
 | 
					
						
							|  |  |  |                //|__________________________|_________|________|_________|
 | 
					
						
							|  |  |  |                //
 | 
					
						
							|  |  |  |                //First copy the part of old_end raw_mem
 | 
					
						
							| 
									
										
										
										
											2012-11-24 21:08:18 +00:00
										 |  |  |                T* finish_n = old_finish - n_after; | 
					
						
							| 
									
										
										
										
											2011-12-22 20:08:24 +00:00
										 |  |  |                ::boost::container::uninitialized_move_alloc | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |                   (this->m_holder.alloc(), finish_n, old_finish, old_finish); | 
					
						
							|  |  |  |                this->m_holder.m_size += n_after; | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |                //Displace the rest of old_end to the new position
 | 
					
						
							|  |  |  |                boost::move_backward(pos, finish_n, old_finish); | 
					
						
							|  |  |  |                //Now overwrite with new_end
 | 
					
						
							|  |  |  |                //The new_end part is [first + (n - n_after), last)
 | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |                insert_range_proxy.copy_n_and_update(this->m_holder.alloc(), pos, n_after); | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |             } | 
					
						
							|  |  |  |             else { | 
					
						
							|  |  |  |                //The raw_mem from end will divide new_end part
 | 
					
						
							|  |  |  |                //
 | 
					
						
							|  |  |  |                //Old situation:
 | 
					
						
							|  |  |  |                // _____________________________________________________________
 | 
					
						
							|  |  |  |                //|   raw_mem    | old_begin |  old_end   |  raw_mem            |
 | 
					
						
							|  |  |  |                //|______________|___________|____________|_____________________|
 | 
					
						
							|  |  |  |                //
 | 
					
						
							|  |  |  |                //New situation with do_after(2):
 | 
					
						
							|  |  |  |                // _____________________________________________________________
 | 
					
						
							|  |  |  |                //| old_begin   +   new_beg  |     new_end   |old_end | raw_mem |
 | 
					
						
							|  |  |  |                //|__________________________|_______________|________|_________|
 | 
					
						
							|  |  |  |                //
 | 
					
						
							| 
									
										
										
										
											2012-11-24 21:08:18 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |                const size_type mid_last_dist = n_after - elemsafter; | 
					
						
							|  |  |  |                //First initialize data in raw memory
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                //Copy to the old_end part to the uninitialized zone leaving a gap.
 | 
					
						
							|  |  |  |                ::boost::container::uninitialized_move_alloc | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  |                   (this->m_holder.alloc(), pos, old_finish, old_finish + mid_last_dist); | 
					
						
							| 
									
										
										
										
											2012-11-24 21:08:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-09-21 23:57:23 +02:00
										 |  |  |                typename value_traits::ArrayDestructor old_end_destroyer | 
					
						
							|  |  |  |                   (old_finish + mid_last_dist, this->m_holder.alloc(), old_finish - pos); | 
					
						
							| 
									
										
										
										
											2012-11-24 21:08:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-09-21 23:57:23 +02:00
										 |  |  |                //Copy the first part to the already constructed old_end zone
 | 
					
						
							|  |  |  |                insert_range_proxy.copy_n_and_update(this->m_holder.alloc(), pos, elemsafter); | 
					
						
							|  |  |  |                //Copy the rest to the uninitialized zone filling the gap
 | 
					
						
							|  |  |  |                insert_range_proxy.uninitialized_copy_n_and_update(this->m_holder.alloc(), old_finish, mid_last_dist); | 
					
						
							|  |  |  |                this->m_holder.m_size += n_after; | 
					
						
							|  |  |  |                old_end_destroyer.release(); | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |             } | 
					
						
							|  |  |  |          } | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-20 10:02:49 +00:00
										 |  |  |    void priv_check_range(size_type n) const | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    { | 
					
						
							|  |  |  |       //If n is out of range, throw an out_of_range exception
 | 
					
						
							| 
									
										
										
										
											2013-01-10 10:55:50 +00:00
										 |  |  |       if (n >= this->size()){ | 
					
						
							|  |  |  |          throw_out_of_range("vector::at out of range"); | 
					
						
							|  |  |  |       } | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-22 20:08:24 +00:00
										 |  |  |    #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  |    public: | 
					
						
							|  |  |  |    unsigned int num_expand_fwd; | 
					
						
							|  |  |  |    unsigned int num_expand_bwd; | 
					
						
							|  |  |  |    unsigned int num_shrink; | 
					
						
							|  |  |  |    unsigned int num_alloc; | 
					
						
							|  |  |  |    void reset_alloc_stats() | 
					
						
							|  |  |  |    {  num_expand_fwd = num_expand_bwd = num_alloc = 0, num_shrink = 0;   } | 
					
						
							|  |  |  |    #endif
 | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  |    #endif   //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | }} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  | #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | namespace boost { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-09-26 08:12:40 +02:00
										 |  |  | /*
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | //!has_trivial_destructor_after_move<> == true_type
 | 
					
						
							|  |  |  | //!specialization for optimizations
 | 
					
						
							| 
									
										
										
										
											2012-09-30 20:38:04 +00:00
										 |  |  | template <class T, class Allocator> | 
					
						
							|  |  |  | struct has_trivial_destructor_after_move<boost::container::vector<T, Allocator> > | 
					
						
							| 
									
										
										
										
											2012-11-24 21:08:18 +00:00
										 |  |  |    : public ::boost::has_trivial_destructor_after_move<Allocator> | 
					
						
							|  |  |  | {}; | 
					
						
							| 
									
										
										
										
											2014-09-26 08:12:40 +02:00
										 |  |  | */ | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-02-12 21:26:21 +00:00
										 |  |  | //#define BOOST_CONTAINER_PUT_SWAP_OVERLOAD_IN_NAMESPACE_STD
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #ifdef BOOST_CONTAINER_PUT_SWAP_OVERLOAD_IN_NAMESPACE_STD
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace std { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | template <class T, class Allocator> | 
					
						
							|  |  |  | inline void swap(boost::container::vector<T, Allocator>& x, boost::container::vector<T, Allocator>& y) | 
					
						
							|  |  |  | {  x.swap(y);  } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | }  //namespace std {
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-12-23 10:47:20 +01:00
										 |  |  | #endif   //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:25:51 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | #include <boost/container/detail/config_end.hpp>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-22 20:08:24 +00:00
										 |  |  | #endif //   #ifndef  BOOST_CONTAINER_CONTAINER_VECTOR_HPP
 |