From a166923e83d8420eacfcdd5070bec1915aae6457 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Fri, 15 Aug 2014 17:20:57 +0200 Subject: [PATCH] Fixed documentation errors with "position", "pos", "hint" and "p" iterators indicating insertion/emplace position. --- include/boost/container/deque.hpp | 32 +++--- include/boost/container/flat_map.hpp | 40 ++++---- include/boost/container/flat_set.hpp | 32 +++--- include/boost/container/list.hpp | 12 +-- include/boost/container/map.hpp | 56 +++++------ include/boost/container/set.hpp | 20 ++-- include/boost/container/slist.hpp | 114 +++++++++++----------- include/boost/container/stable_vector.hpp | 103 ++++++++++--------- include/boost/container/static_vector.hpp | 64 ++++++------ 9 files changed, 235 insertions(+), 238 deletions(-) diff --git a/include/boost/container/deque.hpp b/include/boost/container/deque.hpp index 8b97196..c91ed93 100644 --- a/include/boost/container/deque.hpp +++ b/include/boost/container/deque.hpp @@ -1184,14 +1184,14 @@ class deque : protected deque_base } } - //! Requires: position must be a valid iterator of *this. + //! Requires: p must be a valid iterator of *this. //! //! Effects: Inserts an object of type T constructed with - //! std::forward(args)... before position + //! std::forward(args)... before p //! //! Throws: If memory allocation throws or the in-place constructor throws. //! - //! Complexity: If position is end(), amortized constant time + //! Complexity: If p is end(), amortized constant time //! Linear time otherwise. template iterator emplace(const_iterator p, Args&&... args) @@ -1317,29 +1317,29 @@ class deque : protected deque_base #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - //! Requires: position must be a valid iterator of *this. + //! Requires: p must be a valid iterator of *this. //! - //! Effects: Insert a copy of x before position. + //! Effects: Insert a copy of x before p. //! //! Returns: an iterator to the inserted element. //! //! Throws: If memory allocation throws or x's copy constructor throws. //! - //! Complexity: If position is end(), amortized constant time + //! Complexity: If p is end(), amortized constant time //! Linear time otherwise. - iterator insert(const_iterator position, const T &x); + iterator insert(const_iterator p, const T &x); - //! Requires: position must be a valid iterator of *this. + //! Requires: p must be a valid iterator of *this. //! - //! Effects: Insert a new element before position with mx's resources. + //! Effects: Insert a new element before p with mx's resources. //! //! Returns: an iterator to the inserted element. //! //! Throws: If memory allocation throws. //! - //! Complexity: If position is end(), amortized constant time + //! Complexity: If p is end(), amortized constant time //! Linear time otherwise. - iterator insert(const_iterator position, T &&x); + iterator insert(const_iterator p, T &&x); #else BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert, T, iterator, priv_insert, const_iterator, const_iterator) #endif @@ -1441,7 +1441,7 @@ class deque : protected deque_base this->priv_pop_back_aux(); } - //! Effects: Erases the element at position pos. + //! Effects: Erases the element at p. //! //! Throws: Nothing. //! @@ -1603,19 +1603,19 @@ class deque : protected deque_base { if (n >= this->size()) throw_out_of_range("deque::at out of range"); } template - iterator priv_insert(const_iterator position, BOOST_FWD_REF(U) x) + iterator priv_insert(const_iterator p, BOOST_FWD_REF(U) x) { - if (position == cbegin()){ + if (p == cbegin()){ this->push_front(::boost::forward(x)); return begin(); } - else if (position == cend()){ + else if (p == cend()){ this->push_back(::boost::forward(x)); return --end(); } else { return priv_insert_aux_impl - ( position, (size_type)1 + ( p, (size_type)1 , container_detail::get_insert_value_proxy(::boost::forward(x))); } } diff --git a/include/boost/container/flat_map.hpp b/include/boost/container/flat_map.hpp index 176dc6e..60c7f28 100644 --- a/include/boost/container/flat_map.hpp +++ b/include/boost/container/flat_map.hpp @@ -658,10 +658,10 @@ class flat_map //! right before p) plus insertion linear to the elements with bigger keys than x. //! //! Note: If an element is inserted it might invalidate elements. - iterator insert(const_iterator position, const value_type& x) + iterator insert(const_iterator p, const value_type& x) { return container_detail::force_copy( - m_flat_tree.insert_unique( container_detail::force_copy(position) + m_flat_tree.insert_unique( container_detail::force_copy(p) , container_detail::force(x))); } @@ -674,10 +674,10 @@ class flat_map //! right before p) plus insertion linear to the elements with bigger keys than x. //! //! Note: If an element is inserted it might invalidate elements. - iterator insert(const_iterator position, BOOST_RV_REF(value_type) x) + iterator insert(const_iterator p, BOOST_RV_REF(value_type) x) { return container_detail::force_copy - (m_flat_tree.insert_unique( container_detail::force_copy(position) + (m_flat_tree.insert_unique( container_detail::force_copy(p) , boost::move(container_detail::force(x)))); } @@ -690,10 +690,10 @@ class flat_map //! right before p) plus insertion linear to the elements with bigger keys than x. //! //! Note: If an element is inserted it might invalidate elements. - iterator insert(const_iterator position, BOOST_RV_REF(movable_value_type) x) + iterator insert(const_iterator p, BOOST_RV_REF(movable_value_type) x) { return container_detail::force_copy( - m_flat_tree.insert_unique(container_detail::force_copy(position), boost::move(x))); + m_flat_tree.insert_unique(container_detail::force_copy(p), boost::move(x))); } //! Requires: first, last are not iterators into *this. @@ -728,20 +728,20 @@ class flat_map void insert(ordered_unique_range_t, InputIterator first, InputIterator last) { m_flat_tree.insert_unique(ordered_unique_range, first, last); } - //! Effects: Erases the element pointed to by position. + //! Effects: Erases the element pointed to by p. //! //! Returns: Returns an iterator pointing to the element immediately //! following q prior to the element being erased. If no such element exists, //! returns end(). //! - //! Complexity: Linear to the elements with keys bigger than position + //! Complexity: Linear to the elements with keys bigger than p //! //! Note: Invalidates elements with keys //! not less than the erased element. - iterator erase(const_iterator position) + iterator erase(const_iterator p) { return container_detail::force_copy - (m_flat_tree.erase(container_detail::force_copy(position))); + (m_flat_tree.erase(container_detail::force_copy(p))); } //! Effects: Erases all elements in the container with key equivalent to x. @@ -1477,10 +1477,10 @@ class flat_multimap //! to the elements with bigger keys than x. //! //! Note: If an element is inserted it might invalidate elements. - iterator insert(const_iterator position, const value_type& x) + iterator insert(const_iterator p, const value_type& x) { return container_detail::force_copy - (m_flat_tree.insert_equal( container_detail::force_copy(position) + (m_flat_tree.insert_equal( container_detail::force_copy(p) , container_detail::force(x))); } @@ -1495,10 +1495,10 @@ class flat_multimap //! to the elements with bigger keys than x. //! //! Note: If an element is inserted it might invalidate elements. - iterator insert(const_iterator position, BOOST_RV_REF(value_type) x) + iterator insert(const_iterator p, BOOST_RV_REF(value_type) x) { return container_detail::force_copy - (m_flat_tree.insert_equal(container_detail::force_copy(position) + (m_flat_tree.insert_equal(container_detail::force_copy(p) , boost::move(x))); } @@ -1513,10 +1513,10 @@ class flat_multimap //! to the elements with bigger keys than x. //! //! Note: If an element is inserted it might invalidate elements. - iterator insert(const_iterator position, BOOST_RV_REF(impl_value_type) x) + iterator insert(const_iterator p, BOOST_RV_REF(impl_value_type) x) { return container_detail::force_copy( - m_flat_tree.insert_equal(container_detail::force_copy(position), boost::move(x))); + m_flat_tree.insert_equal(container_detail::force_copy(p), boost::move(x))); } //! Requires: first, last are not iterators into *this. @@ -1549,20 +1549,20 @@ class flat_multimap void insert(ordered_range_t, InputIterator first, InputIterator last) { m_flat_tree.insert_equal(ordered_range, first, last); } - //! Effects: Erases the element pointed to by position. + //! Effects: Erases the element pointed to by p. //! //! Returns: Returns an iterator pointing to the element immediately //! following q prior to the element being erased. If no such element exists, //! returns end(). //! - //! Complexity: Linear to the elements with keys bigger than position + //! Complexity: Linear to the elements with keys bigger than p //! //! Note: Invalidates elements with keys //! not less than the erased element. - iterator erase(const_iterator position) + iterator erase(const_iterator p) { return container_detail::force_copy( - m_flat_tree.erase(container_detail::force_copy(position))); + m_flat_tree.erase(container_detail::force_copy(p))); } //! Effects: Erases all elements in the container with key equivalent to x. diff --git a/include/boost/container/flat_set.hpp b/include/boost/container/flat_set.hpp index 96f2a91..79b77c3 100644 --- a/include/boost/container/flat_set.hpp +++ b/include/boost/container/flat_set.hpp @@ -394,8 +394,8 @@ class flat_set //! //! Note: If an element is inserted it might invalidate elements. template - iterator emplace_hint(const_iterator hint, Args&&... args) - { return this->base_t::emplace_hint_unique(hint, boost::forward(args)...); } + iterator emplace_hint(const_iterator p, Args&&... args) + { return this->base_t::emplace_hint_unique(p, boost::forward(args)...); } #else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING @@ -405,10 +405,10 @@ class flat_set { return this->base_t::emplace_unique(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); }\ \ BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \ - iterator emplace_hint(const_iterator hint \ + iterator emplace_hint(const_iterator p \ BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \ { return this->base_t::emplace_hint_unique \ - (hint BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); } \ + (p BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); } \ //! #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS) #include BOOST_PP_LOCAL_ITERATE() @@ -471,7 +471,7 @@ class flat_set //! right before p) plus insertion linear to the elements with bigger keys than x. //! //! Note: If an element is inserted it might invalidate elements. - iterator insert(const_iterator position, value_type &&x); + iterator insert(const_iterator p, value_type &&x); #else BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert, value_type, iterator, this->priv_insert, const_iterator, const_iterator) #endif @@ -506,17 +506,17 @@ class flat_set #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - //! Effects: Erases the element pointed to by position. + //! Effects: Erases the element pointed to by p. //! //! Returns: Returns an iterator pointing to the element immediately //! following q prior to the element being erased. If no such element exists, //! returns end(). //! - //! Complexity: Linear to the elements with keys bigger than position + //! Complexity: Linear to the elements with keys bigger than p //! //! Note: Invalidates elements with keys //! not less than the erased element. - iterator erase(const_iterator position); + iterator erase(const_iterator p); //! Effects: Erases all elements in the container with key equivalent to x. //! @@ -912,21 +912,21 @@ class flat_multiset //! //! Note: If an element is inserted it might invalidate elements. template - iterator emplace_hint(const_iterator hint, Args&&... args) - { return this->base_t::emplace_hint_equal(hint, boost::forward(args)...); } + iterator emplace_hint(const_iterator p, Args&&... args) + { return this->base_t::emplace_hint_equal(p, boost::forward(args)...); } #else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING #define BOOST_PP_LOCAL_MACRO(n) \ BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \ iterator emplace(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \ - { return this->base_t::emplace_equal(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); } \ + { return this->base_t::emplace_equal(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); } \ \ BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \ - iterator emplace_hint(const_iterator hint \ + iterator emplace_hint(const_iterator p \ BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \ - { return this->base_t::emplace_hint_equal \ - (hint BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); } \ + { return this->base_t::emplace_hint_equal \ + (p BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); } \ //! #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS) #include BOOST_PP_LOCAL_ITERATE() @@ -978,7 +978,7 @@ class flat_multiset //! right before p) plus insertion linear to the elements with bigger keys than x. //! //! Note: If an element is inserted it might invalidate elements. - iterator insert(const_iterator position, value_type &&x); + iterator insert(const_iterator p, value_type &&x); #else BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert, value_type, iterator, this->priv_insert, const_iterator, const_iterator) #endif @@ -1012,7 +1012,7 @@ class flat_multiset #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) //! @copydoc ::boost::container::flat_set::erase(const_iterator) - iterator erase(const_iterator position); + iterator erase(const_iterator p); //! @copydoc ::boost::container::flat_set::erase(const key_type&) size_type erase(const key_type& x); diff --git a/include/boost/container/list.hpp b/include/boost/container/list.hpp index 291c190..0e6cb11 100644 --- a/include/boost/container/list.hpp +++ b/include/boost/container/list.hpp @@ -766,27 +766,27 @@ class list #endif #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - //! Requires: position must be a valid iterator of *this. + //! Requires: p must be a valid iterator of *this. //! - //! Effects: Insert a copy of x before position. + //! Effects: Insert a copy of x before p. //! //! Returns: an iterator to the inserted element. //! //! Throws: If memory allocation throws or x's copy constructor throws. //! //! Complexity: Amortized constant time. - iterator insert(const_iterator position, const T &x); + iterator insert(const_iterator p, const T &x); - //! Requires: position must be a valid iterator of *this. + //! Requires: p must be a valid iterator of *this. //! - //! Effects: Insert a new element before position with mx's resources. + //! Effects: Insert a new element before p with mx's resources. //! //! Returns: an iterator to the inserted element. //! //! Throws: If memory allocation throws. //! //! Complexity: Amortized constant time. - iterator insert(const_iterator position, T &&x); + iterator insert(const_iterator p, T &&x); #else BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert, T, iterator, priv_insert, const_iterator, const_iterator) #endif diff --git a/include/boost/container/map.hpp b/include/boost/container/map.hpp index ec1c30a..58722db 100644 --- a/include/boost/container/map.hpp +++ b/include/boost/container/map.hpp @@ -496,8 +496,8 @@ class map //! //! Complexity: Logarithmic in general, but amortized constant if t //! is inserted right before p. - iterator insert(const_iterator position, const value_type& x) - { return this->base_t::insert_unique(position, x); } + iterator insert(const_iterator p, const value_type& x) + { return this->base_t::insert_unique(p, x); } //! Effects: Move constructs a new value from x if and only if there is //! no element in the container with key equivalent to the key of x. @@ -508,8 +508,8 @@ class map //! //! Complexity: Logarithmic in general, but amortized constant if t //! is inserted right before p. - iterator insert(const_iterator position, BOOST_RV_REF(nonconst_value_type) x) - { return this->base_t::insert_unique(position, boost::move(x)); } + iterator insert(const_iterator p, BOOST_RV_REF(nonconst_value_type) x) + { return this->base_t::insert_unique(p, boost::move(x)); } //! Effects: Move constructs a new value from x if and only if there is //! no element in the container with key equivalent to the key of x. @@ -520,8 +520,8 @@ class map //! //! Complexity: Logarithmic in general, but amortized constant if t //! is inserted right before p. - iterator insert(const_iterator position, BOOST_RV_REF(movable_value_type) x) - { return this->base_t::insert_unique(position, boost::move(x)); } + iterator insert(const_iterator p, BOOST_RV_REF(movable_value_type) x) + { return this->base_t::insert_unique(p, boost::move(x)); } //! Effects: Inserts a copy of x in the container. //! p is a hint pointing to where the insert should start to search. @@ -529,8 +529,8 @@ class map //! Returns: An iterator pointing to the element with key equivalent to the key of x. //! //! Complexity: Logarithmic. - iterator insert(const_iterator position, const nonconst_value_type& x) - { return this->base_t::insert_unique(position, x); } + iterator insert(const_iterator p, const nonconst_value_type& x) + { return this->base_t::insert_unique(p, x); } //! Effects: Inserts an element move constructed from x in the container. //! p is a hint pointing to where the insert should start to search. @@ -538,8 +538,8 @@ class map //! Returns: An iterator pointing to the element with key equivalent to the key of x. //! //! Complexity: Logarithmic. - iterator insert(const_iterator position, BOOST_RV_REF(value_type) x) - { return this->base_t::insert_unique(position, boost::move(x)); } + iterator insert(const_iterator p, BOOST_RV_REF(value_type) x) + { return this->base_t::insert_unique(p, boost::move(x)); } //! Requires: first, last are not iterators into *this. //! @@ -579,8 +579,8 @@ class map //! Complexity: Logarithmic in general, but amortized constant if t //! is inserted right before p. template - iterator emplace_hint(const_iterator hint, Args&&... args) - { return this->base_t::emplace_hint_unique(hint, boost::forward(args)...); } + iterator emplace_hint(const_iterator p, Args&&... args) + { return this->base_t::emplace_hint_unique(p, boost::forward(args)...); } #else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING @@ -590,9 +590,9 @@ class map { return this->base_t::emplace_unique(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); }\ \ BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \ - iterator emplace_hint(const_iterator hint \ + iterator emplace_hint(const_iterator p \ BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \ - { return this->base_t::emplace_hint_unique(hint \ + { return this->base_t::emplace_hint_unique(p \ BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _));} \ //! #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS) @@ -602,14 +602,14 @@ class map #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - //! Effects: Erases the element pointed to by position. + //! Effects: Erases the element pointed to by p. //! //! Returns: Returns an iterator pointing to the element immediately //! following q prior to the element being erased. If no such element exists, //! returns end(). //! //! Complexity: Amortized constant time - iterator erase(const_iterator position) BOOST_CONTAINER_NOEXCEPT; + iterator erase(const_iterator p) BOOST_CONTAINER_NOEXCEPT; //! Effects: Erases all elements in the container with key equivalent to x. //! @@ -1074,8 +1074,8 @@ class multimap //! Complexity: Logarithmic in general, but amortized constant if t //! is inserted right before p. template - iterator emplace_hint(const_iterator hint, Args&&... args) - { return this->base_t::emplace_hint_equal(hint, boost::forward(args)...); } + iterator emplace_hint(const_iterator p, Args&&... args) + { return this->base_t::emplace_hint_equal(p, boost::forward(args)...); } #else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING @@ -1085,9 +1085,9 @@ class multimap { return this->base_t::emplace_equal(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); } \ \ BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \ - iterator emplace_hint(const_iterator hint \ + iterator emplace_hint(const_iterator p \ BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \ - { return this->base_t::emplace_hint_equal(hint \ + { return this->base_t::emplace_hint_equal(p \ BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _));} \ //! #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS) @@ -1131,8 +1131,8 @@ class multimap //! //! Complexity: Logarithmic in general, but amortized constant if t //! is inserted right before p. - iterator insert(const_iterator position, const value_type& x) - { return this->base_t::insert_equal(position, x); } + iterator insert(const_iterator p, const value_type& x) + { return this->base_t::insert_equal(p, x); } //! Effects: Inserts a new value constructed from x in the container. //! p is a hint pointing to where the insert should start to search. @@ -1142,8 +1142,8 @@ class multimap //! //! Complexity: Logarithmic in general, but amortized constant if t //! is inserted right before p. - iterator insert(const_iterator position, const nonconst_value_type& x) - { return this->base_t::insert_equal(position, x); } + iterator insert(const_iterator p, const nonconst_value_type& x) + { return this->base_t::insert_equal(p, x); } //! Effects: Inserts a new value move constructed from x in the container. //! p is a hint pointing to where the insert should start to search. @@ -1153,8 +1153,8 @@ class multimap //! //! Complexity: Logarithmic in general, but amortized constant if t //! is inserted right before p. - iterator insert(const_iterator position, BOOST_RV_REF(nonconst_value_type) x) - { return this->base_t::insert_equal(position, boost::move(x)); } + iterator insert(const_iterator p, BOOST_RV_REF(nonconst_value_type) x) + { return this->base_t::insert_equal(p, boost::move(x)); } //! Effects: Inserts a new value move constructed from x in the container. //! p is a hint pointing to where the insert should start to search. @@ -1164,8 +1164,8 @@ class multimap //! //! Complexity: Logarithmic in general, but amortized constant if t //! is inserted right before p. - iterator insert(const_iterator position, BOOST_RV_REF(movable_value_type) x) - { return this->base_t::insert_equal(position, boost::move(x)); } + iterator insert(const_iterator p, BOOST_RV_REF(movable_value_type) x) + { return this->base_t::insert_equal(p, boost::move(x)); } //! Requires: first, last are not iterators into *this. //! diff --git a/include/boost/container/set.hpp b/include/boost/container/set.hpp index 93a02d0..edf69b6 100644 --- a/include/boost/container/set.hpp +++ b/include/boost/container/set.hpp @@ -363,8 +363,8 @@ class set //! //! Complexity: Logarithmic. template - iterator emplace_hint(const_iterator hint, Args&&... args) - { return this->base_t::emplace_hint_unique(hint, boost::forward(args)...); } + iterator emplace_hint(const_iterator p, Args&&... args) + { return this->base_t::emplace_hint_unique(p, boost::forward(args)...); } #else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING @@ -374,9 +374,9 @@ class set { return this->base_t::emplace_unique(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); }\ \ BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \ - iterator emplace_hint(const_iterator hint \ + iterator emplace_hint(const_iterator p \ BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \ - { return this->base_t::emplace_hint_unique(hint \ + { return this->base_t::emplace_hint_unique(p \ BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _));} \ //! #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS) @@ -429,7 +429,7 @@ class set //! Returns: An iterator pointing to the element with key equivalent to the key of x. //! //! Complexity: Logarithmic. - iterator insert(const_iterator position, value_type &&x); + iterator insert(const_iterator p, value_type &&x); #else BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert, value_type, iterator, this->priv_insert, const_iterator, const_iterator) #endif @@ -851,8 +851,8 @@ class multiset //! Complexity: Logarithmic in general, but amortized constant if t //! is inserted right before p. template - iterator emplace_hint(const_iterator hint, Args&&... args) - { return this->base_t::emplace_hint_equal(hint, boost::forward(args)...); } + iterator emplace_hint(const_iterator p, Args&&... args) + { return this->base_t::emplace_hint_equal(p, boost::forward(args)...); } #else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING @@ -862,9 +862,9 @@ class multiset { return this->base_t::emplace_equal(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); } \ \ BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \ - iterator emplace_hint(const_iterator hint \ + iterator emplace_hint(const_iterator p \ BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \ - { return this->base_t::emplace_hint_equal(hint \ + { return this->base_t::emplace_hint_equal(p \ BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _));} \ //! #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS) @@ -910,7 +910,7 @@ class multiset //! //! Complexity: Logarithmic in general, but amortized constant if t //! is inserted right before p. - iterator insert(const_iterator position, value_type &&x); + iterator insert(const_iterator p, value_type &&x); #else BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert, value_type, iterator, this->priv_insert, const_iterator, const_iterator) #endif diff --git a/include/boost/container/slist.hpp b/include/boost/container/slist.hpp index 6941d29..dac44ad 100644 --- a/include/boost/container/slist.hpp +++ b/include/boost/container/slist.hpp @@ -736,8 +736,7 @@ class slist #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) //! Requires: p must be a valid iterator of *this. //! - //! Effects: Inserts a copy of the value after the position pointed - //! by prev_p. + //! Effects: Inserts a copy of the value after prev_p. //! //! Returns: An iterator to the inserted element. //! @@ -747,12 +746,12 @@ class slist //! //! Note: Does not affect the validity of iterators and references of //! previous values. - iterator insert_after(const_iterator prev_pos, const T &x); + iterator insert_after(const_iterator prev_p, const T &x); - //! Requires: prev_pos must be a valid iterator of *this. + //! Requires: prev_p must be a valid iterator of *this. //! //! Effects: Inserts a move constructed copy object from the value after the - //! p pointed by prev_pos. + //! p pointed by prev_p. //! //! Returns: An iterator to the inserted element. //! @@ -762,16 +761,16 @@ class slist //! //! Note: Does not affect the validity of iterators and references of //! previous values. - iterator insert_after(const_iterator prev_pos, T &&x); + iterator insert_after(const_iterator prev_p, T &&x); #else BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert_after, T, iterator, priv_insert_after, const_iterator, const_iterator) #endif - //! Requires: prev_pos must be a valid iterator of *this. + //! Requires: prev_p must be a valid iterator of *this. //! - //! Effects: Inserts n copies of x after prev_pos. + //! Effects: Inserts n copies of x after prev_p. //! - //! Returns: an iterator to the last inserted element or prev_pos if n is 0. + //! Returns: an iterator to the last inserted element or prev_p if n is 0. //! //! Throws: If memory allocation throws or T's copy constructor throws. //! @@ -780,18 +779,17 @@ class slist //! //! Note: Does not affect the validity of iterators and references of //! previous values. - iterator insert_after(const_iterator prev_pos, size_type n, const value_type& x) + iterator insert_after(const_iterator prev_p, size_type n, const value_type& x) { typedef constant_iterator cvalue_iterator; - return this->insert_after(prev_pos, cvalue_iterator(x, n), cvalue_iterator()); + return this->insert_after(prev_p, cvalue_iterator(x, n), cvalue_iterator()); } - //! Requires: prev_pos must be a valid iterator of *this. + //! Requires: prev_p must be a valid iterator of *this. //! - //! Effects: Inserts the range pointed by [first, last) - //! after the position prev_pos. + //! Effects: Inserts the range pointed by [first, last) after prev_p. //! - //! Returns: an iterator to the last inserted element or prev_pos if first == last. + //! Returns: an iterator to the last inserted element or prev_p if first == last. //! //! Throws: If memory allocation throws, T's constructor from a //! dereferenced InpIt throws. @@ -801,7 +799,7 @@ class slist //! Note: Does not affect the validity of iterators and references of //! previous values. template - iterator insert_after(const_iterator prev_pos, InpIt first, InpIt last + iterator insert_after(const_iterator prev_p, InpIt first, InpIt last #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) , typename container_detail::enable_if_c < !container_detail::is_convertible::value @@ -812,7 +810,7 @@ class slist #endif ) { - iterator ret_it(prev_pos.get()); + iterator ret_it(prev_p.get()); for (; first != last; ++first){ ret_it = iterator(this->icont().insert_after(ret_it.get(), *this->create_node_from_it(first))); } @@ -845,7 +843,7 @@ class slist void pop_front() { this->icont().pop_front_and_dispose(Destroyer(this->node_alloc())); } - //! Effects: Erases the element after the element pointed by prev_pos + //! Effects: Erases the element after the element pointed by prev_p //! of the list. //! //! Returns: the first element remaining beyond the removed elements, @@ -856,9 +854,9 @@ class slist //! Complexity: Constant. //! //! Note: Does not invalidate iterators or references to non erased elements. - iterator erase_after(const_iterator prev_pos) + iterator erase_after(const_iterator prev_p) { - return iterator(this->icont().erase_after_and_dispose(prev_pos.get(), Destroyer(this->node_alloc()))); + return iterator(this->icont().erase_after_and_dispose(prev_p.get(), Destroyer(this->node_alloc()))); } //! Effects: Erases the range (before_first, last) from @@ -912,11 +910,11 @@ class slist //! //! Note: Iterators of values obtained from list x now point to elements of //! this list. Iterators of this list and all the references are not invalidated. - void splice_after(const_iterator prev_pos, slist& x) BOOST_CONTAINER_NOEXCEPT + void splice_after(const_iterator prev_p, slist& x) BOOST_CONTAINER_NOEXCEPT { BOOST_ASSERT(this != &x); BOOST_ASSERT(this->node_alloc() == x.node_alloc()); - this->icont().splice_after(prev_pos.get(), x.icont()); + this->icont().splice_after(prev_p.get(), x.icont()); } //! Requires: p must point to an element contained @@ -932,16 +930,16 @@ class slist //! //! Note: Iterators of values obtained from list x now point to elements of //! this list. Iterators of this list and all the references are not invalidated. - void splice_after(const_iterator prev_pos, BOOST_RV_REF(slist) x) BOOST_CONTAINER_NOEXCEPT - { this->splice_after(prev_pos, static_cast(x)); } + void splice_after(const_iterator prev_p, BOOST_RV_REF(slist) x) BOOST_CONTAINER_NOEXCEPT + { this->splice_after(prev_p, static_cast(x)); } - //! Requires: prev_pos must be a valid iterator of this. + //! Requires: prev_p must be a valid iterator of this. //! i must point to an element contained in list x. //! this' allocator and x's allocator shall compare equal. //! //! Effects: Transfers the value pointed by i, from list x to this list, - //! after the element pointed by prev_pos. - //! If prev_pos == prev or prev_pos == ++prev, this function is a null operation. + //! after the element pointed by prev_p. + //! If prev_p == prev or prev_p == ++prev, this function is a null operation. //! //! Throws: Nothing //! @@ -949,19 +947,19 @@ class slist //! //! Note: Iterators of values obtained from list x now point to elements of this //! list. Iterators of this list and all the references are not invalidated. - void splice_after(const_iterator prev_pos, slist& x, const_iterator prev) BOOST_CONTAINER_NOEXCEPT + void splice_after(const_iterator prev_p, slist& x, const_iterator prev) BOOST_CONTAINER_NOEXCEPT { BOOST_ASSERT(this->node_alloc() == x.node_alloc()); - this->icont().splice_after(prev_pos.get(), x.icont(), prev.get()); + this->icont().splice_after(prev_p.get(), x.icont(), prev.get()); } - //! Requires: prev_pos must be a valid iterator of this. + //! Requires: prev_p must be a valid iterator of this. //! i must point to an element contained in list x. //! this' allocator and x's allocator shall compare equal. //! //! Effects: Transfers the value pointed by i, from list x to this list, - //! after the element pointed by prev_pos. - //! If prev_pos == prev or prev_pos == ++prev, this function is a null operation. + //! after the element pointed by prev_p. + //! If prev_p == prev or prev_p == ++prev, this function is a null operation. //! //! Throws: Nothing //! @@ -969,16 +967,16 @@ class slist //! //! Note: Iterators of values obtained from list x now point to elements of this //! list. Iterators of this list and all the references are not invalidated. - void splice_after(const_iterator prev_pos, BOOST_RV_REF(slist) x, const_iterator prev) BOOST_CONTAINER_NOEXCEPT - { this->splice_after(prev_pos, static_cast(x), prev); } + void splice_after(const_iterator prev_p, BOOST_RV_REF(slist) x, const_iterator prev) BOOST_CONTAINER_NOEXCEPT + { this->splice_after(prev_p, static_cast(x), prev); } - //! Requires: prev_pos must be a valid iterator of this. + //! Requires: prev_p must be a valid iterator of this. //! before_first and before_last must be valid iterators of x. - //! prev_pos must not be contained in [before_first, before_last) range. + //! prev_p must not be contained in [before_first, before_last) range. //! this' allocator and x's allocator shall compare equal. //! //! Effects: Transfers the range [before_first + 1, before_last + 1) - //! from list x to this list, after the element pointed by prev_pos. + //! from list x to this list, after the element pointed by prev_p. //! //! Throws: Nothing //! @@ -986,21 +984,21 @@ class slist //! //! Note: Iterators of values obtained from list x now point to elements of this //! list. Iterators of this list and all the references are not invalidated. - void splice_after(const_iterator prev_pos, slist& x, + void splice_after(const_iterator prev_p, slist& x, const_iterator before_first, const_iterator before_last) BOOST_CONTAINER_NOEXCEPT { BOOST_ASSERT(this->node_alloc() == x.node_alloc()); this->icont().splice_after - (prev_pos.get(), x.icont(), before_first.get(), before_last.get()); + (prev_p.get(), x.icont(), before_first.get(), before_last.get()); } - //! Requires: prev_pos must be a valid iterator of this. + //! Requires: prev_p must be a valid iterator of this. //! before_first and before_last must be valid iterators of x. - //! prev_pos must not be contained in [before_first, before_last) range. + //! prev_p must not be contained in [before_first, before_last) range. //! this' allocator and x's allocator shall compare equal. //! //! Effects: Transfers the range [before_first + 1, before_last + 1) - //! from list x to this list, after the element pointed by prev_pos. + //! from list x to this list, after the element pointed by prev_p. //! //! Throws: Nothing //! @@ -1008,18 +1006,18 @@ class slist //! //! Note: Iterators of values obtained from list x now point to elements of this //! list. Iterators of this list and all the references are not invalidated. - void splice_after(const_iterator prev_pos, BOOST_RV_REF(slist) x, + void splice_after(const_iterator prev_p, BOOST_RV_REF(slist) x, const_iterator before_first, const_iterator before_last) BOOST_CONTAINER_NOEXCEPT - { this->splice_after(prev_pos, static_cast(x), before_first, before_last); } + { this->splice_after(prev_p, static_cast(x), before_first, before_last); } - //! Requires: prev_pos must be a valid iterator of this. + //! Requires: prev_p must be a valid iterator of this. //! before_first and before_last must be valid iterators of x. - //! prev_pos must not be contained in [before_first, before_last) range. + //! prev_p must not be contained in [before_first, before_last) range. //! n == std::distance(before_first, before_last). //! this' allocator and x's allocator shall compare equal. //! //! Effects: Transfers the range [before_first + 1, before_last + 1) - //! from list x to this list, after the element pointed by prev_pos. + //! from list x to this list, after the element pointed by prev_p. //! //! Throws: Nothing //! @@ -1027,23 +1025,23 @@ class slist //! //! Note: Iterators of values obtained from list x now point to elements of this //! list. Iterators of this list and all the references are not invalidated. - void splice_after(const_iterator prev_pos, slist& x, + void splice_after(const_iterator prev_p, slist& x, const_iterator before_first, const_iterator before_last, size_type n) BOOST_CONTAINER_NOEXCEPT { BOOST_ASSERT(this->node_alloc() == x.node_alloc()); this->icont().splice_after - (prev_pos.get(), x.icont(), before_first.get(), before_last.get(), n); + (prev_p.get(), x.icont(), before_first.get(), before_last.get(), n); } - //! Requires: prev_pos must be a valid iterator of this. + //! Requires: prev_p must be a valid iterator of this. //! before_first and before_last must be valid iterators of x. - //! prev_pos must not be contained in [before_first, before_last) range. + //! prev_p must not be contained in [before_first, before_last) range. //! n == std::distance(before_first, before_last). //! this' allocator and x's allocator shall compare equal. //! //! Effects: Transfers the range [before_first + 1, before_last + 1) - //! from list x to this list, after the element pointed by prev_pos. + //! from list x to this list, after the element pointed by prev_p. //! //! Throws: Nothing //! @@ -1051,10 +1049,10 @@ class slist //! //! Note: Iterators of values obtained from list x now point to elements of this //! list. Iterators of this list and all the references are not invalidated. - void splice_after(const_iterator prev_pos, BOOST_RV_REF(slist) x, + void splice_after(const_iterator prev_p, BOOST_RV_REF(slist) x, const_iterator before_first, const_iterator before_last, size_type n) BOOST_CONTAINER_NOEXCEPT - { this->splice_after(prev_pos, static_cast(x), before_first, before_last, n); } + { this->splice_after(prev_p, static_cast(x), before_first, before_last, n); } //! Effects: Removes all the elements that compare equal to value. //! @@ -1264,7 +1262,7 @@ class slist //! Throws: If memory allocation throws or x's copy constructor throws. //! //! Complexity: Linear to the elements before p. - iterator insert(const_iterator position, const T &x); + iterator insert(const_iterator p, const T &x); //! Requires: p must be a valid iterator of *this. //! @@ -1275,7 +1273,7 @@ class slist //! Throws: If memory allocation throws. //! //! Complexity: Linear to the elements before p. - iterator insert(const_iterator prev_pos, T &&x); + iterator insert(const_iterator prev_p, T &&x); #else BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert, T, iterator, priv_insert, const_iterator, const_iterator) #endif @@ -1521,8 +1519,8 @@ class slist { return this->insert_after(previous(p), ::boost::forward(x)); } template - iterator priv_insert_after(const_iterator prev_pos, BOOST_FWD_REF(U) x) - { return iterator(this->icont().insert_after(prev_pos.get(), *this->create_node(::boost::forward(x)))); } + iterator priv_insert_after(const_iterator prev_p, BOOST_FWD_REF(U) x) + { return iterator(this->icont().insert_after(prev_p.get(), *this->create_node(::boost::forward(x)))); } class insertion_functor; friend class insertion_functor; diff --git a/include/boost/container/stable_vector.hpp b/include/boost/container/stable_vector.hpp index cbe5886..56e5bc3 100644 --- a/include/boost/container/stable_vector.hpp +++ b/include/boost/container/stable_vector.hpp @@ -1223,24 +1223,23 @@ class stable_vector this->insert(this->cend(), EmplaceIterator(ef), EmplaceIterator()); } - //! Requires: position must be a valid iterator of *this. + //! Requires: p must be a valid iterator of *this. //! //! Effects: Inserts an object of type T constructed with - //! std::forward(args)... before position + //! std::forward(args)... before p //! //! Throws: If memory allocation throws or the in-place constructor throws. //! - //! Complexity: If position is end(), amortized constant time + //! Complexity: If p is end(), amortized constant time //! Linear time otherwise. template - iterator emplace(const_iterator position, Args && ...args) + iterator emplace(const_iterator p, Args && ...args) { - //Just call more general insert(pos, size, value) and return iterator - size_type pos_n = position - cbegin(); + size_type pos_n = p - cbegin(); typedef emplace_functor EmplaceFunctor; typedef emplace_iterator EmplaceIterator; EmplaceFunctor &&ef = EmplaceFunctor(boost::forward(args)...); - this->insert(position, EmplaceIterator(ef), EmplaceIterator()); + this->insert(p, EmplaceIterator(ef), EmplaceIterator()); return iterator(this->begin() + pos_n); } @@ -1261,7 +1260,7 @@ class stable_vector } \ \ BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \ - iterator emplace(const_iterator pos \ + iterator emplace(const_iterator p \ BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \ { \ typedef BOOST_PP_CAT(BOOST_PP_CAT(emplace_functor, n), arg) \ @@ -1271,8 +1270,8 @@ class stable_vector EmplaceFunctor ef BOOST_PP_LPAREN_IF(n) \ BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) \ BOOST_PP_RPAREN_IF(n); \ - size_type pos_n = pos - this->cbegin(); \ - this->insert(pos, EmplaceIterator(ef), EmplaceIterator()); \ + size_type pos_n = p - this->cbegin(); \ + this->insert(p, EmplaceIterator(ef), EmplaceIterator()); \ return iterator(this->begin() + pos_n); \ } \ //! @@ -1302,61 +1301,61 @@ class stable_vector #endif #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - //! Requires: position must be a valid iterator of *this. + //! Requires: p must be a valid iterator of *this. //! - //! Effects: Insert a copy of x before position. + //! Effects: Insert a copy of x before p. //! //! Returns: An iterator to the inserted element. //! //! Throws: If memory allocation throws or x's copy constructor throws. //! - //! Complexity: If position is end(), amortized constant time + //! Complexity: If p is end(), amortized constant time //! Linear time otherwise. - iterator insert(const_iterator position, const T &x); + iterator insert(const_iterator p, const T &x); - //! Requires: position must be a valid iterator of *this. + //! Requires: p must be a valid iterator of *this. //! - //! Effects: Insert a new element before position with mx's resources. + //! Effects: Insert a new element before p with mx's resources. //! //! Returns: an iterator to the inserted element. //! //! Throws: If memory allocation throws. //! - //! Complexity: If position is end(), amortized constant time + //! Complexity: If p is end(), amortized constant time //! Linear time otherwise. - iterator insert(const_iterator position, T &&x); + iterator insert(const_iterator p, T &&x); #else BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert, T, iterator, priv_insert, const_iterator, const_iterator) #endif - //! Requires: pos must be a valid iterator of *this. + //! Requires: p must be a valid iterator of *this. //! - //! Effects: Insert n copies of x before position. + //! Effects: Insert n copies of x before p. //! - //! Returns: an iterator to the first inserted element or position if n is 0. + //! Returns: an iterator to the first inserted element or p if n is 0. //! //! Throws: If memory allocation throws or T's copy constructor throws. //! //! Complexity: Linear to n. - iterator insert(const_iterator position, size_type n, const T& t) + iterator insert(const_iterator p, size_type n, const T& t) { STABLE_VECTOR_CHECK_INVARIANT; typedef constant_iterator cvalue_iterator; - return this->insert(position, cvalue_iterator(t, n), cvalue_iterator()); + return this->insert(p, cvalue_iterator(t, n), cvalue_iterator()); } - //! Requires: pos must be a valid iterator of *this. + //! Requires: p must be a valid iterator of *this. //! - //! Effects: Insert a copy of the [first, last) range before pos. + //! Effects: Insert a copy of the [first, last) range before p. //! - //! Returns: an iterator to the first inserted element or position if first == last. + //! Returns: an iterator to the first inserted element or p if first == last. //! //! Throws: If memory allocation throws, T's constructor from a //! dereferenced InpIt throws or T's copy constructor throws. //! //! Complexity: Linear to std::distance [first, last). template - iterator insert(const_iterator position, InputIterator first, InputIterator last + iterator insert(const_iterator p, InputIterator first, InputIterator last #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) , typename container_detail::enable_if_c < !container_detail::is_convertible::value @@ -1366,16 +1365,16 @@ class stable_vector ) { STABLE_VECTOR_CHECK_INVARIANT; - const size_type pos_n = position - this->cbegin(); + const size_type pos_n = p - this->cbegin(); for(; first != last; ++first){ - this->emplace(position, *first); + this->emplace(p, *first); } return this->begin() + pos_n; } #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) template - iterator insert(const_iterator position, FwdIt first, FwdIt last + iterator insert(const_iterator p, FwdIt first, FwdIt last , typename container_detail::enable_if_c < !container_detail::is_convertible::value && !container_detail::is_input_iterator::value @@ -1383,13 +1382,13 @@ class stable_vector ) { const size_type num_new = static_cast(std::distance(first, last)); - const size_type pos = static_cast(position - this->cbegin()); + const size_type idx = static_cast(p - this->cbegin()); if(num_new){ - //Fills the node pool and inserts num_new null pointers in pos. - //If a new buffer was needed fixes up pointers up to pos so + //Fills the node pool and inserts num_new null pointers in idx. + //If a new buffer was needed fixes up pointers up to idx so //past-new nodes are not aligned until the end of this function //or in a rollback in case of exception - index_iterator it_past_newly_constructed(this->priv_insert_forward_non_templated(pos, num_new)); + index_iterator it_past_newly_constructed(this->priv_insert_forward_non_templated(idx, num_new)); const index_iterator it_past_new(it_past_newly_constructed + num_new); { //Prepare rollback @@ -1407,10 +1406,10 @@ class stable_vector //rollback.~insert_rollback() called in case of exception } //Fix up pointers for past-new nodes (new nodes were fixed during construction) and - //nodes before insertion position in priv_insert_forward_non_templated(...) + //nodes before insertion p in priv_insert_forward_non_templated(...) index_traits_type::fix_up_pointers_from(this->index, it_past_newly_constructed); } - return this->begin() + pos; + return this->begin() + idx; } #endif @@ -1422,18 +1421,18 @@ class stable_vector void pop_back() BOOST_CONTAINER_NOEXCEPT { this->erase(--this->cend()); } - //! Effects: Erases the element at position pos. + //! Effects: Erases the element at p. //! //! Throws: Nothing. //! - //! Complexity: Linear to the elements between pos and the - //! last element. Constant if pos is the last element. - iterator erase(const_iterator position) BOOST_CONTAINER_NOEXCEPT + //! Complexity: Linear to the elements between p and the + //! last element. Constant if p is the last element. + iterator erase(const_iterator p) BOOST_CONTAINER_NOEXCEPT { STABLE_VECTOR_CHECK_INVARIANT; - const size_type d = position - this->cbegin(); + const size_type d = p - this->cbegin(); index_iterator it = this->index.begin() + d; - this->priv_delete_node(position.node_pointer()); + this->priv_delete_node(p.node_pointer()); it = this->index.erase(it); index_traits_type::fix_up_pointers_from(this->index, it); return iterator(node_ptr_traits::static_cast_from(*it)); @@ -1444,7 +1443,7 @@ class stable_vector //! Throws: Nothing. //! //! Complexity: Linear to the distance between first and last - //! plus linear to the elements between pos and the last element. + //! plus linear to the elements between p and the last element. iterator erase(const_iterator first, const_iterator last) BOOST_CONTAINER_NOEXCEPT { STABLE_VECTOR_CHECK_INVARIANT; @@ -1584,7 +1583,7 @@ class stable_vector node_ptr m_p; }; - index_iterator priv_insert_forward_non_templated(size_type pos, size_type num_new) + index_iterator priv_insert_forward_non_templated(size_type idx, size_type num_new) { index_traits_type::initialize_end_node(this->index, this->internal_data.end_node, num_new); @@ -1595,15 +1594,15 @@ class stable_vector //Now try to make room in the vector const node_base_ptr_ptr old_buffer = this->index.data(); - this->index.insert(this->index.begin() + pos, num_new, node_ptr()); + this->index.insert(this->index.begin() + idx, num_new, node_ptr()); bool new_buffer = this->index.data() != old_buffer; //Fix the pointers for the newly allocated buffer const index_iterator index_beg = this->index.begin(); if(new_buffer){ - index_traits_type::fix_up_pointers(index_beg, index_beg + pos); + index_traits_type::fix_up_pointers(index_beg, index_beg + idx); } - return index_beg + pos; + return index_beg + idx; } bool priv_capacity_bigger_than_size() const @@ -1634,18 +1633,18 @@ class stable_vector } } - iterator priv_insert(const_iterator position, const value_type &t) + iterator priv_insert(const_iterator p, const value_type &t) { typedef constant_iterator cvalue_iterator; - return this->insert(position, cvalue_iterator(t, 1), cvalue_iterator()); + return this->insert(p, cvalue_iterator(t, 1), cvalue_iterator()); } - iterator priv_insert(const_iterator position, BOOST_RV_REF(T) x) + iterator priv_insert(const_iterator p, BOOST_RV_REF(T) x) { typedef repeat_iterator repeat_it; typedef boost::move_iterator repeat_move_it; - //Just call more general insert(pos, size, value) and return iterator - return this->insert(position, repeat_move_it(repeat_it(x, 1)), repeat_move_it(repeat_it())); + //Just call more general insert(p, size, value) and return iterator + return this->insert(p, repeat_move_it(repeat_it(x, 1)), repeat_move_it(repeat_it())); } void priv_clear_pool() diff --git a/include/boost/container/static_vector.hpp b/include/boost/container/static_vector.hpp index 234fc26..e59dd52 100644 --- a/include/boost/container/static_vector.hpp +++ b/include/boost/container/static_vector.hpp @@ -468,13 +468,13 @@ public: void pop_back(); //! @pre - //! @li \c position must be a valid iterator of \c *this in range [begin(), end()]. + //! @li \c p must be a valid iterator of \c *this in range [begin(), end()]. //! @li size() < capacity() //! - //! @brief Inserts a copy of element at position. + //! @brief Inserts a copy of element at p. //! - //! @param position The position at which the new value will be inserted. - //! @param value The value used to copy construct the new element. + //! @param p The position at which the new value will be inserted. + //! @param value The value used to copy construct the new element. //! //! @par Throws //! @li If Value's copy constructor or copy assignment throws @@ -482,33 +482,33 @@ public: //! //! @par Complexity //! Constant or linear. - iterator insert(iterator position, value_type const& value); + iterator insert(const_iterator p, value_type const& value); //! @pre - //! @li \c position must be a valid iterator of \c *this in range [begin(), end()]. + //! @li \c p must be a valid iterator of \c *this in range [begin(), end()]. //! @li size() < capacity() //! - //! @brief Inserts a move-constructed element at position. + //! @brief Inserts a move-constructed element at p. //! - //! @param position The position at which the new value will be inserted. - //! @param value The value used to move construct the new element. + //! @param p The position at which the new value will be inserted. + //! @param value The value used to move construct the new element. //! //! @par Throws //! If Value's move constructor or move assignment throws. //! //! @par Complexity //! Constant or linear. - iterator insert(iterator position, BOOST_RV_REF(value_type) value); + iterator insert(const_iterator p, BOOST_RV_REF(value_type) value); //! @pre - //! @li \c position must be a valid iterator of \c *this in range [begin(), end()]. + //! @li \c p must be a valid iterator of \c *this in range [begin(), end()]. //! @li size() + count <= capacity() //! - //! @brief Inserts a count copies of value at position. + //! @brief Inserts a count copies of value at p. //! - //! @param position The position at which new elements will be inserted. - //! @param count The number of new elements which will be inserted. - //! @param value The value used to copy construct new elements. + //! @param p The position at which new elements will be inserted. + //! @param count The number of new elements which will be inserted. + //! @param value The value used to copy construct new elements. //! //! @par Throws //! @li If Value's copy constructor or copy assignment throws. @@ -516,18 +516,18 @@ public: //! //! @par Complexity //! Linear O(N). - iterator insert(iterator position, size_type count, value_type const& value); + iterator insert(const_iterator p, size_type count, value_type const& value); //! @pre - //! @li \c position must be a valid iterator of \c *this in range [begin(), end()]. + //! @li \c p must be a valid iterator of \c *this in range [begin(), end()]. //! @li distance(first, last) <= capacity() //! @li \c Iterator must meet the \c ForwardTraversalIterator concept. //! - //! @brief Inserts a copy of a range [first, last) at position. + //! @brief Inserts a copy of a range [first, last) at p. //! - //! @param position The position at which new elements will be inserted. - //! @param first The iterator to the first element of a range used to construct new elements. - //! @param last The iterator to the one after the last element of a range used to construct new elements. + //! @param p The position at which new elements will be inserted. + //! @param first The iterator to the first element of a range used to construct new elements. + //! @param last The iterator to the one after the last element of a range used to construct new elements. //! //! @par Throws //! @li If Value's constructor and assignment taking a dereferenced \c Iterator. @@ -536,20 +536,20 @@ public: //! @par Complexity //! Linear O(N). template - iterator insert(iterator position, Iterator first, Iterator last); + iterator insert(const_iterator p, Iterator first, Iterator last); - //! @pre \c position must be a valid iterator of \c *this in range [begin(), end()) + //! @pre \c p must be a valid iterator of \c *this in range [begin(), end()) //! - //! @brief Erases Value from position. + //! @brief Erases Value from p. //! - //! @param position The position of the element which will be erased from the container. + //! @param p The position of the element which will be erased from the container. //! //! @par Throws //! If Value's move assignment throws. //! //! @par Complexity //! Linear O(N). - iterator erase(iterator position); + iterator erase(const_iterator p); //! @pre //! @li \c first and \c last must define a valid range @@ -565,7 +565,7 @@ public: //! //! @par Complexity //! Linear O(N). - iterator erase(iterator first, iterator last); + iterator erase(const_iterator first, const_iterator last); //! @pre distance(first, last) <= capacity() //! @@ -612,14 +612,14 @@ public: void emplace_back(Args &&...args); //! @pre - //! @li \c position must be a valid iterator of \c *this in range [begin(), end()] + //! @li \c p must be a valid iterator of \c *this in range [begin(), end()] //! @li size() < capacity() //! //! @brief Inserts a Value constructed with - //! \c std::forward(args)... before position + //! \c std::forward(args)... before p //! - //! @param position The position at which new elements will be inserted. - //! @param args The arguments of the constructor of the new element. + //! @param p The position at which new elements will be inserted. + //! @param args The arguments of the constructor of the new element. //! //! @par Throws //! If in-place constructor throws or if Value's move constructor or move assignment throws. @@ -627,7 +627,7 @@ public: //! @par Complexity //! Constant or linear. template - iterator emplace(iterator position, Args &&...args); + iterator emplace(const_iterator p, Args &&...args); //! @brief Removes all elements from the container. //!