C++ Logo

std-proposals

Advanced search

Re: Add vector/string resize functions that don't initialize any new storage

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Wed, 23 Dec 2020 13:15:49 +0200
On Wed, 23 Dec 2020 at 13:05, Nathan James via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
> In P1020R1 and subsequently adjusted in P1973R1, we were granted the
> ability to create smart pointers that don't perform initialization on
> types that are trivially default construbible. This results in slightly
> better performance if you plan to initialize the storage afterwards.
>
> It would be nice if this behaviour could be extended to vector and
> basic_string. Following the convention used in P1973R1, I'd suggest:
>
> > void vector::resize_for_overwrite(size_type count);
> > void basic_string::resize_for_overwrite(size_type count);

See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1072r5.html

Yeah, correct, the _overwrite is probably the more likely suffix for
it, but that proposal is on its way,
it was last reviewed by LEWG a month ago. (Yes, I know this proposal
doesn't cover vector any more.)

Received on 2020-12-23 05:16:11