Subject: Re: DestructorConstructor - a class destructor with parameter
From: Marcin Jaczewski (marcinjaczewski86_at_[hidden])
Date: 2021-02-11 05:06:19
År., 10 lut 2021 o 23:03 Thiago Macieira via Std-Discussion
> On Wednesday, 10 February 2021 13:52:07 PST Maciej Polanski via Std-Discussion
> > I would like to present a (revolutionary?) concept of
> > "DestructorConstructor", a class destructor with parameter -
> > uninitialized object. Such destructor and constructor in one, while
> > destructing its (own) object, moves data to new (parameter) object with
> > cost of "C" styled "memcpy".
> > I've been thinking about this concept for some time. I have trouble
> > completing it, but I think it is sufficiently valuable to present it to
> > community... even if only to be shown I am a moron
> See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4034.pdf and
> other proposals for "destructive move".
My favorite is:
It make effecitve "destructive move" using AS-IF rule becasue moved
out object dectructor is noop.
In case of vector you can simply `memcpy` data and only deallocate old memory
(same effect as value init all old memory and then calling destructor
STD-DISCUSSION list run by email@example.com
Older Archives on Google Groups