refs #7531 (variable shadowing in container and intrusive)

[SVN r81050]
This commit is contained in:
Jeffrey Lee Hellrung, Jr.
2012-10-23 12:56:01 +00:00
parent b480cc235f
commit 546a3f0f12
8 changed files with 73 additions and 73 deletions

View File

@@ -48,7 +48,7 @@ class flat_tree_value_compare
typedef Value first_argument_type; typedef Value first_argument_type;
typedef Value second_argument_type; typedef Value second_argument_type;
typedef bool return_type; typedef bool return_type;
public: public:
flat_tree_value_compare() flat_tree_value_compare()
: Compare() : Compare()
{} {}
@@ -65,7 +65,7 @@ class flat_tree_value_compare
const Compare &get_comp() const const Compare &get_comp() const
{ return *this; } { return *this; }
Compare &get_comp() Compare &get_comp()
{ return *this; } { return *this; }
}; };
@@ -238,7 +238,7 @@ class flat_tree
flat_tree& operator=(BOOST_RV_REF(flat_tree) mx) flat_tree& operator=(BOOST_RV_REF(flat_tree) mx)
{ m_data = boost::move(mx.m_data); return *this; } { m_data = boost::move(mx.m_data); return *this; }
public: public:
// accessors: // accessors:
Compare key_comp() const Compare key_comp() const
{ return this->m_data.get_comp(); } { return this->m_data.get_comp(); }
@@ -446,11 +446,11 @@ class flat_tree
//Loop in burst sizes //Loop in burst sizes
while(len){ while(len){
const size_type burst = len < BurstSize ? len : BurstSize; const size_type burst = len < BurstSize ? len : BurstSize;
const const_iterator cend(this->cend()); const const_iterator cend_(this->cend());
len -= burst; len -= burst;
for(size_type i = 0; i != burst; ++i){ for(size_type i = 0; i != burst; ++i){
//Get the insertion position for each key //Get the insertion position for each key
pos = const_cast<const flat_tree&>(*this).priv_upper_bound(pos, cend, KeyOfValue()(*first)); pos = const_cast<const flat_tree&>(*this).priv_upper_bound(pos, cend_, KeyOfValue()(*first));
positions[i] = static_cast<size_type>(pos - beg); positions[i] = static_cast<size_type>(pos - beg);
++first; ++first;
} }
@@ -497,14 +497,14 @@ class flat_tree
while(len){ while(len){
const size_type burst = len < BurstSize ? len : BurstSize; const size_type burst = len < BurstSize ? len : BurstSize;
size_type unique_burst = 0u; size_type unique_burst = 0u;
const const_iterator cend(this->cend()); const const_iterator cend_(this->cend());
while(unique_burst < burst && len > 0){ while(unique_burst < burst && len > 0){
//Get the insertion position for each key //Get the insertion position for each key
const value_type & val = *first++; const value_type & val = *first++;
--len; --len;
pos = const_cast<const flat_tree&>(*this).priv_lower_bound(pos, cend, KeyOfValue()(val)); pos = const_cast<const flat_tree&>(*this).priv_lower_bound(pos, cend_, KeyOfValue()(val));
//Check if already present //Check if already present
if(pos != cend && !value_comp(val, *pos)){ if(pos != cend_ && !value_comp(val, *pos)){
if(unique_burst > 0){ if(unique_burst > 0){
++skips[unique_burst-1]; ++skips[unique_burst-1];
} }
@@ -692,22 +692,22 @@ class flat_tree
// set operations: // set operations:
iterator find(const key_type& k) 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); iterator i = this->lower_bound(k);
if (i != this->end() && key_comp(k, KeyOfValue()(*i))){ if (i != this->end() && key_comp_(k, KeyOfValue()(*i))){
i = this->end(); i = this->end();
} }
return i; return i;
} }
const_iterator find(const key_type& k) const 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); const_iterator i = this->lower_bound(k);
if (i != this->end() && key_comp(k, KeyOfValue()(*i))){ if (i != this->end() && key_comp_(k, KeyOfValue()(*i))){
i = this->end(); i = this->end();
} }
return i; return i;
} }
@@ -737,11 +737,11 @@ class flat_tree
std::pair<const_iterator, const_iterator> equal_range(const key_type& k) const std::pair<const_iterator, const_iterator> equal_range(const key_type& k) const
{ return this->priv_equal_range(this->begin(), this->end(), k); } { 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(); } { return this->m_data.m_vect.capacity(); }
void reserve(size_type count) void reserve(size_type count_)
{ this->m_data.m_vect.reserve(count); } { this->m_data.m_vect.reserve(count_); }
private: private:
struct insert_commit_data struct insert_commit_data
@@ -780,13 +780,13 @@ class flat_tree
} }
std::pair<iterator,bool> priv_insert_unique_prepare std::pair<iterator,bool> 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; 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<iterator,bool> return std::pair<iterator,bool>
( *reinterpret_cast<iterator*>(&commit_data.position) ( *reinterpret_cast<iterator*>(&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<iterator,bool> priv_insert_unique_prepare std::pair<iterator,bool> priv_insert_unique_prepare
@@ -854,7 +854,7 @@ class flat_tree
RanIt priv_lower_bound(RanIt first, RanIt last, RanIt priv_lower_bound(RanIt first, RanIt last,
const key_type & key) const 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; KeyOfValue key_extract;
difference_type len = last - first, half; difference_type len = last - first, half;
RanIt middle; RanIt middle;
@@ -864,7 +864,7 @@ class flat_tree
middle = first; middle = first;
middle += half; middle += half;
if (key_comp(key_extract(*middle), key)) { if (key_comp_(key_extract(*middle), key)) {
++middle; ++middle;
first = middle; first = middle;
len = len - half - 1; len = len - half - 1;
@@ -879,7 +879,7 @@ class flat_tree
RanIt priv_upper_bound(RanIt first, RanIt last, RanIt priv_upper_bound(RanIt first, RanIt last,
const key_type & key) const 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; KeyOfValue key_extract;
difference_type len = last - first, half; difference_type len = last - first, half;
RanIt middle; RanIt middle;
@@ -889,12 +889,12 @@ class flat_tree
middle = first; middle = first;
middle += half; middle += half;
if (key_comp(key, key_extract(*middle))) { if (key_comp_(key, key_extract(*middle))) {
len = half; len = half;
} }
else{ else{
first = ++middle; first = ++middle;
len = len - half - 1; len = len - half - 1;
} }
} }
return first; return first;
@@ -904,7 +904,7 @@ class flat_tree
std::pair<RanIt, RanIt> std::pair<RanIt, RanIt>
priv_equal_range(RanIt first, RanIt last, const key_type& key) const 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; KeyOfValue key_extract;
difference_type len = last - first, half; difference_type len = last - first, half;
RanIt middle, left, right; RanIt middle, left, right;
@@ -914,12 +914,12 @@ class flat_tree
middle = first; middle = first;
middle += half; middle += half;
if (key_comp(key_extract(*middle), key)){ if (key_comp_(key_extract(*middle), key)){
first = middle; first = middle;
++first; ++first;
len = len - half - 1; len = len - half - 1;
} }
else if (key_comp(key, key_extract(*middle))){ else if (key_comp_(key, key_extract(*middle))){
len = half; len = half;
} }
else { else {

View File

@@ -126,22 +126,22 @@ class basic_multiallocation_chain
return ret; return ret;
} }
void splice_after(iterator after_this, basic_multiallocation_chain &x, iterator before_begin, iterator 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); } { 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) 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); } { slist_impl_.splice_after(after_this, x.slist_impl_, before_begin_, before_end, n); }
void splice_after(iterator after_this, basic_multiallocation_chain &x) void splice_after(iterator after_this, basic_multiallocation_chain &x)
{ slist_impl_.splice_after(after_this, x.slist_impl_); } { 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) 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); } { slist_impl_.incorporate_after(after_this, to_node_ptr(begin_), to_node_ptr(before_end), n); }
void swap(basic_multiallocation_chain &x) void swap(basic_multiallocation_chain &x)
{ slist_impl_.swap(x.slist_impl_); } { slist_impl_.swap(x.slist_impl_); }
@@ -217,11 +217,11 @@ class transform_multiallocation_chain
void swap(transform_multiallocation_chain &other_chain) void swap(transform_multiallocation_chain &other_chain)
{ holder_.swap(other_chain.holder_); } { holder_.swap(other_chain.holder_); }
void splice_after(iterator after_this, transform_multiallocation_chain &x, iterator before_begin, iterator before_end, size_type 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); } { 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) void incorporate_after(iterator after_this, pointer begin_, pointer before_end, size_type n)
{ holder_.incorporate_after(after_this.base(), begin, before_end, n); } { holder_.incorporate_after(after_this.base(), begin_, before_end, n); }
pointer pop_front() pointer pop_front()
{ return cast(holder_.pop_front()); } { return cast(holder_.pop_front()); }

View File

@@ -418,7 +418,7 @@ class flat_map
//! <b>Throws</b>: Nothing. //! <b>Throws</b>: Nothing.
//! //!
//! <b>Complexity</b>: Constant. //! <b>Complexity</b>: Constant.
size_type capacity() const size_type capacity() const
{ return m_flat_tree.capacity(); } { return m_flat_tree.capacity(); }
//! <b>Effects</b>: If n is less than or equal to capacity(), this call has no //! <b>Effects</b>: If n is less than or equal to capacity(), this call has no
@@ -430,8 +430,8 @@ class flat_map
//! //!
//! <b>Note</b>: If capacity() is less than "count", iterators and references to //! <b>Note</b>: If capacity() is less than "count", iterators and references to
//! to values might be invalidated. //! to values might be invalidated.
void reserve(size_type count) void reserve(size_type count_)
{ m_flat_tree.reserve(count); } { m_flat_tree.reserve(count_); }
//! <b>Effects</b>: Tries to deallocate the excess of memory created //! <b>Effects</b>: Tries to deallocate the excess of memory created
// with previous allocations. The size of the vector is unchanged // with previous allocations. The size of the vector is unchanged
@@ -1266,7 +1266,7 @@ class flat_multimap
//! <b>Throws</b>: Nothing. //! <b>Throws</b>: Nothing.
//! //!
//! <b>Complexity</b>: Constant. //! <b>Complexity</b>: Constant.
size_type capacity() const size_type capacity() const
{ return m_flat_tree.capacity(); } { return m_flat_tree.capacity(); }
//! <b>Effects</b>: If n is less than or equal to capacity(), this call has no //! <b>Effects</b>: If n is less than or equal to capacity(), this call has no
@@ -1278,8 +1278,8 @@ class flat_multimap
//! //!
//! <b>Note</b>: If capacity() is less than "count", iterators and references to //! <b>Note</b>: If capacity() is less than "count", iterators and references to
//! to values might be invalidated. //! to values might be invalidated.
void reserve(size_type count) void reserve(size_type count_)
{ m_flat_tree.reserve(count); } { m_flat_tree.reserve(count_); }
//! <b>Effects</b>: Tries to deallocate the excess of memory created //! <b>Effects</b>: Tries to deallocate the excess of memory created
// with previous allocations. The size of the vector is unchanged // with previous allocations. The size of the vector is unchanged

View File

@@ -365,7 +365,7 @@ class flat_set
//! <b>Throws</b>: Nothing. //! <b>Throws</b>: Nothing.
//! //!
//! <b>Complexity</b>: Constant. //! <b>Complexity</b>: Constant.
size_type capacity() const size_type capacity() const
{ return m_flat_tree.capacity(); } { return m_flat_tree.capacity(); }
//! <b>Effects</b>: If n is less than or equal to capacity(), this call has no //! <b>Effects</b>: If n is less than or equal to capacity(), this call has no
@@ -377,8 +377,8 @@ class flat_set
//! //!
//! <b>Note</b>: If capacity() is less than "count", iterators and references to //! <b>Note</b>: If capacity() is less than "count", iterators and references to
//! to values might be invalidated. //! to values might be invalidated.
void reserve(size_type count) void reserve(size_type count_)
{ m_flat_tree.reserve(count); } { m_flat_tree.reserve(count_); }
//! <b>Effects</b>: Tries to deallocate the excess of memory created //! <b>Effects</b>: Tries to deallocate the excess of memory created
// with previous allocations. The size of the vector is unchanged // with previous allocations. The size of the vector is unchanged
@@ -1045,7 +1045,7 @@ class flat_multiset
//! <b>Throws</b>: Nothing. //! <b>Throws</b>: Nothing.
//! //!
//! <b>Complexity</b>: Constant. //! <b>Complexity</b>: Constant.
size_type capacity() const size_type capacity() const
{ return m_flat_tree.capacity(); } { return m_flat_tree.capacity(); }
//! <b>Effects</b>: If n is less than or equal to capacity(), this call has no //! <b>Effects</b>: If n is less than or equal to capacity(), this call has no
@@ -1057,8 +1057,8 @@ class flat_multiset
//! //!
//! <b>Note</b>: If capacity() is less than "count", iterators and references to //! <b>Note</b>: If capacity() is less than "count", iterators and references to
//! to values might be invalidated. //! to values might be invalidated.
void reserve(size_type count) void reserve(size_type count_)
{ m_flat_tree.reserve(count); } { m_flat_tree.reserve(count_); }
//! <b>Effects</b>: Tries to deallocate the excess of memory created //! <b>Effects</b>: Tries to deallocate the excess of memory created
// with previous allocations. The size of the vector is unchanged // with previous allocations. The size of the vector is unchanged

View File

@@ -951,9 +951,9 @@ class multimap
//! //!
//! <b>Complexity</b>: Linear in N. //! <b>Complexity</b>: Linear in N.
template <class InputIterator> template <class InputIterator>
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()) const allocator_type& a = allocator_type())
: m_tree(ordered_range, first, last, comp, a) : m_tree(ordered_range_, first, last, comp, a)
{} {}
//! <b>Effects</b>: Copy constructs a multimap. //! <b>Effects</b>: Copy constructs a multimap.

View File

@@ -757,10 +757,10 @@ class multiset
//! //!
//! <b>Complexity</b>: Linear in N. //! <b>Complexity</b>: Linear in N.
template <class InputIterator> template <class InputIterator>
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 Compare& comp = Compare()
, const allocator_type& a = allocator_type()) , const allocator_type& a = allocator_type())
: m_tree(ordered_range, first, last, comp, a) : m_tree(ordered_range_, first, last, comp, a)
{} {}
//! <b>Effects</b>: Copy constructs a multiset. //! <b>Effects</b>: Copy constructs a multiset.

View File

@@ -1094,7 +1094,7 @@ class stable_vector
if(n > this->max_size()) if(n > this->max_size())
throw std::bad_alloc(); throw std::bad_alloc();
size_type size = this->size(); size_type size_ = this->size();
size_type old_capacity = this->capacity(); size_type old_capacity = this->capacity();
if(n > old_capacity){ if(n > old_capacity){
index_traits_type::initialize_end_node(this->index, this->internal_data.end_node, n); 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()); index_traits_type::fix_up_pointers_from(this->index, this->index.begin());
} }
//Now fill pool if data is not enough //Now fill pool if data is not enough
if((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); this->priv_increase_pool((n - size_) - this->internal_data.pool_size);
} }
} }
} }

View File

@@ -1322,10 +1322,10 @@ class basic_string
//! <b>Returns</b>: *this //! <b>Returns</b>: *this
basic_string& insert(size_type pos, const basic_string& s) basic_string& insert(size_type pos, const basic_string& s)
{ {
const size_type size = this->size(); const size_type size_ = this->size();
if (pos > size) if (pos > size_)
this->throw_out_of_range(); this->throw_out_of_range();
if (size > this->max_size() - s.size()) if (size_ > this->max_size() - s.size())
this->throw_length_error(); this->throw_length_error();
this->insert(this->priv_addr() + pos, s.begin(), s.end()); this->insert(this->priv_addr() + pos, s.begin(), s.end());
return *this; return *this;
@@ -1341,12 +1341,12 @@ class basic_string
//! <b>Returns</b>: *this //! <b>Returns</b>: *this
basic_string& insert(size_type pos1, const basic_string& s, size_type pos2, size_type n) 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(); const size_type str_size = s.size();
if (pos1 > size || pos2 > str_size) if (pos1 > size_ || pos2 > str_size)
this->throw_out_of_range(); this->throw_out_of_range();
size_type len = container_detail::min_value(n, str_size - pos2); 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(); this->throw_length_error();
const CharT *beg_ptr = container_detail::to_raw_pointer(s.begin()) + pos2; const CharT *beg_ptr = container_detail::to_raw_pointer(s.begin()) + pos2;
const CharT *end_ptr = beg_ptr + len; const CharT *end_ptr = beg_ptr + len;
@@ -1949,12 +1949,12 @@ class basic_string
//! <b>Returns</b>: find(basic_string<CharT,traits,Allocator>(1,c), pos). //! <b>Returns</b>: find(basic_string<CharT,traits,Allocator>(1,c), pos).
size_type find(CharT c, size_type pos = 0) const size_type find(CharT c, size_type pos = 0) const
{ {
const size_type size = this->size(); const size_type size_ = this->size();
if (pos >= size) if (pos >= size_)
return npos; return npos;
else { else {
const pointer addr = this->priv_addr(); const pointer addr = this->priv_addr();
pointer finish = addr + size; pointer finish = addr + size_;
const const_iterator result = const const_iterator result =
std::find_if(addr + pos, finish, std::find_if(addr + pos, finish,
std::bind2nd(Eq_traits<Traits>(), c)); std::bind2nd(Eq_traits<Traits>(), c));
@@ -2039,12 +2039,12 @@ class basic_string
//! <b>Returns</b>: find_first_of(basic_string(s, n), pos). //! <b>Returns</b>: find_first_of(basic_string(s, n), pos).
size_type find_first_of(const CharT* s, size_type pos, size_type n) const size_type find_first_of(const CharT* s, size_type pos, size_type n) const
{ {
const size_type size = this->size(); const size_type size_ = this->size();
if (pos >= size) if (pos >= size_)
return npos; return npos;
else { else {
const pointer addr = this->priv_addr(); const pointer addr = this->priv_addr();
pointer finish = addr + size; pointer finish = addr + size_;
const_iterator result = std::find_first_of const_iterator result = std::find_first_of
(addr + pos, finish, s, s + n, Eq_traits<Traits>()); (addr + pos, finish, s, s + n, Eq_traits<Traits>());
return result != finish ? result - this->begin() : npos; return result != finish ? result - this->begin() : npos;