C++ Logo

std-proposals

Advanced search

Re: [std-proposals] PR: std::allocator<T>::allocate is not freestanding

From: Jens Maurer <jens.maurer_at_[hidden]>
Date: Sun, 3 Sep 2023 00:00:39 +0200
On 02/09/2023 23.36, Jason McKesson via Std-Proposals wrote:
> On Sat, Sep 2, 2023 at 3:22 PM trtaab trtaab via Std-Proposals
> <std-proposals_at_[hidden]> wrote:
>>
>> Currently there is no way to allocate memory at constexpr context in freestanding environment. This desperately needs a fix.
>>
>>
>>
>> N4958 does not mark std::allocator<T> as freestanding so there is no way to allocate memory in freestanding.
>>

> The ability to allocate memory at compile-time requires language
> support. As such, *requiring* all freestanding implementations to
> support it is a rather big ask.

In general, the "freestanding" subset of C++ is a library subset
to accommodate environments where an operating system might not
be available, or that are otherwise constrained. For example,
std::cout will probably never be part of freestanding
(because e.g. a fridge does not have that).

The language, however, needs to be supported by freestanding
implementations in its entirety, and that includes full
support for constant evaluation.

Jens

Received on 2023-09-02 22:00:44