Refactor uses-allocator construction
commit7850264f749803122d04d5d09d4644f0e9d38492
authorredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 15 Aug 2018 19:20:02 +0000 (15 19:20 +0000)
committerredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 15 Aug 2018 19:20:02 +0000 (15 19:20 +0000)
tree5014786303603f6b806ed4b037cd19d751a09ec9
parentb7bb52644cb759ef9c6433d216dd54d62fe77248
Refactor uses-allocator construction

Remove duplicated logic in experimental::pmr::polymorphic_allocator by
calling the __uses_allocator_construct helper.

Fix bugs in std::pmr::polymorphic_allocator with incorrect SFINAE
constraint and incorrect argument order.

* include/bits/uses_allocator.h (__uses_allocator_construct): Qualify
calls to __uses_allocator_construct_impl and __use_alloc.
* include/experimental/memory_resource
(polymorphic_allocator::_M_construct): Remove.
(polymorphic_allocator::construct): Call __uses_allocator_construct.
Qualify calls to __use_alloc.
* include/std/memory_resource (polymorphic_allocator::construct): Fix
type in SFINAE constraint. Use constexpr if instead of tag dispatching
to _S_construct overloads.
(polymorphic_allocator::construct(pair<T1, T2>*, ...)): Fix order of
arguments to _S_construct_p.
(polymorphic_allocator::_S_construct): Remove.
(polymorphic_allocator::_S_construct_p): Return allocators by value
not by reference.
* include/std/scoped_allocator (scoped_allocator_adaptor::construct):
Qualify calls to __use_alloc.
* testsuite/20_util/polymorphic_allocator/construct_pair.cc: New test,
copied from testsuite/20_util/scoped_allocator/construct_pair.cc.
* testsuite/experimental/polymorphic_allocator/1.cc: New test.
* testsuite/experimental/polymorphic_allocator/construct_pair.cc:
New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@263566 138bc75d-0d04-0410-961f-82ee72b054a4
libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/uses_allocator.h
libstdc++-v3/include/experimental/memory_resource
libstdc++-v3/include/std/memory_resource
libstdc++-v3/include/std/scoped_allocator
libstdc++-v3/testsuite/20_util/polymorphic_allocator/construct_pair.cc [new file with mode: 0644]
libstdc++-v3/testsuite/experimental/polymorphic_allocator/1.cc [new file with mode: 0644]
libstdc++-v3/testsuite/experimental/polymorphic_allocator/construct_pair.cc [new file with mode: 0644]