The initial proposal in this thread appears to be the "destructor-like syntax" mentioned by Denis Bider in P0023 "Relocator: Efficiently moving objects"[1]. I think the arguments in that paper against the syntax are still applicable:

  This would operate very similarly to the current proposal, but with the possibly unintuitive difference that the new object is being passed as the parameter, so that e.g. ~c(x.c) initializes x.c with the value of c. Furthermore, it would require re-inventing syntax to allow for move construction of subobjects.  

I think it's unfortunate that more recent proposals (P1029, P1144) have moved away from making destructive move a customization point; it should be entirely possible to square the circle and have efficient relocation (en bloc memcpy for vector, e.g.) along with user controlled relocate where necessary. My proposal would be for a new type of constructor, taking a tag type so as not to require any new syntax, that could be defaulted to attest that a class is trivially relocatable on condition all its subobjects are:

A(std::relocates, A* ptr) : member(std::relocate(&c->member)) ... { /* fixup */ }
B(std::relocates, B*) = default;


On Thu, Feb 11, 2021 at 11:06 AM Marcin Jaczewski via Std-Discussion <> wrote:
śr., 10 lut 2021 o 23:03 Thiago Macieira via Std-Discussion
<> napisał(a):
> On Wednesday, 10 February 2021 13:52:07 PST Maciej Polanski via Std-Discussion
> wrote:
> > 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 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
and deallocation).
Std-Discussion mailing list