aboutsummaryrefslogtreecommitdiff
path: root/absl/container/internal/raw_hash_set.h
diff options
context:
space:
mode:
authorEvan Brown <ezb@google.com>2024-03-13 11:59:30 -0700
committerCopybara-Service <copybara-worker@google.com>2024-03-13 12:00:20 -0700
commitc6ed744ea531edf745b55c4e5679d7e435406c0d (patch)
tree22774d73af93958b296fd1634f2577329e9f7a92 /absl/container/internal/raw_hash_set.h
parente4b07ec1fc6885eca8a1d8d2439a6554b4a81378 (diff)
downloadabseil-c6ed744ea531edf745b55c4e5679d7e435406c0d.tar.gz
abseil-c6ed744ea531edf745b55c4e5679d7e435406c0d.tar.bz2
abseil-c6ed744ea531edf745b55c4e5679d7e435406c0d.zip
Roll back extern template instatiations in swisstable due to binary size increases in shared libraries.
PiperOrigin-RevId: 615497725 Change-Id: Ic29db8923ea4ea7cd0b01b396896fa9fff8c74b0
Diffstat (limited to 'absl/container/internal/raw_hash_set.h')
-rw-r--r--absl/container/internal/raw_hash_set.h32
1 files changed, 7 insertions, 25 deletions
diff --git a/absl/container/internal/raw_hash_set.h b/absl/container/internal/raw_hash_set.h
index 575491c7..258458b0 100644
--- a/absl/container/internal/raw_hash_set.h
+++ b/absl/container/internal/raw_hash_set.h
@@ -1839,7 +1839,7 @@ class HashSetResizeHelper {
// Reads `capacity` and updates all other fields based on the result of
// the allocation.
//
- // It also may do the following actions:
+ // It also may do the folowing actions:
// 1. initialize control bytes
// 2. initialize slots
// 3. deallocate old slots.
@@ -2204,14 +2204,9 @@ class raw_hash_set {
bool is_soo() const { return fits_in_soo(capacity()); }
bool is_full_soo() const { return is_soo() && !empty(); }
- // Give an early error when key_type is not hashable/eq. Definitions are
- // provided because otherwise explicit template instantiation fails on MSVC.
- auto KeyTypeCanBeHashed(const Hash& h, const key_type& k) -> decltype(h(k)) {
- ABSL_UNREACHABLE();
- }
- auto KeyTypeCanBeEq(const Eq& eq, const key_type& k) -> decltype(eq(k, k)) {
- ABSL_UNREACHABLE();
- }
+ // Give an early error when key_type is not hashable/eq.
+ auto KeyTypeCanBeHashed(const Hash& h, const key_type& k) -> decltype(h(k));
+ auto KeyTypeCanBeEq(const Eq& eq, const key_type& k) -> decltype(eq(k, k));
using AllocTraits = absl::allocator_traits<allocator_type>;
using SlotAlloc = typename absl::allocator_traits<
@@ -2400,18 +2395,7 @@ class raw_hash_set {
const_iterator operator++(int) { return inner_++; }
friend bool operator==(const const_iterator& a, const const_iterator& b) {
- // Suppress erroneous uninitialized memory errors on GCC. This seems to be
- // because the slot pointer in the inner_ iterator is uninitialized, even
- // though that pointer is not used when uninitialized.
- // Similar bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112637.
-#if !defined(__clang__) && defined(__GNUC__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
-#endif
return a.inner_ == b.inner_;
-#if !defined(__clang__) && defined(__GNUC__)
-#pragma GCC diagnostic pop
-#endif
}
friend bool operator!=(const const_iterator& a, const const_iterator& b) {
return !(a == b);
@@ -3735,9 +3719,7 @@ class raw_hash_set {
return const_cast<raw_hash_set*>(this)->iterator_at(i);
}
- reference unchecked_deref(iterator it) {
- return const_cast<reference>(it.unchecked_deref());
- }
+ reference unchecked_deref(iterator it) { return it.unchecked_deref(); }
private:
friend struct RawHashSetTestOnlyAccess;
@@ -3787,13 +3769,13 @@ class raw_hash_set {
return static_cast<slot_type*>(common().soo_data());
}
const slot_type* soo_slot() const {
- return const_cast<raw_hash_set*>(this)->soo_slot();
+ return reinterpret_cast<raw_hash_set*>(this)->soo_slot();
}
iterator soo_iterator() {
return {SooControl(), soo_slot(), common().generation_ptr()};
}
const_iterator soo_iterator() const {
- return const_cast<raw_hash_set*>(this)->soo_iterator();
+ return reinterpret_cast<raw_hash_set*>(this)->soo_iterator();
}
HashtablezInfoHandle infoz() {
assert(!is_soo());