C++ Logo


Advanced search

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

From: Thiago Macieira <thiago_at_[hidden]>
Date: Sun, 14 Aug 2022 10:06:49 -0700
On Sunday, 14 August 2022 09:54:34 PDT Greg McPherran via Std-Proposals wrote:
> I propose a ctor-like re-use/re-init special function that supports
> re-use of objects without any memory operations (new/delete). An analogy
> that I use is the reset() function of unique_ptr. However, my suggestion
> goes beyond that such that this re-use capability is a ctor-like
> once-and-done special function that is not available as a normal
> function - just as the ctor is not available as a normal function once
> the instance has been created.

How is this different from calling the destructor and then using the placement
new on the object?


Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel DCAI Cloud Engineering

Received on 2022-08-14 17:06:52