aboutsummaryrefslogtreecommitdiff
path: root/absl/container/internal/raw_hash_set_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'absl/container/internal/raw_hash_set_test.cc')
-rw-r--r--absl/container/internal/raw_hash_set_test.cc29
1 files changed, 1 insertions, 28 deletions
diff --git a/absl/container/internal/raw_hash_set_test.cc b/absl/container/internal/raw_hash_set_test.cc
index 55c6f62e..7588120a 100644
--- a/absl/container/internal/raw_hash_set_test.cc
+++ b/absl/container/internal/raw_hash_set_test.cc
@@ -48,6 +48,7 @@
#include "absl/container/internal/hash_function_defaults.h"
#include "absl/container/internal/hash_policy_testing.h"
#include "absl/container/internal/hashtable_debug.h"
+#include "absl/container/internal/test_allocator.h"
#include "absl/log/log.h"
#include "absl/strings/string_view.h"
@@ -441,34 +442,6 @@ struct CustomAllocIntTable
using Base::Base;
};
-// Tries to allocate memory at the minimum alignment even when the default
-// allocator uses a higher alignment.
-template <typename T>
-struct MinimumAlignmentAlloc : std::allocator<T> {
- MinimumAlignmentAlloc() = default;
-
- template <typename U>
- explicit MinimumAlignmentAlloc(const MinimumAlignmentAlloc<U>& /*other*/) {}
-
- template <class U>
- struct rebind {
- using other = MinimumAlignmentAlloc<U>;
- };
-
- T* allocate(size_t n) {
- T* ptr = std::allocator<T>::allocate(n + 1);
- char* cptr = reinterpret_cast<char*>(ptr);
- cptr += alignof(T);
- return reinterpret_cast<T*>(cptr);
- }
-
- void deallocate(T* ptr, size_t n) {
- char* cptr = reinterpret_cast<char*>(ptr);
- cptr -= alignof(T);
- std::allocator<T>::deallocate(reinterpret_cast<T*>(cptr), n + 1);
- }
-};
-
struct MinimumAlignmentUint8Table
: raw_hash_set<Uint8Policy, container_internal::hash_default_hash<uint8_t>,
std::equal_to<uint8_t>, MinimumAlignmentAlloc<uint8_t>> {