From 546a3f0f1256f112cad593764cf71ffaa1f91e22 Mon Sep 17 00:00:00 2001 From: "Jeffrey Lee Hellrung, Jr." Date: Tue, 23 Oct 2012 12:56:01 +0000 Subject: [PATCH] refs #7531 (variable shadowing in container and intrusive) [SVN r81050] --- include/boost/container/detail/flat_tree.hpp | 56 +++++++++---------- .../detail/multiallocation_chain.hpp | 24 ++++---- include/boost/container/flat_map.hpp | 12 ++-- include/boost/container/flat_set.hpp | 12 ++-- include/boost/container/map.hpp | 4 +- include/boost/container/set.hpp | 4 +- include/boost/container/stable_vector.hpp | 6 +- include/boost/container/string.hpp | 28 +++++----- 8 files changed, 73 insertions(+), 73 deletions(-) diff --git a/include/boost/container/detail/flat_tree.hpp b/include/boost/container/detail/flat_tree.hpp index b6f9214..9146fd4 100644 --- a/include/boost/container/detail/flat_tree.hpp +++ b/include/boost/container/detail/flat_tree.hpp @@ -48,7 +48,7 @@ class flat_tree_value_compare typedef Value first_argument_type; typedef Value second_argument_type; typedef bool return_type; - public: + public: flat_tree_value_compare() : Compare() {} @@ -65,7 +65,7 @@ class flat_tree_value_compare const Compare &get_comp() const { return *this; } - + Compare &get_comp() { return *this; } }; @@ -238,7 +238,7 @@ class flat_tree flat_tree& operator=(BOOST_RV_REF(flat_tree) mx) { m_data = boost::move(mx.m_data); return *this; } - public: + public: // accessors: Compare key_comp() const { return this->m_data.get_comp(); } @@ -446,11 +446,11 @@ class flat_tree //Loop in burst sizes while(len){ const size_type burst = len < BurstSize ? len : BurstSize; - const const_iterator cend(this->cend()); + const const_iterator cend_(this->cend()); len -= burst; for(size_type i = 0; i != burst; ++i){ //Get the insertion position for each key - pos = const_cast(*this).priv_upper_bound(pos, cend, KeyOfValue()(*first)); + pos = const_cast(*this).priv_upper_bound(pos, cend_, KeyOfValue()(*first)); positions[i] = static_cast(pos - beg); ++first; } @@ -497,14 +497,14 @@ class flat_tree while(len){ const size_type burst = len < BurstSize ? len : BurstSize; size_type unique_burst = 0u; - const const_iterator cend(this->cend()); + const const_iterator cend_(this->cend()); while(unique_burst < burst && len > 0){ //Get the insertion position for each key const value_type & val = *first++; --len; - pos = const_cast(*this).priv_lower_bound(pos, cend, KeyOfValue()(val)); + pos = const_cast(*this).priv_lower_bound(pos, cend_, KeyOfValue()(val)); //Check if already present - if(pos != cend && !value_comp(val, *pos)){ + if(pos != cend_ && !value_comp(val, *pos)){ if(unique_burst > 0){ ++skips[unique_burst-1]; } @@ -692,22 +692,22 @@ class flat_tree // set operations: iterator find(const key_type& k) { - const Compare &key_comp = this->m_data.get_comp(); + const Compare &key_comp_ = this->m_data.get_comp(); iterator i = this->lower_bound(k); - if (i != this->end() && key_comp(k, KeyOfValue()(*i))){ - i = this->end(); + if (i != this->end() && key_comp_(k, KeyOfValue()(*i))){ + i = this->end(); } return i; } const_iterator find(const key_type& k) const { - const Compare &key_comp = this->m_data.get_comp(); + const Compare &key_comp_ = this->m_data.get_comp(); const_iterator i = this->lower_bound(k); - if (i != this->end() && key_comp(k, KeyOfValue()(*i))){ - i = this->end(); + if (i != this->end() && key_comp_(k, KeyOfValue()(*i))){ + i = this->end(); } return i; } @@ -737,11 +737,11 @@ class flat_tree std::pair equal_range(const key_type& k) const { return this->priv_equal_range(this->begin(), this->end(), k); } - size_type capacity() const + size_type capacity() const { return this->m_data.m_vect.capacity(); } - void reserve(size_type count) - { this->m_data.m_vect.reserve(count); } + void reserve(size_type count_) + { this->m_data.m_vect.reserve(count_); } private: struct insert_commit_data @@ -780,13 +780,13 @@ class flat_tree } std::pair priv_insert_unique_prepare - (const_iterator beg, const_iterator end, const value_type& val, insert_commit_data &commit_data) + (const_iterator beg, const_iterator end_, const value_type& val, insert_commit_data &commit_data) { const value_compare &value_comp = this->m_data; - commit_data.position = this->priv_lower_bound(beg, end, KeyOfValue()(val)); + commit_data.position = this->priv_lower_bound(beg, end_, KeyOfValue()(val)); return std::pair ( *reinterpret_cast(&commit_data.position) - , commit_data.position == end || value_comp(val, *commit_data.position)); + , commit_data.position == end_ || value_comp(val, *commit_data.position)); } std::pair priv_insert_unique_prepare @@ -854,7 +854,7 @@ class flat_tree RanIt priv_lower_bound(RanIt first, RanIt last, const key_type & key) const { - const Compare &key_comp = this->m_data.get_comp(); + const Compare &key_comp_ = this->m_data.get_comp(); KeyOfValue key_extract; difference_type len = last - first, half; RanIt middle; @@ -864,7 +864,7 @@ class flat_tree middle = first; middle += half; - if (key_comp(key_extract(*middle), key)) { + if (key_comp_(key_extract(*middle), key)) { ++middle; first = middle; len = len - half - 1; @@ -879,7 +879,7 @@ class flat_tree RanIt priv_upper_bound(RanIt first, RanIt last, const key_type & key) const { - const Compare &key_comp = this->m_data.get_comp(); + const Compare &key_comp_ = this->m_data.get_comp(); KeyOfValue key_extract; difference_type len = last - first, half; RanIt middle; @@ -889,12 +889,12 @@ class flat_tree middle = first; middle += half; - if (key_comp(key, key_extract(*middle))) { + if (key_comp_(key, key_extract(*middle))) { len = half; } else{ first = ++middle; - len = len - half - 1; + len = len - half - 1; } } return first; @@ -904,7 +904,7 @@ class flat_tree std::pair priv_equal_range(RanIt first, RanIt last, const key_type& key) const { - const Compare &key_comp = this->m_data.get_comp(); + const Compare &key_comp_ = this->m_data.get_comp(); KeyOfValue key_extract; difference_type len = last - first, half; RanIt middle, left, right; @@ -914,12 +914,12 @@ class flat_tree middle = first; middle += half; - if (key_comp(key_extract(*middle), key)){ + if (key_comp_(key_extract(*middle), key)){ first = middle; ++first; len = len - half - 1; } - else if (key_comp(key, key_extract(*middle))){ + else if (key_comp_(key, key_extract(*middle))){ len = half; } else { diff --git a/include/boost/container/detail/multiallocation_chain.hpp b/include/boost/container/detail/multiallocation_chain.hpp index 98d0924..5752083 100644 --- a/include/boost/container/detail/multiallocation_chain.hpp +++ b/include/boost/container/detail/multiallocation_chain.hpp @@ -126,22 +126,22 @@ class basic_multiallocation_chain return ret; } - void splice_after(iterator after_this, basic_multiallocation_chain &x, iterator before_begin, iterator before_end) - { slist_impl_.splice_after(after_this, x.slist_impl_, before_begin, before_end); } + void splice_after(iterator after_this, basic_multiallocation_chain &x, iterator before_begin_, iterator before_end) + { slist_impl_.splice_after(after_this, x.slist_impl_, before_begin_, before_end); } - void splice_after(iterator after_this, basic_multiallocation_chain &x, iterator before_begin, iterator before_end, size_type n) - { slist_impl_.splice_after(after_this, x.slist_impl_, before_begin, before_end, n); } + void splice_after(iterator after_this, basic_multiallocation_chain &x, iterator before_begin_, iterator before_end, size_type n) + { slist_impl_.splice_after(after_this, x.slist_impl_, before_begin_, before_end, n); } void splice_after(iterator after_this, basic_multiallocation_chain &x) { slist_impl_.splice_after(after_this, x.slist_impl_); } - void incorporate_after(iterator after_this, void_pointer begin , iterator before_end) + void incorporate_after(iterator after_this, void_pointer begin_ , iterator before_end) { - slist_impl_.incorporate_after(after_this, to_node_ptr(begin), to_node_ptr(before_end)); + slist_impl_.incorporate_after(after_this, to_node_ptr(begin_), to_node_ptr(before_end)); } - void incorporate_after(iterator after_this, void_pointer begin, void_pointer before_end, size_type n) - { slist_impl_.incorporate_after(after_this, to_node_ptr(begin), to_node_ptr(before_end), n); } + void incorporate_after(iterator after_this, void_pointer begin_, void_pointer before_end, size_type n) + { slist_impl_.incorporate_after(after_this, to_node_ptr(begin_), to_node_ptr(before_end), n); } void swap(basic_multiallocation_chain &x) { slist_impl_.swap(x.slist_impl_); } @@ -217,11 +217,11 @@ class transform_multiallocation_chain void swap(transform_multiallocation_chain &other_chain) { holder_.swap(other_chain.holder_); } - void splice_after(iterator after_this, transform_multiallocation_chain &x, iterator before_begin, iterator before_end, size_type n) - { holder_.splice_after(after_this.base(), x.holder_, before_begin.base(), before_end.base(), n); } + void splice_after(iterator after_this, transform_multiallocation_chain &x, iterator before_begin_, iterator before_end, size_type n) + { holder_.splice_after(after_this.base(), x.holder_, before_begin_.base(), before_end.base(), n); } - void incorporate_after(iterator after_this, pointer begin, pointer before_end, size_type n) - { holder_.incorporate_after(after_this.base(), begin, before_end, n); } + void incorporate_after(iterator after_this, pointer begin_, pointer before_end, size_type n) + { holder_.incorporate_after(after_this.base(), begin_, before_end, n); } pointer pop_front() { return cast(holder_.pop_front()); } diff --git a/include/boost/container/flat_map.hpp b/include/boost/container/flat_map.hpp index 1422d31..4fb9e07 100644 --- a/include/boost/container/flat_map.hpp +++ b/include/boost/container/flat_map.hpp @@ -418,7 +418,7 @@ class flat_map //! Throws: Nothing. //! //! Complexity: Constant. - size_type capacity() const + size_type capacity() const { return m_flat_tree.capacity(); } //! Effects: If n is less than or equal to capacity(), this call has no @@ -430,8 +430,8 @@ class flat_map //! //! Note: If capacity() is less than "count", iterators and references to //! to values might be invalidated. - void reserve(size_type count) - { m_flat_tree.reserve(count); } + void reserve(size_type count_) + { m_flat_tree.reserve(count_); } //! Effects: Tries to deallocate the excess of memory created // with previous allocations. The size of the vector is unchanged @@ -1266,7 +1266,7 @@ class flat_multimap //! Throws: Nothing. //! //! Complexity: Constant. - size_type capacity() const + size_type capacity() const { return m_flat_tree.capacity(); } //! Effects: If n is less than or equal to capacity(), this call has no @@ -1278,8 +1278,8 @@ class flat_multimap //! //! Note: If capacity() is less than "count", iterators and references to //! to values might be invalidated. - void reserve(size_type count) - { m_flat_tree.reserve(count); } + void reserve(size_type count_) + { m_flat_tree.reserve(count_); } //! Effects: Tries to deallocate the excess of memory created // with previous allocations. The size of the vector is unchanged diff --git a/include/boost/container/flat_set.hpp b/include/boost/container/flat_set.hpp index a2fbae9..b6266e6 100644 --- a/include/boost/container/flat_set.hpp +++ b/include/boost/container/flat_set.hpp @@ -365,7 +365,7 @@ class flat_set //! Throws: Nothing. //! //! Complexity: Constant. - size_type capacity() const + size_type capacity() const { return m_flat_tree.capacity(); } //! Effects: If n is less than or equal to capacity(), this call has no @@ -377,8 +377,8 @@ class flat_set //! //! Note: If capacity() is less than "count", iterators and references to //! to values might be invalidated. - void reserve(size_type count) - { m_flat_tree.reserve(count); } + void reserve(size_type count_) + { m_flat_tree.reserve(count_); } //! Effects: Tries to deallocate the excess of memory created // with previous allocations. The size of the vector is unchanged @@ -1045,7 +1045,7 @@ class flat_multiset //! Throws: Nothing. //! //! Complexity: Constant. - size_type capacity() const + size_type capacity() const { return m_flat_tree.capacity(); } //! Effects: If n is less than or equal to capacity(), this call has no @@ -1057,8 +1057,8 @@ class flat_multiset //! //! Note: If capacity() is less than "count", iterators and references to //! to values might be invalidated. - void reserve(size_type count) - { m_flat_tree.reserve(count); } + void reserve(size_type count_) + { m_flat_tree.reserve(count_); } //! Effects: Tries to deallocate the excess of memory created // with previous allocations. The size of the vector is unchanged diff --git a/include/boost/container/map.hpp b/include/boost/container/map.hpp index cde829e..92d499a 100644 --- a/include/boost/container/map.hpp +++ b/include/boost/container/map.hpp @@ -951,9 +951,9 @@ class multimap //! //! Complexity: Linear in N. template - multimap(ordered_range_t ordered_range, InputIterator first, InputIterator last, const Compare& comp = Compare(), + multimap(ordered_range_t ordered_range_, InputIterator first, InputIterator last, const Compare& comp = Compare(), const allocator_type& a = allocator_type()) - : m_tree(ordered_range, first, last, comp, a) + : m_tree(ordered_range_, first, last, comp, a) {} //! Effects: Copy constructs a multimap. diff --git a/include/boost/container/set.hpp b/include/boost/container/set.hpp index bdb89f2..3c6fcd5 100644 --- a/include/boost/container/set.hpp +++ b/include/boost/container/set.hpp @@ -757,10 +757,10 @@ class multiset //! //! Complexity: Linear in N. template - multiset( ordered_range_t ordered_range, InputIterator first, InputIterator last + multiset( ordered_range_t ordered_range_, InputIterator first, InputIterator last , const Compare& comp = Compare() , const allocator_type& a = allocator_type()) - : m_tree(ordered_range, first, last, comp, a) + : m_tree(ordered_range_, first, last, comp, a) {} //! Effects: Copy constructs a multiset. diff --git a/include/boost/container/stable_vector.hpp b/include/boost/container/stable_vector.hpp index 03f7d92..8d23672 100644 --- a/include/boost/container/stable_vector.hpp +++ b/include/boost/container/stable_vector.hpp @@ -1094,7 +1094,7 @@ class stable_vector if(n > this->max_size()) throw std::bad_alloc(); - size_type size = this->size(); + size_type size_ = this->size(); size_type old_capacity = this->capacity(); if(n > old_capacity){ index_traits_type::initialize_end_node(this->index, this->internal_data.end_node, n); @@ -1106,8 +1106,8 @@ class stable_vector index_traits_type::fix_up_pointers_from(this->index, this->index.begin()); } //Now fill pool if data is not enough - if((n - size) > this->internal_data.pool_size){ - this->priv_increase_pool((n - size) - this->internal_data.pool_size); + if((n - size_) > this->internal_data.pool_size){ + this->priv_increase_pool((n - size_) - this->internal_data.pool_size); } } } diff --git a/include/boost/container/string.hpp b/include/boost/container/string.hpp index 48f672a..7cbd447 100644 --- a/include/boost/container/string.hpp +++ b/include/boost/container/string.hpp @@ -1322,10 +1322,10 @@ class basic_string //! Returns: *this basic_string& insert(size_type pos, const basic_string& s) { - const size_type size = this->size(); - if (pos > size) + const size_type size_ = this->size(); + if (pos > size_) this->throw_out_of_range(); - if (size > this->max_size() - s.size()) + if (size_ > this->max_size() - s.size()) this->throw_length_error(); this->insert(this->priv_addr() + pos, s.begin(), s.end()); return *this; @@ -1341,12 +1341,12 @@ class basic_string //! Returns: *this basic_string& insert(size_type pos1, const basic_string& s, size_type pos2, size_type n) { - const size_type size = this->size(); + const size_type size_ = this->size(); const size_type str_size = s.size(); - if (pos1 > size || pos2 > str_size) + if (pos1 > size_ || pos2 > str_size) this->throw_out_of_range(); size_type len = container_detail::min_value(n, str_size - pos2); - if (size > this->max_size() - len) + if (size_ > this->max_size() - len) this->throw_length_error(); const CharT *beg_ptr = container_detail::to_raw_pointer(s.begin()) + pos2; const CharT *end_ptr = beg_ptr + len; @@ -1949,12 +1949,12 @@ class basic_string //! Returns: find(basic_string(1,c), pos). size_type find(CharT c, size_type pos = 0) const { - const size_type size = this->size(); - if (pos >= size) + const size_type size_ = this->size(); + if (pos >= size_) return npos; else { - const pointer addr = this->priv_addr(); - pointer finish = addr + size; + const pointer addr = this->priv_addr(); + pointer finish = addr + size_; const const_iterator result = std::find_if(addr + pos, finish, std::bind2nd(Eq_traits(), c)); @@ -2039,12 +2039,12 @@ class basic_string //! Returns: find_first_of(basic_string(s, n), pos). size_type find_first_of(const CharT* s, size_type pos, size_type n) const { - const size_type size = this->size(); - if (pos >= size) + const size_type size_ = this->size(); + if (pos >= size_) return npos; else { - const pointer addr = this->priv_addr(); - pointer finish = addr + size; + const pointer addr = this->priv_addr(); + pointer finish = addr + size_; const_iterator result = std::find_first_of (addr + pos, finish, s, s + n, Eq_traits()); return result != finish ? result - this->begin() : npos;