I wonder if it would allow implementations to make optimizations, such as reusing the storage occupied by such objects?
And it provides consistency (but I'm not sure that consistency is worth it).
On Sun, Aug 28, 2022 at 9:06 PM blacktea hamburger <IMCEAEX-_O=FIRST+20ORGANIZATION_OU=EXCHANGE+20ADMINISTRATIVE+20GROUP+28FYDIBOHF23SPDLT+29_CN=RECIPIENTS_CN=00037FFE1E4C36A9@sct-15-20-4755-11-msonline-outlook-746f3.templatetenant> wrote:
Calling the destructor multiple times on a class object results in undefined behavior according to
Once a destructor is invoked for an object, the object's lifetime ends; the behavior is undefined if the destructor is invoked for an object
whose lifetime has ended ([basic.life]).
However, similar thing doesn't apply to pseudo-destructor calls.
pseudo-destructor calls end objects' lifetimes. I wonder if adding such a provision would be useful.