[libcxx-commits] [PATCH] D97742: [C++23] [P1518R2] Better CTAD behavior for containers with allocators
Arthur O'Dwyer via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Mar 1 16:05:43 PST 2021
Quuxplusone created this revision.
Quuxplusone added reviewers: zoecarver, ldionne.
Quuxplusone added a project: libc++.
Quuxplusone requested review of this revision.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.
P1518 <https://reviews.llvm.org/P1518> does the following in C++23 but we'll just do it in C++17 as well:
- Stop requiring `Alloc` to be an allocator on some container-adaptor deduction guides
- Stop deducing from `Allocator` on some sequence container constructors
- Stop deducing from `Allocator` on some other container constructors (libc++ already did this)
The affected constructors are the "allocator-extended" versions of constructors where the non-allocator arguments are already sufficient to deduce the allocator type. For example,
std::pmr::vector<int> v1;
std::vector v2(v1, std::pmr::new_delete_resource());
std::stack s2(v1, std::pmr::new_delete_resource());
P1518R2 (which will be in the next mailing) was adopted, or at least resolved-to-be-adopted, by LWG the other day.
I'm proposing that libc++ implement these CTAD improvements not only in C++2b mode, but also in all modes (i.e. C++17 and C++20). Anyone who doesn't notice won't mind, and anyone who does notice will thank us. Plus, libc++ already implements a little more than half of P1518R2 in all modes. This patch is just getting us all the way there.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D97742
Files:
libcxx/include/deque
libcxx/include/forward_list
libcxx/include/list
libcxx/include/queue
libcxx/include/stack
libcxx/include/vector
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/deduct.pass.cpp
libcxx/test/std/containers/container.adaptors/queue/queue.cons/deduct.pass.cpp
libcxx/test/std/containers/container.adaptors/stack/stack.cons/deduct.pass.cpp
libcxx/test/std/containers/sequences/deque/deque.cons/deduct.pass.cpp
libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/deduct.pass.cpp
libcxx/test/std/containers/sequences/list/list.cons/deduct.pass.cpp
libcxx/test/std/containers/sequences/vector/vector.cons/deduct.pass.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97742.327309.patch
Type: text/x-patch
Size: 27203 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210302/bc604d97/attachment-0001.bin>
More information about the libcxx-commits
mailing list