This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++20 status.
constexpr and noexceptSection: 20.2.8.2 [allocator.uses.construction] Status: C++20 Submitter: Pablo Halpern Opened: 2019-01-29 Last modified: 2021-02-25
Priority: 0
View all other issues in [allocator.uses.construction].
View all issues with C++20 status.
Discussion:
The uses-allocator construction functions introduced into WP when P0591r4
was accepted (Nov 2018, San Diego) should all be constexpr. All but two should also be noexcept.
Getting this right is an important part of correctly adding constexpr memory allocation into the WP.
constexpr to all of the new functions except
uninitialized_construct_using_allocator and noexcept to all
of the overloads of uses_allocator_construction_args. Optionally, we could consider adding conditional
noexcept to the remaining two functions. If p0784 is accepted,
then also add constexpr to uninitialized_construct_using_allocator.
[2019-02-12 Priority to 0 and Status to Tentatively Ready after six positive votes on the reflector.]
Proposed resolution:
This wording is relative to N4800.
Change header synopsis, 20.2.2 [memory.syn], as indicated:
[…] // 20.2.8.2 [allocator.uses.construction], uses-allocator construction templateconstexpr auto uses_allocator_construction_args(const Alloc& alloc, Args&&... args) noexcept -> see below; template constexpr auto uses_allocator_construction_args(const Alloc& alloc, piecewise_construct_t, Tuple1&& x, Tuple2&& y) noexcept -> see below; template constexpr auto uses_allocator_construction_args(const Alloc& alloc) noexcept -> see below; template constexpr auto uses_allocator_construction_args(const Alloc& alloc, U&& u, V&& v) noexcept -> see below; template constexpr auto uses_allocator_construction_args(const Alloc& alloc, const pair& pr) noexcept -> see below; template constexpr auto uses_allocator_construction_args(const Alloc& alloc, pair&& pr) noexcept -> see below; template constexpr T make_obj_using_allocator(const Alloc& alloc, Args&&... args); template T* uninitialized_construct_using_allocator(T* p, const Alloc& alloc, Args&&... args); […]
Change 20.2.8.2 [allocator.uses.construction] as indicated:
templateconstexpr auto uses_allocator_construction_args(const Alloc& alloc, Args&&... args) noexcept -> see below; […]
templateconstexpr auto uses_allocator_construction_args(const Alloc& alloc, piecewise_construct_t, Tuple1&& x, Tuple2&& y) noexcept -> see below; […]
templateconstexpr auto uses_allocator_construction_args(const Alloc& alloc) noexcept -> see below; […]
templateconstexpr auto uses_allocator_construction_args(const Alloc& alloc, U&& u, V&& v) noexcept -> see below; […]
templateconstexpr auto uses_allocator_construction_args(const Alloc& alloc, const pair& pr) noexcept -> see below; […]
templateconstexpr auto uses_allocator_construction_args(const Alloc& alloc, pair&& pr) noexcept -> see below; […]
templateconstexpr T make_obj_using_allocator(const Alloc& alloc, Args&&... args); […]
templateT* uninitialized_construct_using_allocator(T* p, const Alloc& alloc, Args&&... args); […]