Skip to content

Commit dc1ec89

Browse files
ezbrcopybara-github
authored andcommitted
Make raw_hash_set::slot_type private.
PiperOrigin-RevId: 728847810 Change-Id: I76c5e0ca079a0544faca001aac2b2390e26bfd5b
1 parent 14cfd97 commit dc1ec89

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

absl/container/internal/raw_hash_set.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2277,9 +2277,6 @@ class raw_hash_set {
22772277
public:
22782278
using init_type = typename PolicyTraits::init_type;
22792279
using key_type = typename PolicyTraits::key_type;
2280-
// TODO(sbenza): Hide slot_type as it is an implementation detail. Needs user
2281-
// code fixes!
2282-
using slot_type = typename PolicyTraits::slot_type;
22832280
using allocator_type = Alloc;
22842281
using size_type = size_t;
22852282
using difference_type = ptrdiff_t;
@@ -2302,6 +2299,8 @@ class raw_hash_set {
23022299
template <class K>
23032300
using key_arg = typename KeyArgImpl::template type<K, key_type>;
23042301

2302+
using slot_type = typename PolicyTraits::slot_type;
2303+
23052304
// TODO(b/289225379): we could add extra SOO space inside raw_hash_set
23062305
// after CommonFields to allow inlining larger slot_types (e.g. std::string),
23072306
// but it's a bit complicated if we want to support incomplete mapped_type in

absl/container/internal/raw_hash_set_test.cc

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,8 @@ using TransferableIntTable = ValueTable<int64_t, /*kTransferable=*/true>;
747747

748748
constexpr size_t kNonSooSize = sizeof(HeapOrSoo) + 8;
749749
static_assert(sizeof(SizedValue<kNonSooSize>) >= kNonSooSize, "too small");
750-
using NonSooIntTable = ValueTable<SizedValue<kNonSooSize>>;
750+
using NonSooIntTableSlotType = SizedValue<kNonSooSize>;
751+
using NonSooIntTable = ValueTable<NonSooIntTableSlotType>;
751752
using SooIntTable = ValueTable<int64_t, /*kTransferable=*/true, /*kSoo=*/true>;
752753

753754
template <typename T>
@@ -3574,7 +3575,7 @@ TEST(Table, CountedHash) {
35743575
// IterateOverFullSlots doesn't support SOO.
35753576
TEST(Table, IterateOverFullSlotsEmpty) {
35763577
NonSooIntTable t;
3577-
using SlotType = typename NonSooIntTable::slot_type;
3578+
using SlotType = NonSooIntTableSlotType;
35783579
auto fail_if_any = [](const ctrl_t*, void* i) {
35793580
FAIL() << "expected no slots " << **static_cast<SlotType*>(i);
35803581
};
@@ -3589,7 +3590,7 @@ TEST(Table, IterateOverFullSlotsEmpty) {
35893590

35903591
TEST(Table, IterateOverFullSlotsFull) {
35913592
NonSooIntTable t;
3592-
using SlotType = typename NonSooIntTable::slot_type;
3593+
using SlotType = NonSooIntTableSlotType;
35933594

35943595
std::vector<int64_t> expected_slots;
35953596
for (int64_t idx = 0; idx < 128; ++idx) {
@@ -3619,7 +3620,7 @@ TEST(Table, IterateOverFullSlotsDeathOnRemoval) {
36193620
if (reserve_size == -1) reserve_size = size;
36203621
for (int64_t idx = 0; idx < size; ++idx) {
36213622
NonSooIntTable t;
3622-
using SlotType = typename NonSooIntTable::slot_type;
3623+
using SlotType = NonSooIntTableSlotType;
36233624
t.reserve(static_cast<size_t>(reserve_size));
36243625
for (int val = 0; val <= idx; ++val) {
36253626
t.insert(val);
@@ -3654,7 +3655,7 @@ TEST(Table, IterateOverFullSlotsDeathOnInsert) {
36543655
int64_t size = reserve_size / size_divisor;
36553656
for (int64_t idx = 1; idx <= size; ++idx) {
36563657
NonSooIntTable t;
3657-
using SlotType = typename NonSooIntTable::slot_type;
3658+
using SlotType = NonSooIntTableSlotType;
36583659
t.reserve(static_cast<size_t>(reserve_size));
36593660
for (int val = 1; val <= idx; ++val) {
36603661
t.insert(val);

0 commit comments

Comments
 (0)