Skip to content

Commit c28f689

Browse files
ezbrcopybara-github
authored andcommitted
Use const_cast to avoid duplicating the implementation of raw_hash_set::find(key).
Motivation: the implementation becomes more complicated with small object optimization. PiperOrigin-RevId: 608742838 Change-Id: I55fc42321b1967f9c7bbee49817a2f2d4ee44b56
1 parent 1449add commit c28f689

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

absl/container/internal/raw_hash_set.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2849,8 +2849,7 @@ class raw_hash_set {
28492849
template <class K = key_type>
28502850
const_iterator find(const key_arg<K>& key) const
28512851
ABSL_ATTRIBUTE_LIFETIME_BOUND {
2852-
prefetch_heap_block();
2853-
return find(key, hash_ref()(key));
2852+
return const_cast<raw_hash_set*>(this)->find(key);
28542853
}
28552854

28562855
template <class K = key_type>

0 commit comments

Comments
 (0)