Commit c28f689c by Evan Brown Committed by Copybara-Service

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
parent 1449add2
...@@ -2849,8 +2849,7 @@ class raw_hash_set { ...@@ -2849,8 +2849,7 @@ class raw_hash_set {
template <class K = key_type> template <class K = key_type>
const_iterator find(const key_arg<K>& key) const const_iterator find(const key_arg<K>& key) const
ABSL_ATTRIBUTE_LIFETIME_BOUND { ABSL_ATTRIBUTE_LIFETIME_BOUND {
prefetch_heap_block(); return const_cast<raw_hash_set*>(this)->find(key);
return find(key, hash_ref()(key));
} }
template <class K = key_type> template <class K = key_type>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment