diff --git a/include/boost/intrusive/hashtable.hpp b/include/boost/intrusive/hashtable.hpp index 2435a08..09d5c9e 100644 --- a/include/boost/intrusive/hashtable.hpp +++ b/include/boost/intrusive/hashtable.hpp @@ -135,7 +135,7 @@ template struct real_from_supposed_value_traits { typedef typename detail::eval_if_c - < detail::external_value_traits_is_true + < detail::external_value_traits_bool_is_true ::value , detail::eval_value_traits @@ -384,7 +384,7 @@ struct group_functions slist_node_ptr possible_end = node_traits::get_next(last_node_group); while(!(bucket_beg <= possible_end && possible_end <= bucket_end)){ - first_node_of_group = dcast_bucket_ptr(possible_end); + first_node_of_group = group_functions::dcast_bucket_ptr(possible_end); last_node_group = group_traits::get_next(first_node_of_group); possible_end = node_traits::get_next(last_node_group); } @@ -395,7 +395,7 @@ struct group_functions { //Just iterate using group links and obtain the node //before "first_in_group)" - node_ptr prev_node = dcast_bucket_ptr(bucket_node); + node_ptr prev_node = group_functions::dcast_bucket_ptr(bucket_node); node_ptr nxt(node_traits::get_next(prev_node)); while(nxt != first_in_group){ prev_node = group_traits::get_next(nxt); @@ -480,7 +480,7 @@ struct group_functions , const slist_node_ptr &first_end_ptr, const slist_node_ptr &last_end_ptr) { slist_node_ptr prev; - node_ptr elem(dcast_bucket_ptr(i)); + node_ptr elem(group_functions::dcast_bucket_ptr(i)); //It's the last in group if the next_node is a bucket slist_node_ptr nxt(node_traits::get_next(elem)); @@ -687,7 +687,7 @@ class hashtable_impl /// @cond static const bool external_value_traits = - detail::external_value_traits_is_true::value; + detail::external_value_traits_bool_is_true::value; typedef typename detail::eval_if_c < external_value_traits , detail::eval_value_traits @@ -695,7 +695,7 @@ class hashtable_impl >::type real_value_traits; typedef typename Config::bucket_traits bucket_traits; static const bool external_bucket_traits = - detail::external_bucket_traits_is_true::value; + detail::external_bucket_traits_bool_is_true::value; typedef typename detail::eval_if_c < external_bucket_traits , detail::eval_bucket_traits @@ -894,14 +894,14 @@ class hashtable_impl , const value_traits &v_traits = value_traits()) : data_(b_traits, hash_func, equal_func, v_traits) { - priv_initialize_buckets(); + this->priv_initialize_buckets(); this->priv_size_traits().set_size(size_type(0)); - size_type bucket_size = this->priv_buckets_len(); + size_type bucket_size = this->priv_bucket_count(); BOOST_INTRUSIVE_INVARIANT_ASSERT(bucket_size != 0); //Check power of two bucket array if the option is activated BOOST_INTRUSIVE_INVARIANT_ASSERT (!power_2_buckets || (0 == (bucket_size & (bucket_size-1)))); - priv_split_traits().set_size(bucket_size>>1); + this->priv_split_traits().set_size(bucket_size>>1); } //! Effects: to-do @@ -913,7 +913,7 @@ class hashtable_impl , ::boost::move(x.priv_value_traits()) ) { - priv_swap_cache(cache_begin_t(), x); + this->priv_swap_cache(cache_begin_t(), x); x.priv_initialize_cache(); if(constant_time_size){ this->priv_size_traits().set_size(size_type(0)); @@ -976,7 +976,7 @@ class hashtable_impl //! //! Throws: Nothing. iterator end() - { return iterator(priv_invalid_local_it(), 0); } + { return iterator(this->priv_invalid_local_it(), 0); } //! Effects: Returns a const_iterator pointing to the end of the unordered_set. //! @@ -992,7 +992,7 @@ class hashtable_impl //! //! Throws: Nothing. const_iterator cend() const - { return const_iterator(priv_invalid_local_it(), 0); } + { return const_iterator(this->priv_invalid_local_it(), 0); } //! Effects: Returns the hasher object used by the unordered_set. //! @@ -1026,9 +1026,9 @@ class hashtable_impl return this->begin() == this->end(); } else{ - size_type buckets_len = this->priv_buckets_len(); - const bucket_type *b = boost::intrusive::detail::to_raw_pointer(this->priv_buckets()); - for (size_type n = 0; n < buckets_len; ++n, ++b){ + size_type bucket_count = this->priv_bucket_count(); + const bucket_type *b = boost::intrusive::detail::to_raw_pointer(this->priv_bucket_pointer()); + for (size_type n = 0; n < bucket_count; ++n, ++b){ if(!b->empty()){ return false; } @@ -1049,9 +1049,9 @@ class hashtable_impl return this->priv_size_traits().get_size(); else{ size_type len = 0; - size_type buckets_len = this->priv_buckets_len(); - const bucket_type *b = boost::intrusive::detail::to_raw_pointer(this->priv_buckets()); - for (size_type n = 0; n < buckets_len; ++n, ++b){ + size_type bucket_count = this->priv_bucket_count(); + const bucket_type *b = boost::intrusive::detail::to_raw_pointer(this->priv_bucket_pointer()); + for (size_type n = 0; n < bucket_count; ++n, ++b){ len += b->size(); } return len; @@ -1077,7 +1077,7 @@ class hashtable_impl //These can't throw swap(this->priv_bucket_traits(), other.priv_bucket_traits()); swap(this->priv_value_traits(), other.priv_value_traits()); - priv_swap_cache(cache_begin_t(), other); + this->priv_swap_cache(cache_begin_t(), other); if(constant_time_size){ size_type backup = this->priv_size_traits().get_size(); this->priv_size_traits().set_size(other.priv_size_traits().get_size()); @@ -1125,8 +1125,8 @@ class hashtable_impl //If src bucket count is bigger or equal, structural copy is possible if(!incremental && (src_bucket_count >= dst_bucket_count)){ //First clone the first ones - const bucket_ptr src_buckets = src.priv_buckets(); - const bucket_ptr dst_buckets = this->priv_buckets(); + const bucket_ptr src_buckets = src.priv_bucket_pointer(); + const bucket_ptr dst_buckets = this->priv_bucket_pointer(); size_type constructed; typedef node_cast_adaptor > NodeDisposer; typedef node_cast_adaptor > NodeCloner; @@ -1147,7 +1147,7 @@ class hashtable_impl ; constructed < src_bucket_count ; ++constructed){ bucket_type &dst_b = - dst_buckets[priv_hash_to_bucket(constructed, dst_bucket_count, dst_bucket_count)]; + dst_buckets[this->priv_hash_to_bucket(constructed, dst_bucket_count, dst_bucket_count)]; bucket_type &src_b = src_buckets[constructed]; for( siterator b(src_b.begin()), e(src_b.end()) ; b != e @@ -1161,8 +1161,8 @@ class hashtable_impl rollback.release(); this->priv_size_traits().set_size(src.priv_size_traits().get_size()); this->priv_split_traits().set_size(dst_bucket_count); - priv_insertion_update_cache(0u); - priv_erasure_update_cache(); + this->priv_insertion_update_cache(0u); + this->priv_erasure_update_cache(); } else if(store_hash){ //Unlike previous cloning algorithm, this can throw @@ -1209,7 +1209,7 @@ class hashtable_impl siterator prev; siterator it = this->priv_find (value, this->priv_hasher(), this->priv_equal(), bucket_num, hash_value, prev); - return priv_insert_equal_find(value, bucket_num, hash_value, it); + return this->priv_insert_equal_find(value, bucket_num, hash_value, it); } //! Requires: Dereferencing iterator must yield an lvalue @@ -1323,7 +1323,7 @@ class hashtable_impl siterator prev; siterator prev_pos = this->priv_find(key, hash_func, equal_func, bucket_num, commit_data.hash, prev); - bool success = prev_pos == priv_invalid_local_it(); + bool success = prev_pos == this->priv_invalid_local_it(); if(success){ prev_pos = prev; } @@ -1351,14 +1351,14 @@ class hashtable_impl //! After a successful rehashing insert_commit_data remains valid. iterator insert_unique_commit(reference value, const insert_commit_data &commit_data) { - size_type bucket_num = priv_hash_to_bucket(commit_data.hash); - bucket_type &b = this->priv_buckets()[bucket_num]; + size_type bucket_num = this->priv_hash_to_bucket(commit_data.hash); + bucket_type &b = this->priv_bucket_pointer()[bucket_num]; this->priv_size_traits().increment(); - node_ptr n = pointer_traits::pointer_to(priv_value_to_node(value)); + node_ptr n = pointer_traits::pointer_to(this->priv_value_to_node(value)); node_functions_t::store_hash(n, commit_data.hash, store_hash_t()); if(safemode_or_autounlink) BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(n)); - priv_insertion_update_cache(bucket_num); + this->priv_insertion_update_cache(bucket_num); group_functions_t::insert_in_group(node_ptr(), n, optimize_multikey_t()); return iterator(b.insert_after(b.before_begin(), *n), this); } @@ -1443,9 +1443,9 @@ class hashtable_impl /// @endcond ) { - priv_erase(i, disposer, optimize_multikey_t()); + this->priv_erase(i, disposer, optimize_multikey_t()); this->priv_size_traits().decrement(); - priv_erasure_update_cache(); + this->priv_erasure_update_cache(); } //! Requires: Disposer::operator()(pointer) shouldn't throw. @@ -1468,8 +1468,9 @@ class hashtable_impl siterator first_local_it(b.slist_it()); size_type first_bucket_num = this->priv_get_bucket_num(first_local_it); + const bucket_ptr bucket_pointer = this->priv_bucket_pointer(); siterator before_first_local_it - = priv_get_previous(priv_buckets()[first_bucket_num], first_local_it); + = this->priv_get_previous(bucket_pointer[first_bucket_num], first_local_it); size_type last_bucket_num; siterator last_local_it; @@ -1477,14 +1478,14 @@ class hashtable_impl //of the last bucket if(e == this->end()){ last_bucket_num = this->bucket_count() - 1; - last_local_it = priv_buckets()[last_bucket_num].end(); + last_local_it = bucket_pointer[last_bucket_num].end(); } else{ last_local_it = e.slist_it(); last_bucket_num = this->priv_get_bucket_num(last_local_it); } - priv_erase_range(before_first_local_it, first_bucket_num, last_local_it, last_bucket_num, disposer); - priv_erasure_update_cache(first_bucket_num, last_bucket_num); + this->priv_erase_range(before_first_local_it, first_bucket_num, last_local_it, last_bucket_num, disposer); + this->priv_erasure_update_cache(first_bucket_num, last_bucket_num); } } @@ -1505,7 +1506,7 @@ class hashtable_impl //! to the erased elements. No destructors are called. template size_type erase_and_dispose(const_reference value, Disposer disposer) - { return this->erase_and_dispose(value, priv_hasher(), priv_equal(), disposer); } + { return this->erase_and_dispose(value, this->priv_hasher(), this->priv_equal(), disposer); } //! Requires: Disposer::operator()(pointer) shouldn't throw. //! @@ -1531,7 +1532,7 @@ class hashtable_impl siterator prev; siterator it = this->priv_find(key, hash_func, equal_func, bucket_num, h, prev); - bool success = it != priv_invalid_local_it(); + bool success = it != this->priv_invalid_local_it(); size_type count(0); if(!success){ return 0; @@ -1539,15 +1540,15 @@ class hashtable_impl else if(optimize_multikey){ siterator last = bucket_type::s_iterator_to (*node_traits::get_next(group_functions_t::get_last_in_group - (dcast_bucket_ptr(it.pointed_node()), optimize_multikey_t()))); + (hashtable_impl::dcast_bucket_ptr(it.pointed_node()), optimize_multikey_t()))); this->priv_erase_range_impl(bucket_num, prev, last, disposer, count); } else{ //If found erase all equal values - bucket_type &b = this->priv_buckets()[bucket_num]; + bucket_type &b = this->priv_bucket_pointer()[bucket_num]; for(siterator end = b.end(); it != end; ++count, ++it){ slist_node_ptr n(it.pointed_node()); - const value_type &v = priv_value_from_slist_node(n); + const value_type &v = this->priv_value_from_slist_node(n); if(compare_hash){ std::size_t vh = this->priv_stored_or_compute_hash(v, store_hash_t()); if(h != vh || !equal_func(key, v)){ @@ -1561,7 +1562,7 @@ class hashtable_impl } b.erase_after_and_dispose(prev, it, make_node_disposer(disposer)); } - priv_erasure_update_cache(); + this->priv_erasure_update_cache(); return count; } @@ -1576,7 +1577,7 @@ class hashtable_impl //! to the erased elements. No destructors are called. void clear() { - priv_clear_buckets(); + this->priv_clear_buckets(); this->priv_size_traits().set_size(size_type(0)); } @@ -1596,13 +1597,13 @@ class hashtable_impl { if(!constant_time_size || !this->empty()){ size_type num_buckets = this->bucket_count(); - bucket_ptr b = this->priv_buckets(); + bucket_ptr b = this->priv_bucket_pointer(); for(; num_buckets--; ++b){ b->clear_and_dispose(make_node_disposer(disposer)); } this->priv_size_traits().set_size(size_type(0)); } - priv_initialize_cache(); + this->priv_initialize_cache(); } //! Effects: Returns the number of contained elements with the given value @@ -1805,7 +1806,7 @@ class hashtable_impl //! Throws: If the internal hash function throws. iterator iterator_to(reference value) { - return iterator(bucket_type::s_iterator_to(priv_value_to_node(value)), this); + return iterator(bucket_type::s_iterator_to(this->priv_value_to_node(value)), this); } //! Requires: value must be an lvalue and shall be in a unordered_set of @@ -1899,7 +1900,7 @@ class hashtable_impl //! //! Throws: Nothing. size_type bucket_count() const - { return this->priv_buckets_len(); } + { return this->priv_bucket_count(); } //! Requires: n is in the range [0, this->bucket_count()). //! @@ -1909,7 +1910,7 @@ class hashtable_impl //! //! Throws: Nothing. size_type bucket_size(size_type n) const - { return this->priv_buckets()[n].size(); } + { return this->priv_bucket_pointer()[n].size(); } //! Effects: Returns the index of the bucket in which elements //! with keys equivalent to k would be found, if any such element existed. @@ -1936,7 +1937,7 @@ class hashtable_impl //! Note: the return value is in the range [0, this->bucket_count()). template size_type bucket(const KeyType& k, const KeyHasher &hash_func) const - { return priv_hash_to_bucket(hash_func(k)); } + { return this->priv_hash_to_bucket(hash_func(k)); } //! Effects: Returns the bucket array pointer passed in the constructor //! or the last rehash function. @@ -1945,7 +1946,7 @@ class hashtable_impl //! //! Throws: Nothing. bucket_ptr bucket_pointer() const - { return this->priv_buckets(); } + { return this->priv_bucket_pointer(); } //! Requires: n is in the range [0, this->bucket_count()). //! @@ -1959,7 +1960,7 @@ class hashtable_impl //! Note: [this->begin(n), this->end(n)) is a valid range //! containing all of the elements in the nth bucket. local_iterator begin(size_type n) - { return local_iterator(this->priv_buckets()[n].begin(), this); } + { return local_iterator(this->priv_bucket_pointer()[n].begin(), this); } //! Requires: n is in the range [0, this->bucket_count()). //! @@ -1988,7 +1989,7 @@ class hashtable_impl //! containing all of the elements in the nth bucket. const_local_iterator cbegin(size_type n) const { - siterator sit = const_cast(this->priv_buckets()[n]).begin(); + siterator sit = const_cast(this->priv_bucket_pointer()[n]).begin(); return const_local_iterator(sit, this); } @@ -2004,7 +2005,7 @@ class hashtable_impl //! Note: [this->begin(n), this->end(n)) is a valid range //! containing all of the elements in the nth bucket. local_iterator end(size_type n) - { return local_iterator(this->priv_buckets()[n].end(), this); } + { return local_iterator(this->priv_bucket_pointer()[n].end(), this); } //! Requires: n is in the range [0, this->bucket_count()). //! @@ -2032,19 +2033,19 @@ class hashtable_impl //! Note: [this->begin(n), this->end(n)) is a valid range //! containing all of the elements in the nth bucket. const_local_iterator cend(size_type n) const - { return const_local_iterator(const_cast(this->priv_buckets()[n]).end(), this); } + { return const_local_iterator(const_cast(this->priv_bucket_pointer()[n]).end(), this); } - //! Requires: new_buckets must be a pointer to a new bucket array - //! or the same as the old bucket array. new_size is the length of the - //! the array pointed by new_buckets. If new_buckets == this->bucket_pointer() - //! n can be bigger or smaller than this->bucket_count(). + //! Requires: new_bucket_traits can hold a pointer to a new bucket array + //! or the same as the old bucket array with a different length. new_size is the length of the + //! the array pointed by new_buckets. If new_bucket_traits.bucket_begin() == this->bucket_pointer() + //! new_bucket_traits.bucket_count() can be bigger or smaller than this->bucket_count(). //! 'new_bucket_traits' copy constructor should not throw. //! - //! Effects: Updates the internal reference with the new bucket erases + //! Effects: Updates the internal reference with the new bucket, erases //! the values from the old bucket and inserts then in the new one. //! Bucket traits hold by *this is assigned from new_bucket_traits. //! If the container is configured as incremental<>, the split bucket is set - //! to the new bucket_len(). + //! to the new bucket_count(). //! //! If store_hash option is true, this method does not use the hash function. //! @@ -2053,27 +2054,27 @@ class hashtable_impl //! Throws: If the hasher functor throws. Basic guarantee. void rehash(const bucket_traits &new_bucket_traits) { - bucket_ptr new_buckets = new_bucket_traits.bucket_begin(); - size_type new_buckets_len = new_bucket_traits.bucket_count(); - bucket_ptr old_buckets = this->priv_buckets(); - size_type old_buckets_len = this->priv_buckets_len(); + const bucket_ptr new_buckets = new_bucket_traits.bucket_begin(); + size_type new_bucket_count = new_bucket_traits.bucket_count(); + const bucket_ptr old_buckets = this->priv_bucket_pointer(); + size_type old_bucket_count = this->priv_bucket_count(); //Check power of two bucket array if the option is activated BOOST_INTRUSIVE_INVARIANT_ASSERT - (!power_2_buckets || (0 == (new_buckets_len & (new_buckets_len-1u)))); + (!power_2_buckets || (0 == (new_bucket_count & (new_bucket_count-1u)))); - size_type n = priv_get_cache_bucket_num(); + size_type n = this->priv_get_cache_bucket_num(); const bool same_buffer = old_buckets == new_buckets; //If the new bucket length is a common factor //of the old one we can avoid hash calculations. - const bool fast_shrink = (!incremental) && (old_buckets_len > new_buckets_len) && - (power_2_buckets ||(old_buckets_len % new_buckets_len) == 0); + const bool fast_shrink = (!incremental) && (old_bucket_count > new_bucket_count) && + (power_2_buckets ||(old_bucket_count % new_bucket_count) == 0); //If we are shrinking the same bucket array and it's //is a fast shrink, just rehash the last nodes - size_type new_first_bucket_num = new_buckets_len; - if(same_buffer && fast_shrink && (n < new_buckets_len)){ - n = new_buckets_len; - new_first_bucket_num = priv_get_cache_bucket_num(); + size_type new_first_bucket_num = new_bucket_count; + if(same_buffer && fast_shrink && (n < new_bucket_count)){ + n = new_bucket_count; + new_first_bucket_num = this->priv_get_cache_bucket_num(); } //Anti-exception stuff: they destroy the elements if something goes wrong. @@ -2084,19 +2085,19 @@ class hashtable_impl bucket_type & newbuck = new_buckets[0]; bucket_type & oldbuck = old_buckets[0]; detail::exception_array_disposer - rollback1(newbuck, node_disp, new_buckets_len); + rollback1(newbuck, node_disp, new_bucket_count); detail::exception_array_disposer - rollback2(oldbuck, node_disp, old_buckets_len); + rollback2(oldbuck, node_disp, old_bucket_count); //Put size in a safe value for rollback exception size_type size_backup = this->priv_size_traits().get_size(); this->priv_size_traits().set_size(0); //Put cache to safe position - priv_initialize_cache(); - priv_insertion_update_cache(size_type(0u)); + this->priv_initialize_cache(); + this->priv_insertion_update_cache(size_type(0u)); //Iterate through nodes - for(; n < old_buckets_len; ++n){ + for(; n < old_bucket_count; ++n){ bucket_type &old_bucket = old_buckets[n]; if(!fast_shrink){ @@ -2104,14 +2105,14 @@ class hashtable_impl siterator end(old_bucket.end()); siterator i(old_bucket.begin()); for(;i != end; ++i){ - const value_type &v = priv_value_from_slist_node(i.pointed_node()); + const value_type &v = this->priv_value_from_slist_node(i.pointed_node()); const std::size_t hash_value = this->priv_stored_or_compute_hash(v, store_hash_t()); - const size_type new_n = priv_hash_to_bucket(hash_value, new_buckets_len, new_buckets_len); + const size_type new_n = this->priv_hash_to_bucket(hash_value, new_bucket_count, new_bucket_count); if(cache_begin && new_n < new_first_bucket_num) new_first_bucket_num = new_n; siterator last = bucket_type::s_iterator_to (*group_functions_t::get_last_in_group - (dcast_bucket_ptr(i.pointed_node()), optimize_multikey_t())); + (hashtable_impl::dcast_bucket_ptr(i.pointed_node()), optimize_multikey_t())); if(same_buffer && new_n == n){ before_i = last; } @@ -2123,7 +2124,7 @@ class hashtable_impl } } else{ - const size_type new_n = priv_hash_to_bucket(n, new_buckets_len, new_buckets_len); + const size_type new_n = this->priv_hash_to_bucket(n, new_bucket_count, new_bucket_count); if(cache_begin && new_n < new_first_bucket_num) new_first_bucket_num = new_n; bucket_type &new_b = new_buckets[new_n]; @@ -2131,16 +2132,16 @@ class hashtable_impl new_b.splice_after( new_b.before_begin() , old_bucket , old_bucket.before_begin() - , priv_get_last(old_bucket)); + , hashtable_impl::priv_get_last(old_bucket)); } } } this->priv_size_traits().set_size(size_backup); - this->priv_split_traits().set_size(new_buckets_len); + this->priv_split_traits().set_size(new_bucket_count); this->priv_real_bucket_traits() = new_bucket_traits; - priv_initialize_cache(); - priv_insertion_update_cache(new_first_bucket_num); + this->priv_initialize_cache(); + this->priv_insertion_update_cache(new_first_bucket_num); rollback1.release(); rollback2.release(); } @@ -2158,57 +2159,57 @@ class hashtable_impl { //This function is only available for containers with incremental hashing BOOST_STATIC_ASSERT(( incremental && power_2_buckets )); - size_type split_idx = priv_split_traits().get_size(); - size_type bucket_len = priv_buckets_len(); + const size_type split_idx = this->priv_split_traits().get_size(); + const size_type bucket_count = this->priv_bucket_count(); + const bucket_ptr bucket_pointer = this->priv_bucket_pointer(); if(grow){ //Test if the split variable can be changed - if(split_idx >= bucket_len) + if(split_idx >= bucket_count) return false; - size_type bucket_len = priv_buckets_len(); - size_type bucket_to_rehash = split_idx - bucket_len/2; - bucket_type &old_bucket = this->priv_buckets()[bucket_to_rehash]; + const size_type bucket_to_rehash = split_idx - bucket_count/2; + bucket_type &old_bucket = bucket_pointer[bucket_to_rehash]; siterator before_i(old_bucket.before_begin()); - siterator end(old_bucket.end()); + const siterator end(old_bucket.end()); siterator i(old_bucket.begin()); - priv_split_traits().increment(); + this->priv_split_traits().increment(); //Anti-exception stuff: if an exception is thrown while //moving elements from old_bucket to the target bucket, all moved //elements are moved back to the original one. detail::incremental_rehash_rollback rollback - ( this->priv_buckets()[split_idx], old_bucket, priv_split_traits()); + ( bucket_pointer[split_idx], old_bucket, this->priv_split_traits()); for(;i != end; ++i){ - const value_type &v = priv_value_from_slist_node(i.pointed_node()); + const value_type &v = this->priv_value_from_slist_node(i.pointed_node()); const std::size_t hash_value = this->priv_stored_or_compute_hash(v, store_hash_t()); - const size_type new_n = priv_hash_to_bucket(hash_value); + const size_type new_n = this->priv_hash_to_bucket(hash_value); siterator last = bucket_type::s_iterator_to (*group_functions_t::get_last_in_group - (dcast_bucket_ptr(i.pointed_node()), optimize_multikey_t())); + (hashtable_impl::dcast_bucket_ptr(i.pointed_node()), optimize_multikey_t())); if(new_n == bucket_to_rehash){ before_i = last; } else{ - bucket_type &new_b = this->priv_buckets()[new_n]; + bucket_type &new_b = bucket_pointer[new_n]; new_b.splice_after(new_b.before_begin(), old_bucket, before_i, last); } i = before_i; } rollback.release(); - priv_erasure_update_cache(); + this->priv_erasure_update_cache(); return true; } else{ //Test if the split variable can be changed - if(split_idx <= bucket_len/2) + if(split_idx <= bucket_count/2) return false; - const size_type target_bucket_num = split_idx - 1 - bucket_len/2; - bucket_type &target_bucket = this->priv_buckets()[target_bucket_num]; - bucket_type &source_bucket = this->priv_buckets()[split_idx-1]; + const size_type target_bucket_num = split_idx - 1 - bucket_count/2; + bucket_type &target_bucket = bucket_pointer[target_bucket_num]; + bucket_type &source_bucket = bucket_pointer[split_idx-1]; target_bucket.splice_after(target_bucket.cbefore_begin(), source_bucket); - priv_split_traits().decrement(); - priv_insertion_update_cache(target_bucket_num); + this->priv_split_traits().decrement(); + this->priv_insertion_update_cache(target_bucket_num); return true; } } @@ -2231,7 +2232,7 @@ class hashtable_impl //This function is only available for containers with incremental hashing BOOST_STATIC_ASSERT(( incremental && power_2_buckets )); size_type new_bucket_traits_size = new_bucket_traits.bucket_count(); - size_type cur_bucket_traits = this->priv_buckets_len(); + size_type cur_bucket_traits = this->priv_bucket_count(); if(new_bucket_traits_size/2 != cur_bucket_traits && new_bucket_traits_size != cur_bucket_traits/2){ return false; } @@ -2249,8 +2250,8 @@ class hashtable_impl return false; } - const size_type ini_n = priv_get_cache_bucket_num(); - const bucket_ptr old_buckets = this->priv_buckets(); + const size_type ini_n = this->priv_get_cache_bucket_num(); + const bucket_ptr old_buckets = this->priv_bucket_pointer(); this->priv_real_bucket_traits() = new_bucket_traits; if(new_bucket_traits.bucket_begin() != old_buckets){ for(size_type n = ini_n; n < split_idx; ++n){ @@ -2259,8 +2260,8 @@ class hashtable_impl new_bucket.splice_after(new_bucket.cbefore_begin(), old_bucket); } //Put cache to safe position - priv_initialize_cache(); - priv_insertion_update_cache(ini_n); + this->priv_initialize_cache(); + this->priv_insertion_update_cache(ini_n); } return true; } @@ -2321,22 +2322,22 @@ class hashtable_impl private: std::size_t priv_hash_to_bucket(std::size_t hash_value) const - { return priv_hash_to_bucket(hash_value, this->priv_real_bucket_traits().bucket_count(), priv_split_traits().get_size()); } + { return this->priv_hash_to_bucket(hash_value, this->priv_real_bucket_traits().bucket_count(), this->priv_split_traits().get_size()); } - std::size_t priv_hash_to_bucket(std::size_t hash_value, std::size_t bucket_len, std::size_t split) const + std::size_t priv_hash_to_bucket(std::size_t hash_value, std::size_t bucket_count, std::size_t split) const { - std::size_t bucket_number = priv_hash_to_bucket_impl(hash_value, bucket_len, power_2_buckets_t()); + std::size_t bucket_number = hashtable_impl::priv_hash_to_bucket_impl(hash_value, bucket_count, power_2_buckets_t()); if(incremental) if(bucket_number >= split) - bucket_number -= bucket_len/2; + bucket_number -= bucket_count/2; return bucket_number; } - std::size_t priv_hash_to_bucket_impl(std::size_t hash_value, std::size_t bucket_len, detail::false_) const - { return hash_value % bucket_len; } + static std::size_t priv_hash_to_bucket_impl(std::size_t hash_value, std::size_t bucket_count, detail::false_) + { return hash_value % bucket_count; } - std::size_t priv_hash_to_bucket_impl(std::size_t hash_value, std::size_t bucket_len, detail::true_) const - { return hash_value & (bucket_len - 1); } + static std::size_t priv_hash_to_bucket_impl(std::size_t hash_value, std::size_t bucket_count, detail::true_) + { return hash_value & (bucket_count - 1); } const key_equal &priv_equal() const { return static_cast(this->data_.internal_.bucket_hash_equal_.get()); } @@ -2351,10 +2352,10 @@ class hashtable_impl { return data_; } value_type &priv_value_from_slist_node(slist_node_ptr n) - { return *this->get_real_value_traits().to_value_ptr(dcast_bucket_ptr(n)); } + { return *this->get_real_value_traits().to_value_ptr(hashtable_impl::dcast_bucket_ptr(n)); } const value_type &priv_value_from_slist_node(slist_node_ptr n) const - { return *this->get_real_value_traits().to_value_ptr(dcast_bucket_ptr(n)); } + { return *this->get_real_value_traits().to_value_ptr(hashtable_impl::dcast_bucket_ptr(n)); } const real_bucket_traits &priv_real_bucket_traits(detail::false_) const { return this->data_.internal_.bucket_hash_equal_.bucket_hash.bucket_plus_size_.bucket_traits_; } @@ -2386,15 +2387,12 @@ class hashtable_impl hasher &priv_hasher() { return static_cast(this->data_.internal_.bucket_hash_equal_.bucket_hash.get()); } - bucket_ptr priv_buckets() const + bucket_ptr priv_bucket_pointer() const { return this->priv_real_bucket_traits().bucket_begin(); } - size_type priv_buckets_len() const + size_type priv_bucket_count() const { return this->priv_real_bucket_traits().bucket_count(); } - static node_ptr uncast(const const_node_ptr & ptr) - { return node_ptr(const_cast(boost::intrusive::detail::to_raw_pointer(ptr))); } - node &priv_value_to_node(value_type &v) { return *this->get_real_value_traits().to_node_ptr(v); } @@ -2417,11 +2415,11 @@ class hashtable_impl void priv_erase_range_impl (size_type bucket_num, siterator before_first_it, siterator end, Disposer disposer, size_type &num_erased) { - const bucket_ptr buckets = priv_buckets(); + const bucket_ptr buckets = this->priv_bucket_pointer(); bucket_type &b = buckets[bucket_num]; if(before_first_it == b.before_begin() && end == b.end()){ - priv_erase_range_impl(bucket_num, 1, disposer, num_erased); + this->priv_erase_range_impl(bucket_num, 1, disposer, num_erased); } else{ num_erased = 0; @@ -2429,7 +2427,7 @@ class hashtable_impl ++to_erase; slist_node_ptr end_ptr = end.pointed_node(); while(to_erase != end){ - group_functions_t::erase_from_group(end_ptr, dcast_bucket_ptr(to_erase.pointed_node()), optimize_multikey_t()); + group_functions_t::erase_from_group(end_ptr, hashtable_impl::dcast_bucket_ptr(to_erase.pointed_node()), optimize_multikey_t()); to_erase = b.erase_after_and_dispose(before_first_it, make_node_disposer(disposer)); ++num_erased; } @@ -2442,7 +2440,7 @@ class hashtable_impl (size_type first_bucket_num, size_type num_buckets, Disposer disposer, size_type &num_erased) { //Now fully clear the intermediate buckets - const bucket_ptr buckets = priv_buckets(); + const bucket_ptr buckets = this->priv_bucket_pointer(); num_erased = 0; for(size_type i = first_bucket_num; i < (num_buckets + first_bucket_num); ++i){ bucket_type &b = buckets[i]; @@ -2451,7 +2449,7 @@ class hashtable_impl ++nxt; siterator end(b.end()); while(nxt != end){ - group_functions_t::init_group(dcast_bucket_ptr(nxt.pointed_node()), optimize_multikey_t()); + group_functions_t::init_group(hashtable_impl::dcast_bucket_ptr(nxt.pointed_node()), optimize_multikey_t()); nxt = b.erase_after_and_dispose (b_begin, make_node_disposer(disposer)); this->priv_size_traits().decrement(); @@ -2467,14 +2465,14 @@ class hashtable_impl { size_type num_erased; if (first_bucket == last_bucket){ - priv_erase_range_impl(first_bucket, before_first_it, last_it, disposer, num_erased); + this->priv_erase_range_impl(first_bucket, before_first_it, last_it, disposer, num_erased); } else { - bucket_type *b = (&this->priv_buckets()[0]); - priv_erase_range_impl(first_bucket, before_first_it, b[first_bucket].end(), disposer, num_erased); + bucket_type *b = (&this->priv_bucket_pointer()[0]); + this->priv_erase_range_impl(first_bucket, before_first_it, b[first_bucket].end(), disposer, num_erased); if(size_type n = (last_bucket - first_bucket - 1)) - priv_erase_range_impl(first_bucket + 1, n, disposer, num_erased); - priv_erase_range_impl(last_bucket, b[last_bucket].before_begin(), last_it, disposer, num_erased); + this->priv_erase_range_impl(first_bucket + 1, n, disposer, num_erased); + this->priv_erase_range_impl(last_bucket, b[last_bucket].before_begin(), last_it, disposer, num_erased); } } @@ -2485,10 +2483,10 @@ class hashtable_impl { return node_traits::get_hash(this->get_real_value_traits().to_node_ptr(v)); } std::size_t priv_stored_or_compute_hash(const value_type &v, detail::false_) const - { return priv_hasher()(v); } + { return this->priv_hasher()(v); } std::size_t priv_stored_hash(slist_node_ptr n, detail::true_) const - { return node_traits::get_hash(dcast_bucket_ptr(n)); } + { return node_traits::get_hash(hashtable_impl::dcast_bucket_ptr(n)); } std::size_t priv_stored_hash(slist_node_ptr, detail::false_) const { @@ -2501,7 +2499,7 @@ class hashtable_impl { siterator it(b.begin()), itend(b.end()); while(it != itend){ - node_ptr to_erase(dcast_bucket_ptr(it.pointed_node())); + node_ptr to_erase(hashtable_impl::dcast_bucket_ptr(it.pointed_node())); ++it; group_algorithms::init(to_erase); } @@ -2511,7 +2509,7 @@ class hashtable_impl {} std::size_t priv_get_bucket_num(siterator it) - { return priv_get_bucket_num_hash_dispatch(it, store_hash_t()); } + { return this->priv_get_bucket_num_hash_dispatch(it, store_hash_t()); } std::size_t priv_get_bucket_num_hash_dispatch(siterator it, detail::true_) { @@ -2520,15 +2518,15 @@ class hashtable_impl } std::size_t priv_get_bucket_num_hash_dispatch(siterator it, detail::false_) - { return priv_get_bucket_num_no_hash_store(it, optimize_multikey_t()); } + { return this->priv_get_bucket_num_no_hash_store(it, optimize_multikey_t()); } std::size_t priv_get_bucket_num_no_hash_store(siterator it, detail::true_) { - bucket_ptr f(priv_buckets()), l(f + priv_buckets_len() - 1); + const bucket_ptr f(this->priv_bucket_pointer()), l(f + this->priv_bucket_count() - 1); slist_node_ptr bb = group_functions_t::get_bucket_before_begin ( f->end().pointed_node() , l->end().pointed_node() - , dcast_bucket_ptr(it.pointed_node())); + , hashtable_impl::dcast_bucket_ptr(it.pointed_node())); //Now get the bucket_impl from the iterator const bucket_type &b = static_cast (bucket_type::slist_type::container_from_end_iterator(bucket_type::s_iterator_to(*bb))); @@ -2538,7 +2536,7 @@ class hashtable_impl std::size_t priv_get_bucket_num_no_hash_store(siterator it, detail::false_) { - bucket_ptr f(priv_buckets()), l(f + priv_buckets_len() - 1); + bucket_ptr f(this->priv_bucket_pointer()), l(f + this->priv_bucket_count() - 1); slist_node_ptr first_ptr(f->cend().pointed_node()) , last_ptr(l->cend().pointed_node()); @@ -2557,12 +2555,12 @@ class hashtable_impl siterator priv_get_previous (bucket_type &b, siterator i) - { return priv_get_previous(b, i, optimize_multikey_t()); } + { return this->priv_get_previous(b, i, optimize_multikey_t()); } siterator priv_get_previous (bucket_type &b, siterator i, detail::true_) { - node_ptr elem(dcast_bucket_ptr(i.pointed_node())); + node_ptr elem(hashtable_impl::dcast_bucket_ptr(i.pointed_node())); node_ptr prev_in_group(group_traits::get_next(elem)); bool first_in_group = node_traits::get_next(prev_in_group) != elem; typename bucket_type::node &n = first_in_group @@ -2577,7 +2575,7 @@ class hashtable_impl { return b.previous(i); } static siterator priv_get_last(bucket_type &b) - { return priv_get_last(b, optimize_multikey_t()); } + { return hashtable_impl::priv_get_last(b, optimize_multikey_t()); } static siterator priv_get_last(bucket_type &b, detail::true_) { @@ -2585,11 +2583,11 @@ class hashtable_impl //This requires checking the first node of the next group or //the bucket node. slist_node_ptr end_ptr(b.end().pointed_node()); - node_ptr possible_end(node_traits::get_next( dcast_bucket_ptr(end_ptr))); + node_ptr possible_end(node_traits::get_next( hashtable_impl::dcast_bucket_ptr(end_ptr))); node_ptr last_node_group(possible_end); while(end_ptr != possible_end){ - last_node_group = group_traits::get_next(dcast_bucket_ptr(possible_end)); + last_node_group = group_traits::get_next(hashtable_impl::dcast_bucket_ptr(possible_end)); possible_end = node_traits::get_next(last_node_group); } return bucket_type::s_iterator_to(*last_node_group); @@ -2597,87 +2595,7 @@ class hashtable_impl static siterator priv_get_last(bucket_type &b, detail::false_) { return b.previous(b.end()); } -/* - siterator priv_get_previous_and_next_in_group - (siterator i, node_ptr &nxt_in_group) - { - siterator prev; - node_ptr elem(dcast_bucket_ptr(i.pointed_node())); - bucket_ptr f(priv_buckets()), l(f + priv_buckets_len() - 1); - slist_node_ptr first_end_ptr(f->cend().pointed_node()); - slist_node_ptr last_end_ptr (l->cend().pointed_node()); - - node_ptr nxt(node_traits::get_next(elem)); - node_ptr prev_in_group(group_traits::get_next(elem)); - bool last_in_group = (first_end_ptr <= nxt && nxt <= last_end_ptr) || - (group_traits::get_next(nxt) != elem); - bool first_in_group = node_traits::get_next(prev_in_group) != elem; - - if(first_in_group){ - node_ptr start_pos; - if(last_in_group){ - start_pos = elem; - nxt_in_group = node_ptr(); - } - else{ - start_pos = prev_in_group; - nxt_in_group = node_traits::get_next(elem); - } - slist_node_ptr bucket_node; - if(store_hash){ - bucket_node = this->priv_buckets() - [this->priv_hash_to_bucket - (this->priv_stored_hash(elem, store_hash_t())) - ].before_begin().pointed_node(); - } - else{ - bucket_node = group_functions_t::get_bucket_before_begin - (first_end_ptr, last_end_ptr, start_pos); - } - prev = bucket_type::s_iterator_to - (*group_functions_t::get_prev_to_first_in_group(bucket_node, elem)); - } - else{ - if(last_in_group){ - nxt_in_group = group_functions_t::get_first_in_group_of_last_in_group(elem); - } - else{ - nxt_in_group = node_traits::get_next(elem); - } - prev = bucket_type::s_iterator_to(*group_traits::get_next(elem)); - } - return prev; - } -*/ - -/* - template - void priv_erase(const_iterator i, Disposer disposer, detail::true_) - { - siterator elem(i.slist_it()); - node_ptr nxt_in_group; - siterator prev = priv_get_previous_and_next_in_group(elem, nxt_in_group); - bucket_type::s_erase_after_and_dispose(prev, make_node_disposer(disposer)); - if(nxt_in_group) - group_algorithms::unlink_after(nxt_in_group); - if(safemode_or_autounlink) - group_algorithms::init(dcast_bucket_ptr(elem.pointed_node())); - } -*/ - -/* - if(store_hash){ - bucket_node = this->priv_buckets() - [this->priv_hash_to_bucket - (this->priv_stored_hash(elem, store_hash_t())) - ].before_begin().pointed_node(); - } - else{ - bucket_node = group_functions_t::get_bucket_before_begin - (first_end_ptr, last_end_ptr, start_pos); - } -*/ template void priv_erase(const_iterator i, Disposer disposer, detail::true_) { @@ -2685,14 +2603,14 @@ class hashtable_impl slist_node_ptr f_bucket_end, l_bucket_end; if(store_hash){ f_bucket_end = l_bucket_end = - (this->priv_buckets() + (this->priv_bucket_pointer() [this->priv_hash_to_bucket (this->priv_stored_hash(elem, store_hash_t())) ]).before_begin().pointed_node(); } else{ - f_bucket_end = this->priv_buckets()->cend().pointed_node(); - l_bucket_end = f_bucket_end + priv_buckets_len() - 1; + f_bucket_end = this->priv_bucket_pointer()->cend().pointed_node(); + l_bucket_end = f_bucket_end + this->priv_bucket_count() - 1; } node_ptr nxt_in_group; siterator prev = bucket_type::s_iterator_to @@ -2703,15 +2621,15 @@ class hashtable_impl if(nxt_in_group) group_algorithms::unlink_after(nxt_in_group); if(safemode_or_autounlink) - group_algorithms::init(dcast_bucket_ptr(elem)); + group_algorithms::init(hashtable_impl::dcast_bucket_ptr(elem)); } template void priv_erase(const_iterator i, Disposer disposer, detail::false_) { siterator to_erase(i.slist_it()); - bucket_type &b = this->priv_buckets()[this->priv_get_bucket_num(to_erase)]; - siterator prev(priv_get_previous(b, to_erase)); + bucket_type &b = this->priv_bucket_pointer()[this->priv_get_bucket_num(to_erase)]; + siterator prev(this->priv_get_previous(b, to_erase)); b.erase_after_and_dispose(prev, make_node_disposer(disposer)); } @@ -2722,28 +2640,28 @@ class hashtable_impl } siterator priv_invalid_local_it() const - { return priv_invalid_bucket()->end(); } + { return this->priv_invalid_bucket()->end(); } siterator priv_begin() const - { return priv_begin(cache_begin_t()); } + { return this->priv_begin(cache_begin_t()); } siterator priv_begin(detail::false_) const { size_type n = 0; - size_type buckets_len = this->priv_buckets_len(); - for (n = 0; n < buckets_len; ++n){ - bucket_type &b = this->priv_buckets()[n]; + size_type bucket_count = this->priv_bucket_count(); + for (n = 0; n < bucket_count; ++n){ + bucket_type &b = this->priv_bucket_pointer()[n]; if(!b.empty()){ return b.begin(); } } - return priv_invalid_local_it(); + return this->priv_invalid_local_it(); } siterator priv_begin(detail::true_) const { - if(this->data_.internal_.bucket_hash_equal_.cached_begin_ == priv_invalid_bucket()){ - return priv_invalid_local_it(); + if(this->data_.internal_.bucket_hash_equal_.cached_begin_ == this->priv_invalid_bucket()){ + return this->priv_invalid_local_it(); } else{ return this->data_.internal_.bucket_hash_equal_.cached_begin_->begin(); @@ -2751,20 +2669,20 @@ class hashtable_impl } void priv_initialize_cache() - { priv_initialize_cache(cache_begin_t()); } + { this->priv_initialize_cache(cache_begin_t()); } void priv_initialize_cache(detail::true_) - { this->data_.internal_.bucket_hash_equal_.cached_begin_ = priv_invalid_bucket(); } + { this->data_.internal_.bucket_hash_equal_.cached_begin_ = this->priv_invalid_bucket(); } void priv_initialize_cache(detail::false_) {} void priv_insertion_update_cache(size_type insertion_bucket) - { priv_insertion_update_cache(insertion_bucket, cache_begin_t()); } + { this->priv_insertion_update_cache(insertion_bucket, cache_begin_t()); } void priv_insertion_update_cache(size_type insertion_bucket, detail::true_) { - bucket_ptr p = priv_buckets() + insertion_bucket; + bucket_ptr p = this->priv_bucket_pointer() + insertion_bucket; if(p < this->data_.internal_.bucket_hash_equal_.cached_begin_){ this->data_.internal_.bucket_hash_equal_.cached_begin_ = p; } @@ -2774,16 +2692,16 @@ class hashtable_impl {} void priv_erasure_update_cache(size_type first_bucket, size_type last_bucket) - { priv_erasure_update_cache(first_bucket, last_bucket, cache_begin_t()); } + { this->priv_erasure_update_cache(first_bucket, last_bucket, cache_begin_t()); } void priv_erasure_update_cache(size_type first_bucket_num, size_type last_bucket_num, detail::true_) { //If the last bucket is the end, the cache must be updated //to the last position if all - if(priv_get_cache_bucket_num() == first_bucket_num && - priv_buckets()[first_bucket_num].empty() ){ - priv_set_cache(priv_buckets() + last_bucket_num); - priv_erasure_update_cache(); + if(this->priv_get_cache_bucket_num() == first_bucket_num && + this->priv_bucket_pointer()[first_bucket_num].empty() ){ + this->priv_set_cache(this->priv_bucket_pointer() + last_bucket_num); + this->priv_erasure_update_cache(); } } @@ -2791,23 +2709,23 @@ class hashtable_impl {} void priv_erasure_update_cache() - { priv_erasure_update_cache(cache_begin_t()); } + { this->priv_erasure_update_cache(cache_begin_t()); } void priv_erasure_update_cache(detail::true_) { if(constant_time_size && !size()){ - priv_initialize_cache(); + this->priv_initialize_cache(); } else{ - size_type current_n = this->data_.internal_.bucket_hash_equal_.cached_begin_ - priv_buckets(); - for( const size_type num_buckets = this->priv_buckets_len() + size_type current_n = this->data_.internal_.bucket_hash_equal_.cached_begin_ - this->priv_bucket_pointer(); + for( const size_type num_buckets = this->priv_bucket_count() ; current_n < num_buckets ; ++current_n, ++this->data_.internal_.bucket_hash_equal_.cached_begin_){ if(!this->data_.internal_.bucket_hash_equal_.cached_begin_->empty()){ return; } } - priv_initialize_cache(); + this->priv_initialize_cache(); } } @@ -2824,22 +2742,22 @@ class hashtable_impl {} bucket_ptr priv_get_cache() - { return priv_get_cache(cache_begin_t()); } + { return this->priv_get_cache(cache_begin_t()); } bucket_ptr priv_get_cache(detail::true_) { return this->data_.internal_.bucket_hash_equal_.cached_begin_; } bucket_ptr priv_get_cache(detail::false_) - { return this->priv_buckets(); } + { return this->priv_bucket_pointer(); } void priv_set_cache(const bucket_ptr &p) { this->data_.internal_.bucket_hash_equal_.set_cache(p); } size_type priv_get_cache_bucket_num() - { return priv_get_cache_bucket_num(cache_begin_t()); } + { return this->priv_get_cache_bucket_num(cache_begin_t()); } size_type priv_get_cache_bucket_num(detail::true_) - { return this->data_.internal_.bucket_hash_equal_.cached_begin_ - this->priv_buckets(); } + { return this->data_.internal_.bucket_hash_equal_.cached_begin_ - this->priv_bucket_pointer(); } size_type priv_get_cache_bucket_num(detail::false_) { return 0u; } @@ -2847,25 +2765,25 @@ class hashtable_impl void priv_clear_buckets() { this->priv_clear_buckets - ( priv_get_cache() - , this->priv_buckets_len() - (priv_get_cache() - priv_buckets())); + ( this->priv_get_cache() + , this->priv_bucket_count() - (this->priv_get_cache() - this->priv_bucket_pointer())); } void priv_initialize_buckets() - { this->priv_clear_buckets(priv_buckets(), this->priv_buckets_len()); } + { this->priv_clear_buckets(this->priv_bucket_pointer(), this->priv_bucket_count()); } - void priv_clear_buckets(bucket_ptr buckets_ptr, size_type buckets_len) + void priv_clear_buckets(bucket_ptr buckets_ptr, size_type bucket_count) { - for(; buckets_len--; ++buckets_ptr){ + for(; bucket_count--; ++buckets_ptr){ if(safemode_or_autounlink){ - priv_clear_group_nodes(*buckets_ptr, optimize_multikey_t()); + hashtable_impl::priv_clear_group_nodes(*buckets_ptr, optimize_multikey_t()); buckets_ptr->clear_and_dispose(detail::init_disposer()); } else{ buckets_ptr->clear(); } } - priv_initialize_cache(); + this->priv_initialize_cache(); } template @@ -2874,25 +2792,25 @@ class hashtable_impl , KeyValueEqual equal_func, size_type &bucket_number, std::size_t &h, siterator &previt) const { h = hash_func(key); - return priv_find_with_hash(key, equal_func, bucket_number, h, previt); + return this->priv_find_with_hash(key, equal_func, bucket_number, h, previt); } template siterator priv_find_with_hash ( const KeyType &key, KeyValueEqual equal_func, size_type &bucket_number, const std::size_t h, siterator &previt) const { - bucket_number = priv_hash_to_bucket(h); - bucket_type &b = this->priv_buckets()[bucket_number]; + bucket_number = this->priv_hash_to_bucket(h); + bucket_type &b = this->priv_bucket_pointer()[bucket_number]; previt = b.before_begin(); if(constant_time_size && this->empty()){ - return priv_invalid_local_it(); + return this->priv_invalid_local_it(); } siterator it = previt; ++it; while(it != b.end()){ - const value_type &v = priv_value_from_slist_node(it.pointed_node()); + const value_type &v = this->priv_value_from_slist_node(it.pointed_node()); if(compare_hash){ std::size_t vh = this->priv_stored_or_compute_hash(v, store_hash_t()); if(h == vh && equal_func(key, v)){ @@ -2905,7 +2823,7 @@ class hashtable_impl if(optimize_multikey){ previt = bucket_type::s_iterator_to (*group_functions_t::get_last_in_group - (dcast_bucket_ptr(it.pointed_node()), optimize_multikey_t())); + (hashtable_impl::dcast_bucket_ptr(it.pointed_node()), optimize_multikey_t())); it = previt; } else{ @@ -2914,7 +2832,7 @@ class hashtable_impl ++it; } previt = b.before_begin(); - return priv_invalid_local_it(); + return this->priv_invalid_local_it(); } iterator priv_insert_equal_with_hash(reference value, std::size_t hash_value) @@ -2923,18 +2841,18 @@ class hashtable_impl siterator prev; siterator it = this->priv_find_with_hash (value, this->priv_equal(), bucket_num, hash_value, prev); - return priv_insert_equal_find(value, bucket_num, hash_value, it); + return this->priv_insert_equal_find(value, bucket_num, hash_value, it); } iterator priv_insert_equal_find(reference value, size_type bucket_num, std::size_t hash_value, siterator it) { - bucket_type &b = this->priv_buckets()[bucket_num]; - bool found_equal = it != priv_invalid_local_it(); + bucket_type &b = this->priv_bucket_pointer()[bucket_num]; + bool found_equal = it != this->priv_invalid_local_it(); if(!found_equal){ it = b.before_begin(); } //Now store hash if needed - node_ptr n = pointer_traits::pointer_to(priv_value_to_node(value)); + node_ptr n = pointer_traits::pointer_to(this->priv_value_to_node(value)); node_functions_t::store_hash(n, hash_value, store_hash_t()); //Checks for some modes if(safemode_or_autounlink) @@ -2942,11 +2860,11 @@ class hashtable_impl //Shorcut for optimize_multikey cases if(optimize_multikey){ node_ptr first_in_group = found_equal ? - dcast_bucket_ptr(it.pointed_node()) : node_ptr(); + hashtable_impl::dcast_bucket_ptr(it.pointed_node()) : node_ptr(); group_functions_t::insert_in_group(first_in_group, n, optimize_multikey_t()); } //Update cache and increment size if needed - priv_insertion_update_cache(bucket_num); + this->priv_insertion_update_cache(bucket_num); this->priv_size_traits().increment(); //Insert the element in the bucket after it return iterator(b.insert_after(it, *n), this); @@ -2966,20 +2884,20 @@ class hashtable_impl siterator prev; //Let's see if the element is present std::pair to_return - ( priv_find(key, hash_func, equal_func, bucket_number_first, h, prev) - , priv_invalid_local_it()); + ( this->priv_find(key, hash_func, equal_func, bucket_number_first, h, prev) + , this->priv_invalid_local_it()); if(to_return.first == to_return.second){ bucket_number_second = bucket_number_first; return to_return; } //If it's present, find the first that it's not equal in //the same bucket - bucket_type &b = this->priv_buckets()[bucket_number_first]; + bucket_type &b = this->priv_bucket_pointer()[bucket_number_first]; siterator it = to_return.first; if(optimize_multikey){ to_return.second = bucket_type::s_iterator_to (*node_traits::get_next(group_functions_t::get_last_in_group - (dcast_bucket_ptr(it.pointed_node()), optimize_multikey_t()))); + (hashtable_impl::dcast_bucket_ptr(it.pointed_node()), optimize_multikey_t()))); count = std::distance(it, to_return.second); if(to_return.second != b.end()){ bucket_number_second = bucket_number_first; @@ -2990,7 +2908,7 @@ class hashtable_impl ++count; ++it; while(it != b.end()){ - const value_type &v = priv_value_from_slist_node(it.pointed_node()); + const value_type &v = this->priv_value_from_slist_node(it.pointed_node()); if(compare_hash){ std::size_t hv = this->priv_stored_or_compute_hash(v, store_hash_t()); if(hv != h || !equal_func(key, v)){ @@ -3011,9 +2929,9 @@ class hashtable_impl //If we reached the end, find the first, non-empty bucket for(bucket_number_second = bucket_number_first+1 - ; bucket_number_second != this->priv_buckets_len() + ; bucket_number_second != this->priv_bucket_count() ; ++bucket_number_second){ - bucket_type &b = this->priv_buckets()[bucket_number_second]; + bucket_type &b = this->priv_bucket_pointer()[bucket_number_second]; if(!b.empty()){ to_return.second = b.begin(); return to_return; @@ -3021,7 +2939,7 @@ class hashtable_impl } //Otherwise, return the end node - to_return.second = priv_invalid_local_it(); + to_return.second = this->priv_invalid_local_it(); return to_return; } /// @endcond @@ -3055,7 +2973,9 @@ struct make_hashtable_opt typedef typename detail::get_value_traits ::type value_traits; static const bool external_value_traits = - detail::external_value_traits_is_true::value; + detail::external_value_traits_bool_is_true::value;/* + static const bool resizable_bucket_traits = + detail::resizable_bool_is_true::value;*/ typedef typename detail::eval_if_c < external_value_traits , detail::eval_value_traits