Title
std::allocator<void>().allocate(n)
Status
c++20
Section
[default.allocator]
Submitter
Jonathan Wakely

Created on 2019-10-25.00:00:00 last changed 46 months ago

Messages

Date: 2019-11-04.13:23:43

Proposed resolution:

This wording is relative to N4835.

  1. Modify [allocator.members] as indicated:

    [[nodiscard]] constexpr T* allocate(size_t n);
    

    -?- Mandates: T is not an incomplete type ([basic.types]).

    -2- Returns: A pointer to the initial element of an array of storage of size n * sizeof(T), aligned appropriately for objects of type T.

    […]

Date: 2019-11-04.13:23:43

[ 2019-11 Status to 'Ready' in Monday issue prioritization in Belfast ]

Date: 2019-10-25.00:00:00

In C++20 the std::allocator<void> explicit specialization is gone, which means it uses the primary template, which has allocate and deallocate members.

Although it's implied by the use of sizeof(T), std::allocator<T>::allocate doesn't have an explicit precondition that the value type is complete.

History
Date User Action Args
2021-02-25 10:48:01adminsetstatus: wp -> c++20
2020-02-24 16:02:59adminsetstatus: voting -> wp
2020-01-17 04:54:50adminsetstatus: ready -> voting
2019-11-04 13:23:43adminsetmessages: + msg10727
2019-11-04 13:23:43adminsetstatus: new -> ready
2019-10-31 19:05:20adminsetmessages: + msg10717
2019-10-25 00:00:00admincreate