[libcxx-commits] [libcxx] [libc++] Replace `__compressed_pair` with `[[no_unique_address]]` (PR #76756)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Jan 25 09:23:53 PST 2024
================
@@ -37,49 +37,77 @@ class small_iter_allocator {
friend bool operator!=(small_iter_allocator, small_iter_allocator) { return false; }
};
+template <class T>
+class final_small_iter_allocator final {
+public:
+ using value_type = T;
+ using pointer = small_pointer<T>;
+ using size_type = std::int16_t;
+ using difference_type = std::int16_t;
+
+ final_small_iter_allocator() TEST_NOEXCEPT {}
+
+ template <class U>
+ final_small_iter_allocator(final_small_iter_allocator<U>) TEST_NOEXCEPT {}
+
+ T* allocate(std::size_t n);
+ void deallocate(T* p, std::size_t);
+
+ friend bool operator==(final_small_iter_allocator, final_small_iter_allocator) { return true; }
+ friend bool operator!=(final_small_iter_allocator, final_small_iter_allocator) { return false; }
+};
+
#if __SIZE_WIDTH__ == 64
static_assert(sizeof(std::deque<int>) == 48, "");
static_assert(sizeof(std::deque<int, min_allocator<int> >) == 48, "");
static_assert(sizeof(std::deque<int, test_allocator<int> >) == 80, "");
static_assert(sizeof(std::deque<int, small_iter_allocator<int> >) == 12, "");
+static_assert(sizeof(std::deque<int, final_small_iter_allocator<int> >) == 16, "");
----------------
ldionne wrote:
I think it would be better to land these test changes in a patch first, and then this patch could show that it doesn't change any of the current behavior (except the noted corner-case).
https://github.com/llvm/llvm-project/pull/76756
More information about the libcxx-commits
mailing list