mirror of
https://github.com/abseil/abseil-cpp.git
synced 2026-06-04 20:14:23 +08:00
Refactor: move iterator unchecked_* members before data members to comply with Google C++ style guide.
Also make unchecked_equals members `const`. PiperOrigin-RevId: 781877490 Change-Id: I0bf5018f081a7a26e11fc67f3c344988b44a3ef3
This commit is contained in:
committed by
Copybara-Service
parent
6cd1763d9f
commit
118924e83d
@@ -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_t*>(ctrl), const_cast<slot_type*>(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<Policy, hash_policy_traits<Policy>, Alloc>;
|
||||
|
||||
Reference in New Issue
Block a user