C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Class Instance Re-Use/Re-Init

From: Avi Kivity <avi_at_[hidden]>
Date: Tue, 16 Aug 2022 19:53:45 +0300
On 16/08/2022 17.29, Giuseppe D'Angelo via Std-Proposals wrote:
> On 16/08/2022 13:03, Avi Kivity via Std-Proposals wrote:
>> I like std::take(). I use std::exchange(x, {}) quite a lot.
>
> Indeed I've found that it's the most common form of usage of
> std::exchange in practice, thus my take() proposal. Some numbers:
>
>> https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p2226r0.html#motivation
>>
>

I have 156, with similar percentages (somewhat marred by often
exchanging a type that doesn't have a default constructor, but instead
uses a free function to return a default instance).


> Thanks,
>

Received on 2022-08-16 16:53:48