Mercurial > hg > CbC > CbC_gcc
changeset 157:dafe684d005c
...
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 25 May 2020 18:08:54 +0900 |
parents | a4a7bdaf5ae6 |
children | 494b0b89df80 |
files | libstdc++-v3/include/bits/hashtable.h |
diffstat | 1 files changed, 64 insertions(+), 64 deletions(-) [+] |
line wrap: on
line diff
--- a/libstdc++-v3/include/bits/hashtable.h Mon May 25 17:53:16 2020 +0900 +++ b/libstdc++-v3/include/bits/hashtable.h Mon May 25 18:08:54 2020 +0900 @@ -709,19 +709,19 @@ __node_base* _M_get_previous_node(size_type __bkt, __node_base* __n); - // Insert node __n with key __k and hash code __code, in bucket __bkt + // Insert node __n with key __k and hash code __code0, in bucket __bkt // if no rehash (assumes no element with same key already present). // Takes ownership of __n if insertion succeeds, throws otherwise. iterator _M_insert_unique_node(const key_type& __k, size_type __bkt, - __hash_code __code, __node_type* __n, + __hash_code __code0, __node_type* __n, size_type __n_elt = 1); - // Insert node __n with key __k and hash code __code. + // Insert node __n with key __k and hash code __code0. // Takes ownership of __n if insertion succeeds, throws otherwise. iterator _M_insert_multi_node(__node_type* __hint, const key_type& __k, - __hash_code __code, __node_type* __n); + __hash_code __code0, __node_type* __n); template<typename... _Args> std::pair<iterator, bool> @@ -836,9 +836,9 @@ __glibcxx_assert(get_allocator() == __nh.get_allocator()); const key_type& __k = __nh._M_key(); - __hash_code __code = this->_M_hash_code(__k); - size_type __bkt = _M_bucket_index(__k, __code); - if (__node_type* __n = _M_find_node(__bkt, __k, __code)) + __hash_code __code0 = this->_M_hash_code(__k); + size_type __bkt = _M_bucket_index(__k, __code0); + if (__node_type* __n = _M_find_node(__bkt, __k, __code0)) { __ret.node = std::move(__nh); __ret.position = iterator(__n); @@ -847,7 +847,7 @@ else { __ret.position - = _M_insert_unique_node(__k, __bkt, __code, __nh._M_ptr); + = _M_insert_unique_node(__k, __bkt, __code0, __nh._M_ptr); __nh._M_ptr = nullptr; __ret.inserted = true; } @@ -865,9 +865,9 @@ __glibcxx_assert(get_allocator() == __nh.get_allocator()); const key_type& __k = __nh._M_key(); - auto __code = this->_M_hash_code(__k); + auto __code0 = this->_M_hash_code(__k); auto __ret - = _M_insert_multi_node(__hint._M_cur, __k, __code, __nh._M_ptr); + = _M_insert_multi_node(__hint._M_cur, __k, __code0, __nh._M_ptr); __nh._M_ptr = nullptr; return __ret; } @@ -908,9 +908,9 @@ extract(const _Key& __k) { node_type __nh; - __hash_code __code = this->_M_hash_code(__k); - std::size_t __bkt = _M_bucket_index(__k, __code); - if (__node_base* __prev_node = _M_find_before_node(__bkt, __k, __code)) + __hash_code __code0 = this->_M_hash_code(__k); + std::size_t __bkt = _M_bucket_index(__k, __code0); + if (__node_base* __prev_node = _M_find_before_node(__bkt, __k, __code0)) __nh = _M_extract_node(__bkt, __prev_node); return __nh; } @@ -929,12 +929,12 @@ { auto __pos = __i++; const key_type& __k = this->_M_extract()(*__pos); - __hash_code __code = this->_M_hash_code(__k); - size_type __bkt = _M_bucket_index(__k, __code); - if (_M_find_node(__bkt, __k, __code) == nullptr) + __hash_code __code0 = this->_M_hash_code(__k); + size_type __bkt = _M_bucket_index(__k, __code0); + if (_M_find_node(__bkt, __k, __code0) == nullptr) { auto __nh = __src.extract(__pos); - _M_insert_unique_node(__k, __bkt, __code, __nh._M_ptr, + _M_insert_unique_node(__k, __bkt, __code0, __nh._M_ptr, __n_elt); __nh._M_ptr = nullptr; __n_elt = 1; @@ -1449,9 +1449,9 @@ find(const key_type& __k) -> iterator { - __hash_code __code = this->_M_hash_code(__k); - std::size_t __bkt = _M_bucket_index(__k, __code); - __node_type* __p = _M_find_node(__bkt, __k, __code); + __hash_code __code0 = this->_M_hash_code(__k); + std::size_t __bkt = _M_bucket_index(__k, __code0); + __node_type* __p = _M_find_node(__bkt, __k, __code0); return __p ? iterator(__p) : end(); } @@ -1465,9 +1465,9 @@ find(const key_type& __k) const -> const_iterator { - __hash_code __code = this->_M_hash_code(__k); - std::size_t __bkt = _M_bucket_index(__k, __code); - __node_type* __p = _M_find_node(__bkt, __k, __code); + __hash_code __code0 = this->_M_hash_code(__k); + std::size_t __bkt = _M_bucket_index(__k, __code0); + __node_type* __p = _M_find_node(__bkt, __k, __code0); return __p ? const_iterator(__p) : end(); } @@ -1481,8 +1481,8 @@ count(const key_type& __k) const -> size_type { - __hash_code __code = this->_M_hash_code(__k); - std::size_t __bkt = _M_bucket_index(__k, __code); + __hash_code __code0 = this->_M_hash_code(__k); + std::size_t __bkt = _M_bucket_index(__k, __code0); __node_type* __p = _M_bucket_begin(__bkt); if (!__p) return 0; @@ -1490,7 +1490,7 @@ std::size_t __result = 0; for (;; __p = __p->_M_next()) { - if (this->_M_equals(__k, __code, __p)) + if (this->_M_equals(__k, __code0, __p)) ++__result; else if (__result) // All equivalent values are next to each other, if we @@ -1513,15 +1513,15 @@ equal_range(const key_type& __k) -> pair<iterator, iterator> { - __hash_code __code = this->_M_hash_code(__k); - std::size_t __bkt = _M_bucket_index(__k, __code); - __node_type* __p = _M_find_node(__bkt, __k, __code); + __hash_code __code0 = this->_M_hash_code(__k); + std::size_t __bkt = _M_bucket_index(__k, __code0); + __node_type* __p = _M_find_node(__bkt, __k, __code0); if (__p) { __node_type* __p1 = __p->_M_next(); while (__p1 && _M_bucket_index(__p1) == __bkt - && this->_M_equals(__k, __code, __p1)) + && this->_M_equals(__k, __code0, __p1)) __p1 = __p1->_M_next(); return std::make_pair(iterator(__p), iterator(__p1)); @@ -1540,15 +1540,15 @@ equal_range(const key_type& __k) const -> pair<const_iterator, const_iterator> { - __hash_code __code = this->_M_hash_code(__k); - std::size_t __bkt = _M_bucket_index(__k, __code); - __node_type* __p = _M_find_node(__bkt, __k, __code); + __hash_code __code0 = this->_M_hash_code(__k); + std::size_t __bkt = _M_bucket_index(__k, __code0); + __node_type* __p = _M_find_node(__bkt, __k, __code0); if (__p) { __node_type* __p1 = __p->_M_next(); while (__p1 && _M_bucket_index(__p1) == __bkt - && this->_M_equals(__k, __code, __p1)) + && this->_M_equals(__k, __code0, __p1)) __p1 = __p1->_M_next(); return std::make_pair(const_iterator(__p), const_iterator(__p1)); @@ -1567,7 +1567,7 @@ _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>:: _M_find_before_node(size_type __bkt, const key_type& __k, - __hash_code __code) const + __hash_code __code0) const -> __node_base* { __node_base* __prev_p = _M_buckets[__bkt]; @@ -1577,7 +1577,7 @@ for (__node_type* __p = static_cast<__node_type*>(__prev_p->_M_nxt);; __p = __p->_M_next()) { - if (this->_M_equals(__k, __code, __p)) + if (this->_M_equals(__k, __code0, __p)) return __prev_p; if (!__p->_M_nxt || _M_bucket_index(__p->_M_next()) != __bkt) @@ -1672,14 +1672,14 @@ // First build the node to get access to the hash code _Scoped_node __node { this, std::forward<_Args>(__args)... }; const key_type& __k = this->_M_extract()(__node._M_node->_M_v()); - __hash_code __code = this->_M_hash_code(__k); - size_type __bkt = _M_bucket_index(__k, __code); - if (__node_type* __p = _M_find_node(__bkt, __k, __code)) + __hash_code __code0 = this->_M_hash_code(__k); + size_type __bkt = _M_bucket_index(__k, __code0); + if (__node_type* __p = _M_find_node(__bkt, __k, __code0)) // There is already an equivalent node, no insertion return std::make_pair(iterator(__p), false); // Insert the node - auto __pos = _M_insert_unique_node(__k, __bkt, __code, __node._M_node); + auto __pos = _M_insert_unique_node(__k, __bkt, __code0, __node._M_node); __node._M_node = nullptr; return { __pos, true }; } @@ -1699,9 +1699,9 @@ _Scoped_node __node { this, std::forward<_Args>(__args)... }; const key_type& __k = this->_M_extract()(__node._M_node->_M_v()); - __hash_code __code = this->_M_hash_code(__k); + __hash_code __code0 = this->_M_hash_code(__k); auto __pos - = _M_insert_multi_node(__hint._M_cur, __k, __code, __node._M_node); + = _M_insert_multi_node(__hint._M_cur, __k, __code0, __node._M_node); __node._M_node = nullptr; return __pos; } @@ -1714,7 +1714,7 @@ _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>:: _M_insert_unique_node(const key_type& __k, size_type __bkt, - __hash_code __code, __node_type* __node, + __hash_code __code0, __node_type* __node, size_type __n_elt) -> iterator { @@ -1726,10 +1726,10 @@ if (__do_rehash.first) { _M_rehash(__do_rehash.second, __saved_state); - __bkt = _M_bucket_index(__k, __code); + __bkt = _M_bucket_index(__k, __code0); } - this->_M_store_code(__node, __code); + this->_M_store_code(__node, __code0); // Always insert at the beginning of the bucket. _M_insert_bucket_begin(__bkt, __node); @@ -1745,7 +1745,7 @@ _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>:: _M_insert_multi_node(__node_type* __hint, const key_type& __k, - __hash_code __code, __node_type* __node) + __hash_code __code0, __node_type* __node) -> iterator { const __rehash_state& __saved_state = _M_rehash_policy._M_state(); @@ -1755,16 +1755,16 @@ if (__do_rehash.first) _M_rehash(__do_rehash.second, __saved_state); - this->_M_store_code(__node, __code); - size_type __bkt = _M_bucket_index(__k, __code); + this->_M_store_code(__node, __code0); + size_type __bkt = _M_bucket_index(__k, __code0); // Find the node before an equivalent one or use hint if it exists and // if it is equivalent. __node_base* __prev = __builtin_expect(__hint != nullptr, false) - && this->_M_equals(__k, __code, __hint) + && this->_M_equals(__k, __code0, __hint) ? __hint - : _M_find_before_node(__bkt, __k, __code); + : _M_find_before_node(__bkt, __k, __code0); if (__prev) { // Insert after the node before the equivalent one. @@ -1774,7 +1774,7 @@ // hint might be the last bucket node, in this case we need to // update next bucket. if (__node->_M_nxt - && !this->_M_equals(__k, __code, __node->_M_next())) + && !this->_M_equals(__k, __code0, __node->_M_next())) { size_type __next_bkt = _M_bucket_index(__node->_M_next()); if (__next_bkt != __bkt) @@ -1804,15 +1804,15 @@ -> pair<iterator, bool> { const key_type& __k = this->_M_extract()(__v); - __hash_code __code = this->_M_hash_code(__k); - size_type __bkt = _M_bucket_index(__k, __code); + __hash_code __code0 = this->_M_hash_code(__k); + size_type __bkt = _M_bucket_index(__k, __code0); - if (__node_type* __node = _M_find_node(__bkt, __k, __code)) + if (__node_type* __node = _M_find_node(__bkt, __k, __code0)) return { iterator(__node), false }; _Scoped_node __node{ __node_gen(std::forward<_Arg>(__v)), this }; auto __pos - = _M_insert_unique_node(__k, __bkt, __code, __node._M_node, __n_elt); + = _M_insert_unique_node(__k, __bkt, __code0, __node._M_node, __n_elt); __node._M_node = nullptr; return { __pos, true }; } @@ -1832,13 +1832,13 @@ { // First compute the hash code so that we don't do anything if it // throws. - __hash_code __code = this->_M_hash_code(this->_M_extract()(__v)); + __hash_code __code0 = this->_M_hash_code(this->_M_extract()(__v)); // Second allocate new node so that we don't rehash if it throws. _Scoped_node __node{ __node_gen(std::forward<_Arg>(__v)), this }; const key_type& __k = this->_M_extract()(__node._M_node->_M_v()); auto __pos - = _M_insert_multi_node(__hint._M_cur, __k, __code, __node._M_node); + = _M_insert_multi_node(__hint._M_cur, __k, __code0, __node._M_node); __node._M_node = nullptr; return __pos; } @@ -1901,11 +1901,11 @@ _M_erase(true_type, const key_type& __k) -> size_type { - __hash_code __code = this->_M_hash_code(__k); - std::size_t __bkt = _M_bucket_index(__k, __code); + __hash_code __code0 = this->_M_hash_code(__k); + std::size_t __bkt = _M_bucket_index(__k, __code0); // Look for the node before the first matching node. - __node_base* __prev_n = _M_find_before_node(__bkt, __k, __code); + __node_base* __prev_n = _M_find_before_node(__bkt, __k, __code0); if (!__prev_n) return 0; @@ -1925,11 +1925,11 @@ _M_erase(false_type, const key_type& __k) -> size_type { - __hash_code __code = this->_M_hash_code(__k); - std::size_t __bkt = _M_bucket_index(__k, __code); + __hash_code __code0 = this->_M_hash_code(__k); + std::size_t __bkt = _M_bucket_index(__k, __code0); // Look for the node before the first matching node. - __node_base* __prev_n = _M_find_before_node(__bkt, __k, __code); + __node_base* __prev_n = _M_find_before_node(__bkt, __k, __code0); if (!__prev_n) return 0; @@ -1949,7 +1949,7 @@ break; __n_last_bkt = _M_bucket_index(__n_last); } - while (__n_last_bkt == __bkt && this->_M_equals(__k, __code, __n_last)); + while (__n_last_bkt == __bkt && this->_M_equals(__k, __code0, __n_last)); // Deallocate nodes. size_type __result = 0;