diff --git a/absl/container/internal/raw_hash_set.h b/absl/container/internal/raw_hash_set.h index 205450a0..1cb336e9 100644 --- a/absl/container/internal/raw_hash_set.h +++ b/absl/container/internal/raw_hash_set.h @@ -2082,6 +2082,18 @@ class raw_hash_set { } } + // An equality check which skips ABSL Hardening iterator invalidation + // checks. + // Should be used when the lifetimes of the iterators are well-enough + // understood to prove that they cannot be invalid. + bool unchecked_equals(const iterator& b) const { + return ctrl_ == b.control(); + } + + // Dereferences the iterator without ABSL Hardening iterator invalidation + // checks. + reference unchecked_deref() const { return PolicyTraits::element(slot_); } + ctrl_t* control() const { return ctrl_; } slot_type* slot() const { return slot_; } @@ -2093,16 +2105,6 @@ class raw_hash_set { union { slot_type* slot_; }; - - // An equality check which skips ABSL Hardening iterator invalidation - // checks. - // Should be used when the lifetimes of the iterators are well-enough - // understood to prove that they cannot be invalid. - bool unchecked_equals(const iterator& b) { return ctrl_ == b.control(); } - - // Dereferences the iterator without ABSL Hardening iterator invalidation - // checks. - reference unchecked_deref() const { return PolicyTraits::element(slot_); } }; class const_iterator { @@ -2143,14 +2145,13 @@ class raw_hash_set { const GenerationType* gen) : inner_(const_cast(ctrl), const_cast(slot), gen) { } + bool unchecked_equals(const const_iterator& b) const { + return inner_.unchecked_equals(b.inner_); + } ctrl_t* control() const { return inner_.control(); } slot_type* slot() const { return inner_.slot(); } iterator inner_; - - bool unchecked_equals(const const_iterator& b) { - return inner_.unchecked_equals(b.inner_); - } }; using node_type = node_handle, Alloc>;