public inbox for libstdc++-cvs@sourceware.org help / color / mirror / Atom feed
From: Aldy Hernandez <aldyh@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc/devel/ranger] libstdc++: uninitialized_construct_using_allocator should use construct_at (LWG 3321) Date: Wed, 17 Jun 2020 19:01:05 +0000 (GMT) [thread overview] Message-ID: <20200617190105.4490D3948A6C@sourceware.org> (raw) https://gcc.gnu.org/g:5f3641d0c430523d839298a6876f907523811485 commit 5f3641d0c430523d839298a6876f907523811485 Author: Jonathan Wakely <jwakely@redhat.com> Date: Wed Feb 19 12:14:54 2020 +0000 libstdc++: uninitialized_construct_using_allocator should use construct_at (LWG 3321) * include/std/memory (uninitialized_construct_using_allocator): Use std::construct_at (LWG 3321). Diff: --- libstdc++-v3/ChangeLog | 3 +++ libstdc++-v3/include/std/memory | 7 ++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index eb83c632adc..5408a89c7fb 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,8 @@ 2020-02-19 Jonathan Wakely <jwakely@redhat.com> + * include/std/memory (uninitialized_construct_using_allocator): Use + std::construct_at (LWG 3321). + * include/std/memory_resource (polymorphic_allocator::allocate_bytes) (polymorphic_allocator::allocate_object) (polymorphic_allocator::new_object): Add nodiscard attribute (LWG3304). diff --git a/libstdc++-v3/include/std/memory b/libstdc++-v3/include/std/memory index 14aedb70dac..aaee6e42c1a 100644 --- a/libstdc++-v3/include/std/memory +++ b/libstdc++-v3/include/std/memory @@ -387,9 +387,10 @@ get_pointer_safety() noexcept { return pointer_safety::relaxed; } uninitialized_construct_using_allocator(_Tp* __p, const _Alloc& __a, _Args&&... __args) { - void* __vp = const_cast<void*>(static_cast<const volatile void*>(__p)); - return ::new(__vp) _Tp(std::make_obj_using_allocator<_Tp>(__a, - std::forward<_Args>(__args)...)); + return std::apply([&](auto&&... __xs) { + return std::construct_at(__p, std::forward<decltype(__xs)>(__xs)...); + }, std::uses_allocator_construction_args<_Tp>(__a, + std::forward<_Args>(__args)...)); } // @}
reply other threads:[~2020-06-17 19:01 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20200617190105.4490D3948A6C@sourceware.org \ --to=aldyh@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ --cc=libstdc++-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).