@@ -2883,7 +2883,7 @@ class raw_hash_set {
28832883 // Avoid probing if we won't be able to prefetch the addresses received.
28842884#ifdef ABSL_HAVE_PREFETCH
28852885 prefetch_heap_block ();
2886- auto seq = probe (common (), hash_ref () (key));
2886+ auto seq = probe (common (), hash_of (key));
28872887 PrefetchToLocalCache (control () + seq.offset ());
28882888 PrefetchToLocalCache (slot_array () + seq.offset ());
28892889#endif // ABSL_HAVE_PREFETCH
@@ -2902,7 +2902,7 @@ class raw_hash_set {
29022902 AssertOnFind (key);
29032903 if (capacity () <= 1 ) return find_small (key);
29042904 prefetch_heap_block ();
2905- return find_large (key, hash_ref () (key));
2905+ return find_large (key, hash_of (key));
29062906 }
29072907
29082908 template <class K = key_type>
@@ -3180,6 +3180,10 @@ class raw_hash_set {
31803180 sizeof (slot_type));
31813181 }
31823182
3183+ template <class K >
3184+ size_t hash_of (const K& key) const {
3185+ return hash_ref ()(key);
3186+ }
31833187 size_t hash_of (slot_type* slot) const {
31843188 return PolicyTraits::apply (HashElement{hash_ref ()},
31853189 PolicyTraits::element (slot));
@@ -3312,7 +3316,7 @@ class raw_hash_set {
33123316 PolicyTraits::transfer_uses_memcpy () && SooEnabled ();
33133317 size_t index = GrowSooTableToNextCapacityAndPrepareInsert<
33143318 kUseMemcpy ? OptimalMemcpySizeForSooSlotTransfer (sizeof (slot_type)) : 0 ,
3315- kUseMemcpy >(common (), GetPolicyFunctions (), hash_ref () (key),
3319+ kUseMemcpy >(common (), GetPolicyFunctions (), hash_of (key),
33163320 soo_slot_ctrl);
33173321 return {iterator_at (index), true };
33183322 }
@@ -3321,7 +3325,7 @@ class raw_hash_set {
33213325 std::pair<iterator, bool > find_or_prepare_insert_non_soo (const K& key) {
33223326 ABSL_SWISSTABLE_ASSERT (!is_soo ());
33233327 prefetch_heap_block ();
3324- const size_t hash = hash_ref () (key);
3328+ const size_t hash = hash_of (key);
33253329 auto seq = probe (common (), hash);
33263330 const h2_t h2 = H2 (hash);
33273331 const ctrl_t * ctrl = control ();
@@ -3406,7 +3410,7 @@ class raw_hash_set {
34063410 }
34073411 if (empty ()) return ;
34083412
3409- const size_t hash_of_arg = hash_ref () (key);
3413+ const size_t hash_of_arg = hash_of (key);
34103414 const auto assert_consistent = [&](const ctrl_t *, void * slot) {
34113415 const value_type& element =
34123416 PolicyTraits::element (static_cast <slot_type*>(slot));
@@ -3768,7 +3772,7 @@ struct HashtableDebugAccess<Set, absl::void_t<typename Set::raw_hash_set>> {
37683772 const typename Set::key_type& key) {
37693773 if (set.is_soo ()) return 0 ;
37703774 size_t num_probes = 0 ;
3771- const size_t hash = set.hash_ref () (key);
3775+ const size_t hash = set.hash_of (key);
37723776 auto seq = probe (set.common (), hash);
37733777 const h2_t h2 = H2 (hash);
37743778 const ctrl_t * ctrl = set.control ();
0 commit comments