[libcxx-commits] [PATCH] D132081: [libc++] Remove __deque_base

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Aug 25 09:26:15 PDT 2022


ldionne accepted this revision.
ldionne added a comment.
This revision is now accepted and ready to land.

LGTM with green CI and my comments applied.



================
Comment at: libcxx/include/deque:1045-1047
+  __map __map_;
+  size_type __start_;
+  __compressed_pair<size_type, allocator_type> __size_;
----------------
I had never noticed this, but we have two allocators. One is in the `__compressed_pair` we see right here, and the other one is in the `__map`, which is a `__split_buffer`. This is weird.

I think this means that we can actually be lying when we set the noexcept-ness of `deque()` and friends. I think we should add this:

```
static_assert(is_nothrow_default_constructible<allocator_type>::value == is_nothrow_default_constructible<_SplitBufferAllocator>::value, "");
static_assert(is_nothrow_move_constructible<allocator_type>::value == is_nothrow_move_constructible<_SplitBufferAllocator>::value, "");
// etc...
```

I can't imagine this not being true, however this would provide guard rails and it would nicely document the code.



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132081/new/

https://reviews.llvm.org/D132081



More information about the libcxx-commits mailing list