I totally disagree on that this can be an easy and flexible way. But I'd hear what other guys say.
It seems to me that when the new relocating "destructor" is not defaulted, the identity (or the address) of the returned object (i.e. the destination of relocation) ALMOST ALWAYS needs to be known in the function body. So it'll be simpler, at least to me, to
invent a new way to directly refer to the destination object, instead of finding how to guarantee NRVO.
Thanks,
F.v.S.
From: Std-Proposals <std-proposals-bounces@lists.isocpp.org> on behalf of §õ ¬î¶h via Std-Proposals <std-proposals@lists.isocpp.org>
Sent: Saturday, June 29, 2024 0:31
To: std-proposals@lists.isocpp.org <std-proposals@lists.isocpp.org>
Cc: §õ ¬î¶h <QiuyiLi1023@outlook.com>
Subject: [std-proposals] Relocating destructor and operator reloc
The core idea is introduce a new destructor T ~T(int), and with the help of RVO/NRVO to relocate an object from one address to the address of the return value.