C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Making contiguous objects

From: Arthur O'Dwyer <arthur.j.odwyer_at_[hidden]>
Date: Sun, 12 Mar 2023 15:05:00 -0400
On Sun, Mar 12, 2023 at 2:50 PM Breno GuimarĂ£es <brenorg_at_[hidden]> wrote:

> > All our use-cases so far are use-cases for the
> allocating-but-not-constructing entrypoint.
>
> Even on std::make_shared<std::string[]>(10) ? That is a case of allocating
> and constructing.
>

That default-constructs the 10 string objects, true. But it *doesn't*
default-construct the 1 _ControlBlock object that precedes them:
https://github.com/llvm/llvm-project/blob/2f887c9a760dfdffa584ce84361912fe122ad79f/libcxx/include/__memory/shared_ptr.h#L1147-L1148
So an entrypoint that default-constructs all Ns... of the Ts... isn't
helpful to this use-case.

–Arthur

>

Received on 2023-03-12 19:05:13