Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r80687 - trunk/boost/container
From: igaztanaga_at_[hidden]
Date: 2012-09-24 06:27:54


Author: igaztanaga
Date: 2012-09-24 06:27:53 EDT (Mon, 24 Sep 2012)
New Revision: 80687
URL: http://svn.boost.org/trac/boost/changeset/80687

Log:
Reordered sequence container types and functions to improve Doxygen documentation
Text files modified:
   trunk/boost/container/deque.hpp | 1186 ++++++++++++++++++++-------------------
   1 files changed, 599 insertions(+), 587 deletions(-)

Modified: trunk/boost/container/deque.hpp
==============================================================================
--- trunk/boost/container/deque.hpp (original)
+++ trunk/boost/container/deque.hpp 2012-09-24 06:27:53 EDT (Mon, 24 Sep 2012)
@@ -101,17 +101,17 @@
 {
    BOOST_COPYABLE_AND_MOVABLE(deque_base)
    public:
- typedef allocator_traits<A> val_alloc_traits_type;
- typedef typename val_alloc_traits_type::value_type val_alloc_val;
- typedef typename val_alloc_traits_type::pointer val_alloc_ptr;
- typedef typename val_alloc_traits_type::const_pointer val_alloc_cptr;
- typedef typename val_alloc_traits_type::reference val_alloc_ref;
- typedef typename val_alloc_traits_type::const_reference val_alloc_cref;
- typedef typename val_alloc_traits_type::difference_type val_alloc_diff;
- typedef typename val_alloc_traits_type::size_type val_alloc_size;
+ typedef allocator_traits<A> val_alloc_traits_type;
+ typedef typename val_alloc_traits_type::value_type val_alloc_val;
+ typedef typename val_alloc_traits_type::pointer val_alloc_ptr;
+ typedef typename val_alloc_traits_type::const_pointer val_alloc_cptr;
+ typedef typename val_alloc_traits_type::reference val_alloc_ref;
+ typedef typename val_alloc_traits_type::const_reference val_alloc_cref;
+ typedef typename val_alloc_traits_type::difference_type val_alloc_diff;
+ typedef typename val_alloc_traits_type::size_type val_alloc_size;
    typedef typename val_alloc_traits_type::template
- portable_rebind_alloc<val_alloc_ptr>::type ptr_alloc_t;
- typedef allocator_traits<ptr_alloc_t> ptr_alloc_traits_type;
+ portable_rebind_alloc<val_alloc_ptr>::type ptr_alloc_t;
+ typedef allocator_traits<ptr_alloc_t> ptr_alloc_traits_type;
    typedef typename ptr_alloc_traits_type::value_type ptr_alloc_val;
    typedef typename ptr_alloc_traits_type::pointer ptr_alloc_ptr;
    typedef typename ptr_alloc_traits_type::const_pointer ptr_alloc_cptr;
@@ -534,46 +534,35 @@
    /// @cond
    private:
    typedef deque_base<T, A> Base;
- typedef typename Base::val_alloc_val val_alloc_val;
- typedef typename Base::val_alloc_ptr val_alloc_ptr;
- typedef typename Base::val_alloc_cptr val_alloc_cptr;
- typedef typename Base::val_alloc_ref val_alloc_ref;
- typedef typename Base::val_alloc_cref val_alloc_cref;
- typedef typename Base::val_alloc_size val_alloc_size;
- typedef typename Base::val_alloc_diff val_alloc_diff;
-
- typedef typename Base::ptr_alloc_t ptr_alloc_t;
- typedef typename Base::ptr_alloc_val ptr_alloc_val;
- typedef typename Base::ptr_alloc_ptr ptr_alloc_ptr;
- typedef typename Base::ptr_alloc_cptr ptr_alloc_cptr;
- typedef typename Base::ptr_alloc_ref ptr_alloc_ref;
- typedef typename Base::ptr_alloc_cref ptr_alloc_cref;
    /// @endcond
 
- public: // Basic types
- typedef T value_type;
- typedef val_alloc_ptr pointer;
- typedef val_alloc_cptr const_pointer;
- typedef val_alloc_ref reference;
- typedef val_alloc_cref const_reference;
- typedef val_alloc_size size_type;
- typedef val_alloc_diff difference_type;
- typedef typename Base::allocator_type allocator_type;
-
- public: // Iterators
- typedef typename Base::iterator iterator;
- typedef typename Base::const_iterator const_iterator;
-
- typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
- typedef std::reverse_iterator<iterator> reverse_iterator;
+ public:
 
- typedef allocator_type stored_allocator_type;
+ //////////////////////////////////////////////
+ //
+ // types
+ //
+ //////////////////////////////////////////////
+
+ typedef T value_type;
+ typedef typename ::boost::container::allocator_traits<A>::pointer pointer;
+ typedef typename ::boost::container::allocator_traits<A>::const_pointer const_pointer;
+ typedef typename ::boost::container::allocator_traits<A>::reference reference;
+ typedef typename ::boost::container::allocator_traits<A>::const_reference const_reference;
+ typedef typename ::boost::container::allocator_traits<A>::size_type size_type;
+ typedef typename ::boost::container::allocator_traits<A>::difference_type difference_type;
+ typedef A allocator_type;
+ typedef BOOST_CONTAINER_IMPDEF(allocator_type) stored_allocator_type;
+ typedef BOOST_CONTAINER_IMPDEF(typename Base::iterator) iterator;
+ typedef BOOST_CONTAINER_IMPDEF(typename Base::const_iterator) const_iterator;
+ typedef BOOST_CONTAINER_IMPDEF(std::reverse_iterator<iterator>) reverse_iterator;
+ typedef BOOST_CONTAINER_IMPDEF(std::reverse_iterator<const_iterator>) const_reverse_iterator;
 
    /// @cond
 
    private: // Internal typedefs
    BOOST_COPYABLE_AND_MOVABLE(deque)
- typedef ptr_alloc_ptr index_pointer;
+ typedef typename Base::ptr_alloc_ptr index_pointer;
    static size_type s_buffer_size()
       { return Base::s_buffer_size(); }
    typedef container_detail::advanced_insert_aux_int<iterator> advanced_insert_aux_int_t;
@@ -584,248 +573,11 @@
    /// @endcond
 
    public:
-
- //! <b>Effects</b>: Returns a copy of the internal allocator.
- //!
- //! <b>Throws</b>: If allocator's copy constructor throws.
- //!
- //! <b>Complexity</b>: Constant.
- allocator_type get_allocator() const BOOST_CONTAINER_NOEXCEPT
- { return Base::alloc(); }
-
- //! <b>Effects</b>: Returns a reference to the internal allocator.
- //!
- //! <b>Throws</b>: Nothing
- //!
- //! <b>Complexity</b>: Constant.
- //!
- //! <b>Note</b>: Non-standard extension.
- const stored_allocator_type &get_stored_allocator() const BOOST_CONTAINER_NOEXCEPT
- { return Base::alloc(); }
-
- //! <b>Effects</b>: Returns a reference to the internal allocator.
- //!
- //! <b>Throws</b>: Nothing
- //!
- //! <b>Complexity</b>: Constant.
- //!
- //! <b>Note</b>: Non-standard extension.
- stored_allocator_type &get_stored_allocator() BOOST_CONTAINER_NOEXCEPT
- { return Base::alloc(); }
-
- //! <b>Effects</b>: Returns an iterator to the first element contained in the deque.
- //!
- //! <b>Throws</b>: Nothing.
- //!
- //! <b>Complexity</b>: Constant.
- iterator begin() BOOST_CONTAINER_NOEXCEPT
- { return this->members_.m_start; }
-
- //! <b>Effects</b>: Returns an iterator to the end of the deque.
- //!
- //! <b>Throws</b>: Nothing.
- //!
- //! <b>Complexity</b>: Constant.
- iterator end() BOOST_CONTAINER_NOEXCEPT
- { return this->members_.m_finish; }
-
- //! <b>Effects</b>: Returns a const_iterator to the first element contained in the deque.
- //!
- //! <b>Throws</b>: Nothing.
- //!
- //! <b>Complexity</b>: Constant.
- const_iterator begin() const BOOST_CONTAINER_NOEXCEPT
- { return this->members_.m_start; }
-
- //! <b>Effects</b>: Returns a const_iterator to the end of the deque.
- //!
- //! <b>Throws</b>: Nothing.
- //!
- //! <b>Complexity</b>: Constant.
- const_iterator end() const BOOST_CONTAINER_NOEXCEPT
- { return this->members_.m_finish; }
-
- //! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning
- //! of the reversed deque.
- //!
- //! <b>Throws</b>: Nothing.
- //!
- //! <b>Complexity</b>: Constant.
- reverse_iterator rbegin() BOOST_CONTAINER_NOEXCEPT
- { return reverse_iterator(this->members_.m_finish); }
-
- //! <b>Effects</b>: Returns a reverse_iterator pointing to the end
- //! of the reversed deque.
- //!
- //! <b>Throws</b>: Nothing.
- //!
- //! <b>Complexity</b>: Constant.
- reverse_iterator rend() BOOST_CONTAINER_NOEXCEPT
- { return reverse_iterator(this->members_.m_start); }
-
- //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
- //! of the reversed deque.
- //!
- //! <b>Throws</b>: Nothing.
- //!
- //! <b>Complexity</b>: Constant.
- const_reverse_iterator rbegin() const BOOST_CONTAINER_NOEXCEPT
- { return const_reverse_iterator(this->members_.m_finish); }
-
- //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
- //! of the reversed deque.
- //!
- //! <b>Throws</b>: Nothing.
- //!
- //! <b>Complexity</b>: Constant.
- const_reverse_iterator rend() const BOOST_CONTAINER_NOEXCEPT
- { return const_reverse_iterator(this->members_.m_start); }
-
- //! <b>Effects</b>: Returns a const_iterator to the first element contained in the deque.
- //!
- //! <b>Throws</b>: Nothing.
- //!
- //! <b>Complexity</b>: Constant.
- const_iterator cbegin() const BOOST_CONTAINER_NOEXCEPT
- { return this->members_.m_start; }
-
- //! <b>Effects</b>: Returns a const_iterator to the end of the deque.
- //!
- //! <b>Throws</b>: Nothing.
- //!
- //! <b>Complexity</b>: Constant.
- const_iterator cend() const BOOST_CONTAINER_NOEXCEPT
- { return this->members_.m_finish; }
-
- //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
- //! of the reversed deque.
- //!
- //! <b>Throws</b>: Nothing.
- //!
- //! <b>Complexity</b>: Constant.
- const_reverse_iterator crbegin() const BOOST_CONTAINER_NOEXCEPT
- { return const_reverse_iterator(this->members_.m_finish); }
-
- //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
- //! of the reversed deque.
- //!
- //! <b>Throws</b>: Nothing.
- //!
- //! <b>Complexity</b>: Constant.
- const_reverse_iterator crend() const BOOST_CONTAINER_NOEXCEPT
- { return const_reverse_iterator(this->members_.m_start); }
-
- //! <b>Requires</b>: size() > n.
- //!
- //! <b>Effects</b>: Returns a reference to the nth element
- //! from the beginning of the container.
- //!
- //! <b>Throws</b>: Nothing.
- //!
- //! <b>Complexity</b>: Constant.
- reference operator[](size_type n) BOOST_CONTAINER_NOEXCEPT
- { return this->members_.m_start[difference_type(n)]; }
-
- //! <b>Requires</b>: size() > n.
- //!
- //! <b>Effects</b>: Returns a const reference to the nth element
- //! from the beginning of the container.
- //!
- //! <b>Throws</b>: Nothing.
- //!
- //! <b>Complexity</b>: Constant.
- const_reference operator[](size_type n) const BOOST_CONTAINER_NOEXCEPT
- { return this->members_.m_start[difference_type(n)]; }
-
- //! <b>Requires</b>: size() > n.
- //!
- //! <b>Effects</b>: Returns a reference to the nth element
- //! from the beginning of the container.
- //!
- //! <b>Throws</b>: std::range_error if n >= size()
- //!
- //! <b>Complexity</b>: Constant.
- reference at(size_type n)
- { this->priv_range_check(n); return (*this)[n]; }
-
- //! <b>Requires</b>: size() > n.
- //!
- //! <b>Effects</b>: Returns a const reference to the nth element
- //! from the beginning of the container.
- //!
- //! <b>Throws</b>: std::range_error if n >= size()
- //!
- //! <b>Complexity</b>: Constant.
- const_reference at(size_type n) const
- { this->priv_range_check(n); return (*this)[n]; }
-
- //! <b>Requires</b>: !empty()
- //!
- //! <b>Effects</b>: Returns a reference to the first
- //! element of the container.
- //!
- //! <b>Throws</b>: Nothing.
- //!
- //! <b>Complexity</b>: Constant.
- reference front() BOOST_CONTAINER_NOEXCEPT
- { return *this->members_.m_start; }
-
- //! <b>Requires</b>: !empty()
- //!
- //! <b>Effects</b>: Returns a const reference to the first element
- //! from the beginning of the container.
- //!
- //! <b>Throws</b>: Nothing.
- //!
- //! <b>Complexity</b>: Constant.
- const_reference front() const BOOST_CONTAINER_NOEXCEPT
- { return *this->members_.m_start; }
-
- //! <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
- { return *(end()-1); }
-
- //! <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
- { return *(cend()-1); }
-
- //! <b>Effects</b>: Returns the number of the elements contained in the deque.
- //!
- //! <b>Throws</b>: Nothing.
- //!
- //! <b>Complexity</b>: Constant.
- size_type size() const BOOST_CONTAINER_NOEXCEPT
- { return this->members_.m_finish - this->members_.m_start; }
-
- //! <b>Effects</b>: Returns the largest possible size of the deque.
- //!
- //! <b>Throws</b>: Nothing.
- //!
- //! <b>Complexity</b>: Constant.
- size_type max_size() const BOOST_CONTAINER_NOEXCEPT
- { return allocator_traits_type::max_size(this->alloc()); }
-
- //! <b>Effects</b>: Returns true if the deque contains no elements.
- //!
- //! <b>Throws</b>: Nothing.
- //!
- //! <b>Complexity</b>: Constant.
- bool empty() const BOOST_CONTAINER_NOEXCEPT
- { return this->members_.m_finish == this->members_.m_start; }
+ //////////////////////////////////////////////
+ //
+ // construct/copy/destroy
+ //
+ //////////////////////////////////////////////
 
    //! <b>Effects</b>: Default constructors a deque.
    //!
@@ -872,16 +624,37 @@
       : Base(n, a)
    { this->priv_fill_initialize(value); }
 
- //! <b>Effects</b>: Copy constructs a deque.
+ //! <b>Effects</b>: Constructs a deque that will use a copy of allocator a
+ //! and inserts a copy of the range [first, last) in the deque.
    //!
- //! <b>Postcondition</b>: x == *this.
+ //! <b>Throws</b>: If allocator_type's default constructor or copy constructor
+ //! throws or T's constructor taking an dereferenced InIt throws.
    //!
- //! <b>Complexity</b>: Linear to the elements x contains.
- deque(const deque& x)
- : Base(allocator_traits_type::select_on_container_copy_construction(x.alloc()))
- {
- if(x.size()){
- this->priv_initialize_map(x.size());
+ //! <b>Complexity</b>: Linear to the range [first, last).
+ template <class InIt>
+ deque(InIt first, InIt last, const allocator_type& a = allocator_type()
+ #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+ , typename container_detail::enable_if_c
+ < !container_detail::is_convertible<InIt, size_type>::value
+ >::type * = 0
+ #endif
+ )
+ : Base(a)
+ {
+ typedef typename std::iterator_traits<InIt>::iterator_category ItCat;
+ this->priv_range_initialize(first, last, ItCat());
+ }
+
+ //! <b>Effects</b>: Copy constructs a deque.
+ //!
+ //! <b>Postcondition</b>: x == *this.
+ //!
+ //! <b>Complexity</b>: Linear to the elements x contains.
+ deque(const deque& x)
+ : Base(allocator_traits_type::select_on_container_copy_construction(x.alloc()))
+ {
+ if(x.size()){
+ this->priv_initialize_map(x.size());
          boost::container::uninitialized_copy_alloc
             (this->alloc(), x.begin(), x.end(), this->members_.m_start);
       }
@@ -936,27 +709,6 @@
       }
    }
 
- //! <b>Effects</b>: Constructs a deque that will use a copy of allocator a
- //! and inserts a copy of the range [first, last) in the deque.
- //!
- //! <b>Throws</b>: If allocator_type's default constructor or copy constructor
- //! throws or T's constructor taking an dereferenced InIt throws.
- //!
- //! <b>Complexity</b>: Linear to the range [first, last).
- template <class InIt>
- deque(InIt first, InIt last, const allocator_type& a = allocator_type()
- #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
- , typename container_detail::enable_if_c
- < !container_detail::is_convertible<InIt, size_type>::value
- >::type * = 0
- #endif
- )
- : Base(a)
- {
- typedef typename std::iterator_traits<InIt>::iterator_category ItCat;
- this->priv_range_initialize(first, last, ItCat());
- }
-
    //! <b>Effects</b>: Destroys the deque. All stored values are destroyed
    //! and used memory is deallocated.
    //!
@@ -1028,19 +780,6 @@
       return *this;
    }
 
- //! <b>Effects</b>: Swaps the contents of *this and x.
- //!
- //! <b>Throws</b>: Nothing.
- //!
- //! <b>Complexity</b>: Constant.
- void swap(deque &x)
- {
- this->swap_members(x);
- container_detail::bool_<allocator_traits_type::propagate_on_container_swap::value> flag;
- container_detail::swap_alloc(this->alloc(), x.alloc(), flag);
- container_detail::swap_alloc(this->ptr_alloc(), x.ptr_alloc(), flag);
- }
-
    //! <b>Effects</b>: Assigns the n copies of val to *this.
    //!
    //! <b>Throws</b>: If memory allocation throws or T's copy constructor throws.
@@ -1068,15 +807,15 @@
       #endif
       )
    {
- iterator cur = begin();
+ iterator cur = this->begin();
       for ( ; first != last && cur != end(); ++cur, ++first){
          *cur = *first;
       }
       if (first == last){
- this->erase(cur, cend());
+ this->erase(cur, this->cend());
       }
       else{
- this->insert(cend(), first, last);
+ this->insert(this->cend(), first, last);
       }
    }
 
@@ -1092,91 +831,513 @@
       const size_type len = std::distance(first, last);
       if (len > size()) {
          FwdIt mid = first;
- std::advance(mid, size());
+ std::advance(mid, this->size());
          boost::copy_or_move(first, mid, begin());
- this->insert(cend(), mid, last);
+ this->insert(this->cend(), mid, last);
       }
       else{
- this->erase(boost::copy_or_move(first, last, begin()), cend());
+ this->erase(boost::copy_or_move(first, last, this->begin()), cend());
       }
    }
    #endif
 
- #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
- //! <b>Effects</b>: Inserts a copy of x at the end of the deque.
+ //! <b>Effects</b>: Returns a copy of the internal allocator.
    //!
- //! <b>Throws</b>: If memory allocation throws or
- //! T's copy constructor throws.
+ //! <b>Throws</b>: If allocator's copy constructor throws.
    //!
- //! <b>Complexity</b>: Amortized constant time.
- void push_back(const T &x);
+ //! <b>Complexity</b>: Constant.
+ allocator_type get_allocator() const BOOST_CONTAINER_NOEXCEPT
+ { return Base::alloc(); }
 
- //! <b>Effects</b>: Constructs a new element in the end of the deque
- //! and moves the resources of mx to this new element.
+ //! <b>Effects</b>: Returns a reference to the internal allocator.
    //!
- //! <b>Throws</b>: If memory allocation throws.
+ //! <b>Throws</b>: Nothing
    //!
- //! <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
+ //! <b>Complexity</b>: Constant.
+ //!
+ //! <b>Note</b>: Non-standard extension.
+ const stored_allocator_type &get_stored_allocator() const BOOST_CONTAINER_NOEXCEPT
+ { return Base::alloc(); }
 
- #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
- //! <b>Effects</b>: Inserts a copy of x at the front of the deque.
+ //////////////////////////////////////////////
+ //
+ // iterators
+ //
+ //////////////////////////////////////////////
+
+ //! <b>Effects</b>: Returns a reference to the internal allocator.
    //!
- //! <b>Throws</b>: If memory allocation throws or
- //! T's copy constructor throws.
+ //! <b>Throws</b>: Nothing
    //!
- //! <b>Complexity</b>: Amortized constant time.
- void push_front(const T &x);
+ //! <b>Complexity</b>: Constant.
+ //!
+ //! <b>Note</b>: Non-standard extension.
+ stored_allocator_type &get_stored_allocator() BOOST_CONTAINER_NOEXCEPT
+ { return Base::alloc(); }
 
- //! <b>Effects</b>: Constructs a new element in the front of the deque
- //! and moves the resources of mx to this new element.
+ //! <b>Effects</b>: Returns an iterator to the first element contained in the deque.
    //!
- //! <b>Throws</b>: If memory allocation throws.
+ //! <b>Throws</b>: Nothing.
    //!
- //! <b>Complexity</b>: Amortized constant time.
- void push_front(T &&x);
- #else
- BOOST_MOVE_CONVERSION_AWARE_CATCH(push_front, T, void, priv_push_front)
- #endif
+ //! <b>Complexity</b>: Constant.
+ iterator begin() BOOST_CONTAINER_NOEXCEPT
+ { return this->members_.m_start; }
 
- //! <b>Effects</b>: Removes the last element from the deque.
+ //! <b>Effects</b>: Returns a const_iterator to the first element contained in the deque.
    //!
    //! <b>Throws</b>: Nothing.
    //!
- //! <b>Complexity</b>: Constant time.
- void pop_back() BOOST_CONTAINER_NOEXCEPT
+ //! <b>Complexity</b>: Constant.
+ const_iterator begin() const BOOST_CONTAINER_NOEXCEPT
+ { return this->members_.m_start; }
+
+ //! <b>Effects</b>: Returns an iterator to the end of the deque.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
+ iterator end() BOOST_CONTAINER_NOEXCEPT
+ { return this->members_.m_finish; }
+
+ //! <b>Effects</b>: Returns a const_iterator to the end of the deque.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
+ const_iterator end() const BOOST_CONTAINER_NOEXCEPT
+ { return this->members_.m_finish; }
+
+ //! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning
+ //! of the reversed deque.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
+ reverse_iterator rbegin() BOOST_CONTAINER_NOEXCEPT
+ { return reverse_iterator(this->members_.m_finish); }
+
+ //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
+ //! of the reversed deque.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
+ const_reverse_iterator rbegin() const BOOST_CONTAINER_NOEXCEPT
+ { return const_reverse_iterator(this->members_.m_finish); }
+
+ //! <b>Effects</b>: Returns a reverse_iterator pointing to the end
+ //! of the reversed deque.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
+ reverse_iterator rend() BOOST_CONTAINER_NOEXCEPT
+ { return reverse_iterator(this->members_.m_start); }
+
+ //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
+ //! of the reversed deque.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
+ const_reverse_iterator rend() const BOOST_CONTAINER_NOEXCEPT
+ { return const_reverse_iterator(this->members_.m_start); }
+
+ //! <b>Effects</b>: Returns a const_iterator to the first element contained in the deque.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
+ const_iterator cbegin() const BOOST_CONTAINER_NOEXCEPT
+ { return this->members_.m_start; }
+
+ //! <b>Effects</b>: Returns a const_iterator to the end of the deque.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
+ const_iterator cend() const BOOST_CONTAINER_NOEXCEPT
+ { return this->members_.m_finish; }
+
+ //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
+ //! of the reversed deque.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
+ const_reverse_iterator crbegin() const BOOST_CONTAINER_NOEXCEPT
+ { return const_reverse_iterator(this->members_.m_finish); }
+
+ //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
+ //! of the reversed deque.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
+ const_reverse_iterator crend() const BOOST_CONTAINER_NOEXCEPT
+ { return const_reverse_iterator(this->members_.m_start); }
+
+ //////////////////////////////////////////////
+ //
+ // capacity
+ //
+ //////////////////////////////////////////////
+
+ //! <b>Effects</b>: Returns true if the deque contains no elements.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
+ bool empty() const BOOST_CONTAINER_NOEXCEPT
+ { return this->members_.m_finish == this->members_.m_start; }
+
+ //! <b>Effects</b>: Returns the number of the elements contained in the deque.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
+ size_type size() const BOOST_CONTAINER_NOEXCEPT
+ { return this->members_.m_finish - this->members_.m_start; }
+
+ //! <b>Effects</b>: Returns the largest possible size of the deque.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
+ size_type max_size() const BOOST_CONTAINER_NOEXCEPT
+ { return allocator_traits_type::max_size(this->alloc()); }
+
+ //! <b>Effects</b>: Inserts or erases elements at the end such that
+ //! the size becomes n. New elements are default constructed.
+ //!
+ //! <b>Throws</b>: If memory allocation throws, or T's copy constructor throws.
+ //!
+ //! <b>Complexity</b>: Linear to the difference between size() and new_size.
+ void resize(size_type new_size)
    {
- if (this->members_.m_finish.m_cur != this->members_.m_finish.m_first) {
- --this->members_.m_finish.m_cur;
- allocator_traits_type::destroy
- ( this->alloc()
- , container_detail::to_raw_pointer(this->members_.m_finish.m_cur)
- );
+ const size_type len = size();
+ if (new_size < len)
+ this->priv_erase_last_n(len - new_size);
+ else{
+ const size_type n = new_size - this->size();
+ container_detail::default_construct_aux_proxy<A, iterator> proxy(this->alloc(), n);
+ priv_insert_back_aux_impl(n, proxy);
       }
- else
- this->priv_pop_back_aux();
    }
 
- //! <b>Effects</b>: Removes the first element from the deque.
+ //! <b>Effects</b>: Inserts or erases elements at the end such that
+ //! the size becomes n. New elements are copy constructed from x.
+ //!
+ //! <b>Throws</b>: If memory allocation throws, or T's copy constructor throws.
+ //!
+ //! <b>Complexity</b>: Linear to the difference between size() and new_size.
+ void resize(size_type new_size, const value_type& x)
+ {
+ const size_type len = size();
+ if (new_size < len)
+ this->erase(this->members_.m_start + new_size, this->members_.m_finish);
+ else
+ this->insert(this->members_.m_finish, new_size - len, x);
+ }
+
+ //! <b>Effects</b>: Tries to deallocate the excess of memory created
+ //! with previous allocations. The size of the deque is unchanged
+ //!
+ //! <b>Throws</b>: If memory allocation throws.
+ //!
+ //! <b>Complexity</b>: Constant.
+ void shrink_to_fit()
+ {
+ //This deque implementation already
+ //deallocates excess nodes when erasing
+ //so there is nothing to do except for
+ //empty deque
+ if(this->empty()){
+ this->priv_clear_map();
+ }
+ }
+
+ //////////////////////////////////////////////
+ //
+ // element access
+ //
+ //////////////////////////////////////////////
+
+ //! <b>Requires</b>: !empty()
+ //!
+ //! <b>Effects</b>: Returns a reference to the first
+ //! element of the container.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
+ reference front() BOOST_CONTAINER_NOEXCEPT
+ { return *this->members_.m_start; }
+
+ //! <b>Requires</b>: !empty()
+ //!
+ //! <b>Effects</b>: Returns a const reference to the first element
+ //! from the beginning of the container.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
+ const_reference front() const BOOST_CONTAINER_NOEXCEPT
+ { return *this->members_.m_start; }
+
+ //! <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
+ { return *(end()-1); }
+
+ //! <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
+ { return *(cend()-1); }
+
+ //! <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.
+ reference operator[](size_type n) BOOST_CONTAINER_NOEXCEPT
+ { return this->members_.m_start[difference_type(n)]; }
+
+ //! <b>Requires</b>: size() > n.
+ //!
+ //! <b>Effects</b>: Returns a const reference to the nth element
+ //! from the beginning of the container.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
+ const_reference operator[](size_type n) const BOOST_CONTAINER_NOEXCEPT
+ { return this->members_.m_start[difference_type(n)]; }
+
+ //! <b>Requires</b>: size() > n.
+ //!
+ //! <b>Effects</b>: Returns a reference to the nth element
+ //! from the beginning of the container.
+ //!
+ //! <b>Throws</b>: std::range_error if n >= size()
+ //!
+ //! <b>Complexity</b>: Constant.
+ reference at(size_type n)
+ { this->priv_range_check(n); return (*this)[n]; }
+
+ //! <b>Requires</b>: size() > n.
+ //!
+ //! <b>Effects</b>: Returns a const reference to the nth element
+ //! from the beginning of the container.
+ //!
+ //! <b>Throws</b>: std::range_error if n >= size()
+ //!
+ //! <b>Complexity</b>: Constant.
+ const_reference at(size_type n) const
+ { this->priv_range_check(n); return (*this)[n]; }
+
+ //////////////////////////////////////////////
+ //
+ // modifiers
+ //
+ //////////////////////////////////////////////
+
+ #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 beginning of the deque.
+ //!
+ //! <b>Throws</b>: If memory allocation throws or the in-place constructor throws.
+ //!
+ //! <b>Complexity</b>: Amortized constant time
+ template <class... Args>
+ void emplace_front(Args&&... args)
+ {
+ if(this->priv_push_front_simple_available()){
+ allocator_traits_type::construct
+ ( this->alloc()
+ , this->priv_push_front_simple_pos()
+ , boost::forward<Args>(args)...);
+ this->priv_push_front_simple_commit();
+ }
+ else{
+ typedef container_detail::advanced_insert_aux_non_movable_emplace<A, iterator, Args...> type;
+ type &&proxy = type(this->alloc(), boost::forward<Args>(args)...);
+ this->priv_insert_front_aux_impl(1, proxy);
+ }
+ }
+
+ //! <b>Effects</b>: Inserts an object of type T constructed with
+ //! std::forward<Args>(args)... in the end of the deque.
+ //!
+ //! <b>Throws</b>: If memory allocation throws or the in-place constructor throws.
+ //!
+ //! <b>Complexity</b>: Amortized constant time
+ template <class... Args>
+ void emplace_back(Args&&... args)
+ {
+ if(this->priv_push_back_simple_available()){
+ allocator_traits_type::construct
+ ( this->alloc()
+ , this->priv_push_back_simple_pos()
+ , boost::forward<Args>(args)...);
+ this->priv_push_back_simple_commit();
+ }
+ else{
+ typedef container_detail::advanced_insert_aux_non_movable_emplace<A, iterator, Args...> type;
+ type &&proxy = type(this->alloc(), boost::forward<Args>(args)...);
+ this->priv_insert_back_aux_impl(1, proxy);
+ }
+ }
+
+ //! <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
+ //!
+ //! <b>Throws</b>: If memory allocation throws or the in-place constructor throws.
+ //!
+ //! <b>Complexity</b>: If position is end(), amortized constant time
+ //! Linear time otherwise.
+ template <class... Args>
+ iterator emplace(const_iterator p, Args&&... args)
+ {
+ if(p == this->cbegin()){
+ this->emplace_front(boost::forward<Args>(args)...);
+ return this->begin();
+ }
+ else if(p == this->cend()){
+ this->emplace_back(boost::forward<Args>(args)...);
+ return (this->end()-1);
+ }
+ else{
+ typedef container_detail::advanced_insert_aux_emplace<A, iterator, Args...> type;
+ type &&proxy = type(this->alloc(), boost::forward<Args>(args)...);
+ return this->priv_insert_aux_impl(p, 1, proxy);
+ }
+ }
+
+ #else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
+
+ //advanced_insert_int.hpp includes all necessary preprocessor machinery...
+ #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_front(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
+ { \
+ if(priv_push_front_simple_available()){ \
+ allocator_traits_type::construct \
+ ( this->alloc() \
+ , this->priv_push_front_simple_pos() \
+ BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); \
+ priv_push_front_simple_commit(); \
+ } \
+ else{ \
+ container_detail::BOOST_PP_CAT(BOOST_PP_CAT \
+ (advanced_insert_aux_non_movable_emplace, n), arg) \
+ <A, iterator BOOST_PP_ENUM_TRAILING_PARAMS(n, P)> proxy \
+ (this->alloc() BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); \
+ priv_insert_front_aux_impl(1, proxy); \
+ } \
+ } \
+ \
+ 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, _)) \
+ { \
+ if(priv_push_back_simple_available()){ \
+ allocator_traits_type::construct \
+ ( this->alloc() \
+ , this->priv_push_back_simple_pos() \
+ BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); \
+ priv_push_back_simple_commit(); \
+ } \
+ else{ \
+ container_detail::BOOST_PP_CAT(BOOST_PP_CAT( \
+ advanced_insert_aux_non_movable_emplace, n), arg) \
+ <A, iterator BOOST_PP_ENUM_TRAILING_PARAMS(n, P)> proxy \
+ (this->alloc() BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); \
+ priv_insert_back_aux_impl(1, proxy); \
+ } \
+ } \
+ \
+ BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
+ iterator emplace(const_iterator p \
+ BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
+ { \
+ if(p == this->cbegin()){ \
+ this->emplace_front(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); \
+ return this->begin(); \
+ } \
+ else if(p == cend()){ \
+ this->emplace_back(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); \
+ return (this->end()-1); \
+ } \
+ else{ \
+ container_detail::BOOST_PP_CAT(BOOST_PP_CAT(advanced_insert_aux_emplace, n), arg) \
+ <A, iterator BOOST_PP_ENUM_TRAILING_PARAMS(n, P)> proxy \
+ (this->alloc() BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); \
+ return this->priv_insert_aux_impl(p, 1, proxy); \
+ } \
+ } \
+ //!
+ #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
+ #include BOOST_PP_LOCAL_ITERATE()
+
+ #endif //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
+
+ #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+ //! <b>Effects</b>: Inserts a copy of x at the front of the deque.
+ //!
+ //! <b>Throws</b>: If memory allocation throws or
+ //! T's copy constructor throws.
+ //!
+ //! <b>Complexity</b>: Amortized constant time.
+ void push_front(const T &x);
+
+ //! <b>Effects</b>: Constructs a new element in the front of the deque
+ //! and moves the resources of mx to this new element.
+ //!
+ //! <b>Throws</b>: If memory allocation throws.
+ //!
+ //! <b>Complexity</b>: Amortized constant time.
+ void push_front(T &&x);
+ #else
+ BOOST_MOVE_CONVERSION_AWARE_CATCH(push_front, T, void, priv_push_front)
+ #endif
+
+ #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+ //! <b>Effects</b>: Inserts a copy of x at the end of the deque.
+ //!
+ //! <b>Throws</b>: If memory allocation throws or
+ //! T's copy constructor throws.
+ //!
+ //! <b>Complexity</b>: Amortized constant time.
+ void push_back(const T &x);
+
+ //! <b>Effects</b>: Constructs a new element in the end of the deque
+ //! and moves the resources of mx to this new element.
    //!
- //! <b>Throws</b>: Nothing.
+ //! <b>Throws</b>: If memory allocation throws.
    //!
- //! <b>Complexity</b>: Constant time.
- void pop_front() BOOST_CONTAINER_NOEXCEPT
- {
- if (this->members_.m_start.m_cur != this->members_.m_start.m_last - 1) {
- allocator_traits_type::destroy
- ( this->alloc()
- , container_detail::to_raw_pointer(this->members_.m_start.m_cur)
- );
- ++this->members_.m_start.m_cur;
- }
- else
- this->priv_pop_front_aux();
- }
+ //! <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
 
    #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
 
@@ -1268,179 +1429,40 @@
    }
    #endif
 
- #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 deque.
+ //! <b>Effects</b>: Removes the first element from the deque.
    //!
- //! <b>Throws</b>: If memory allocation throws or the in-place constructor throws.
+ //! <b>Throws</b>: Nothing.
    //!
- //! <b>Complexity</b>: Amortized constant time
- template <class... Args>
- void emplace_back(Args&&... args)
+ //! <b>Complexity</b>: Constant time.
+ void pop_front() BOOST_CONTAINER_NOEXCEPT
    {
- if(this->priv_push_back_simple_available()){
- allocator_traits_type::construct
+ if (this->members_.m_start.m_cur != this->members_.m_start.m_last - 1) {
+ allocator_traits_type::destroy
             ( this->alloc()
- , this->priv_push_back_simple_pos()
- , boost::forward<Args>(args)...);
- this->priv_push_back_simple_commit();
- }
- else{
- typedef container_detail::advanced_insert_aux_non_movable_emplace<A, iterator, Args...> type;
- type &&proxy = type(this->alloc(), boost::forward<Args>(args)...);
- this->priv_insert_back_aux_impl(1, proxy);
+ , container_detail::to_raw_pointer(this->members_.m_start.m_cur)
+ );
+ ++this->members_.m_start.m_cur;
       }
+ else
+ this->priv_pop_front_aux();
    }
 
- //! <b>Effects</b>: Inserts an object of type T constructed with
- //! std::forward<Args>(args)... in the beginning of the deque.
+ //! <b>Effects</b>: Removes the last element from the deque.
    //!
- //! <b>Throws</b>: If memory allocation throws or the in-place constructor throws.
+ //! <b>Throws</b>: Nothing.
    //!
- //! <b>Complexity</b>: Amortized constant time
- template <class... Args>
- void emplace_front(Args&&... args)
+ //! <b>Complexity</b>: Constant time.
+ void pop_back() BOOST_CONTAINER_NOEXCEPT
    {
- if(this->priv_push_front_simple_available()){
- allocator_traits_type::construct
+ if (this->members_.m_finish.m_cur != this->members_.m_finish.m_first) {
+ --this->members_.m_finish.m_cur;
+ allocator_traits_type::destroy
             ( this->alloc()
- , this->priv_push_front_simple_pos()
- , boost::forward<Args>(args)...);
- this->priv_push_front_simple_commit();
- }
- else{
- typedef container_detail::advanced_insert_aux_non_movable_emplace<A, iterator, Args...> type;
- type &&proxy = type(this->alloc(), boost::forward<Args>(args)...);
- this->priv_insert_front_aux_impl(1, proxy);
- }
- }
-
- //! <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
- //!
- //! <b>Throws</b>: If memory allocation throws or the in-place constructor throws.
- //!
- //! <b>Complexity</b>: If position is end(), amortized constant time
- //! Linear time otherwise.
- template <class... Args>
- iterator emplace(const_iterator p, Args&&... args)
- {
- if(p == this->cbegin()){
- this->emplace_front(boost::forward<Args>(args)...);
- return this->begin();
- }
- else if(p == this->cend()){
- this->emplace_back(boost::forward<Args>(args)...);
- return (this->end()-1);
- }
- else{
- typedef container_detail::advanced_insert_aux_emplace<A, iterator, Args...> type;
- type &&proxy = type(this->alloc(), boost::forward<Args>(args)...);
- return this->priv_insert_aux_impl(p, 1, proxy);
+ , container_detail::to_raw_pointer(this->members_.m_finish.m_cur)
+ );
       }
- }
-
- #else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
-
- //advanced_insert_int.hpp includes all necessary preprocessor machinery...
- #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, _)) \
- { \
- if(priv_push_back_simple_available()){ \
- allocator_traits_type::construct \
- ( this->alloc() \
- , this->priv_push_back_simple_pos() \
- BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); \
- priv_push_back_simple_commit(); \
- } \
- else{ \
- container_detail::BOOST_PP_CAT(BOOST_PP_CAT( \
- advanced_insert_aux_non_movable_emplace, n), arg) \
- <A, iterator BOOST_PP_ENUM_TRAILING_PARAMS(n, P)> proxy \
- (this->alloc() BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); \
- priv_insert_back_aux_impl(1, proxy); \
- } \
- } \
- \
- BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, > ) \
- void emplace_front(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
- { \
- if(priv_push_front_simple_available()){ \
- allocator_traits_type::construct \
- ( this->alloc() \
- , this->priv_push_front_simple_pos() \
- BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); \
- priv_push_front_simple_commit(); \
- } \
- else{ \
- container_detail::BOOST_PP_CAT(BOOST_PP_CAT \
- (advanced_insert_aux_non_movable_emplace, n), arg) \
- <A, iterator BOOST_PP_ENUM_TRAILING_PARAMS(n, P)> proxy \
- (this->alloc() BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); \
- priv_insert_front_aux_impl(1, proxy); \
- } \
- } \
- \
- BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
- iterator emplace(const_iterator p \
- BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
- { \
- if(p == this->cbegin()){ \
- this->emplace_front(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); \
- return this->begin(); \
- } \
- else if(p == cend()){ \
- this->emplace_back(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); \
- return (this->end()-1); \
- } \
- else{ \
- container_detail::BOOST_PP_CAT(BOOST_PP_CAT(advanced_insert_aux_emplace, n), arg) \
- <A, iterator BOOST_PP_ENUM_TRAILING_PARAMS(n, P)> proxy \
- (this->alloc() BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); \
- return this->priv_insert_aux_impl(p, 1, proxy); \
- } \
- } \
- //!
- #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
- #include BOOST_PP_LOCAL_ITERATE()
-
- #endif //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
-
- //! <b>Effects</b>: Inserts or erases elements at the end such that
- //! the size becomes n. New elements are copy constructed from x.
- //!
- //! <b>Throws</b>: If memory allocation throws, or T's copy constructor throws.
- //!
- //! <b>Complexity</b>: Linear to the difference between size() and new_size.
- void resize(size_type new_size, const value_type& x)
- {
- const size_type len = size();
- if (new_size < len)
- this->erase(this->members_.m_start + new_size, this->members_.m_finish);
       else
- this->insert(this->members_.m_finish, new_size - len, x);
- }
-
- //! <b>Effects</b>: Inserts or erases elements at the end such that
- //! the size becomes n. New elements are default constructed.
- //!
- //! <b>Throws</b>: If memory allocation throws, or T's copy constructor throws.
- //!
- //! <b>Complexity</b>: Linear to the difference between size() and new_size.
- void resize(size_type new_size)
- {
- const size_type len = size();
- if (new_size < len)
- this->priv_erase_last_n(len - new_size);
- else{
- const size_type n = new_size - this->size();
- container_detail::default_construct_aux_proxy<A, iterator> proxy(this->alloc(), n);
- priv_insert_back_aux_impl(n, proxy);
- }
+ this->priv_pop_back_aux();
    }
 
    //! <b>Effects</b>: Erases the element at position pos.
@@ -1504,18 +1526,17 @@
       }
    }
 
- void priv_erase_last_n(size_type n)
+ //! <b>Effects</b>: Swaps the contents of *this and x.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
+ void swap(deque &x)
    {
- if(n == this->size()) {
- this->clear();
- }
- else {
- iterator new_finish = this->members_.m_finish - n;
- if(!Base::traits_t::trivial_dctr_after_move)
- this->priv_destroy_range(new_finish, this->members_.m_finish);
- this->priv_destroy_nodes(new_finish.m_node + 1, this->members_.m_finish.m_node + 1);
- this->members_.m_finish = new_finish;
- }
+ this->swap_members(x);
+ container_detail::bool_<allocator_traits_type::propagate_on_container_swap::value> flag;
+ container_detail::swap_alloc(this->alloc(), x.alloc(), flag);
+ container_detail::swap_alloc(this->ptr_alloc(), x.ptr_alloc(), flag);
    }
 
    //! <b>Effects</b>: Erases all the elements of the deque.
@@ -1543,25 +1564,23 @@
       this->members_.m_finish = this->members_.m_start;
    }
 
- //! <b>Effects</b>: Tries to deallocate the excess of memory created
- //! with previous allocations. The size of the deque is unchanged
- //!
- //! <b>Throws</b>: If memory allocation throws.
- //!
- //! <b>Complexity</b>: Constant.
- void shrink_to_fit()
+ /// @cond
+ private:
+
+ void priv_erase_last_n(size_type n)
    {
- //This deque implementation already
- //deallocates excess nodes when erasing
- //so there is nothing to do except for
- //empty deque
- if(this->empty()){
- this->priv_clear_map();
+ if(n == this->size()) {
+ this->clear();
+ }
+ else {
+ iterator new_finish = this->members_.m_finish - n;
+ if(!Base::traits_t::trivial_dctr_after_move)
+ this->priv_destroy_range(new_finish, this->members_.m_finish);
+ this->priv_destroy_nodes(new_finish.m_node + 1, this->members_.m_finish.m_node + 1);
+ this->members_.m_finish = new_finish;
       }
    }
 
- /// @cond
- private:
    void priv_range_check(size_type n) const
       { if (n >= this->size()) BOOST_RETHROW std::out_of_range("deque"); }
 
@@ -1960,39 +1979,32 @@
 
 // Nonmember functions.
 template <class T, class A>
-inline bool operator==(const deque<T, A>& x,
- const deque<T, A>& y)
+inline bool operator==(const deque<T, A>& x, const deque<T, A>& y)
 {
    return x.size() == y.size() && equal(x.begin(), x.end(), y.begin());
 }
 
 template <class T, class A>
-inline bool operator<(const deque<T, A>& x,
- const deque<T, A>& y)
+inline bool operator<(const deque<T, A>& x, const deque<T, A>& y)
 {
    return lexicographical_compare(x.begin(), x.end(), y.begin(), y.end());
 }
 
 template <class T, class A>
-inline bool operator!=(const deque<T, A>& x,
- const deque<T, A>& y)
+inline bool operator!=(const deque<T, A>& x, const deque<T, A>& y)
    { return !(x == y); }
 
 template <class T, class A>
-inline bool operator>(const deque<T, A>& x,
- const deque<T, A>& y)
+inline bool operator>(const deque<T, A>& x, const deque<T, A>& y)
    { return y < x; }
 
 template <class T, class A>
-inline bool operator<=(const deque<T, A>& x,
- const deque<T, A>& y)
- { return !(y < x); }
-
-template <class T, class A>
-inline bool operator>=(const deque<T, A>& x,
- const deque<T, A>& y)
+inline bool operator>=(const deque<T, A>& x, const deque<T, A>& y)
    { return !(x < y); }
 
+template <class T, class A>
+inline bool operator<=(const deque<T, A>& x, const deque<T, A>& y)
+ { return !(y < x); }
 
 template <class T, class A>
 inline void swap(deque<T, A>& x, deque<T, A>& y)


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk