Subject: Re: DestructorConstructor - a class destructor with parameter
From: Maciej Polanski (maciejpolanski75_at_[hidden])
Date: 2021-02-11 11:25:04
On 2021-02-11 12:06, Marcin Jaczewski via Std-Discussion wrote:
> 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).
Thanks, I didn't know this proposal!
But I do not think it allows me to freely "memcpy", as elison depends on
compiler optimization and I do not know result of it.
It seems that having "bitcopies" constructor does not guarantee empty
destructor, nor lack of side effects of destructing empty object. It had
to be found by compiler during optimization.
Correct me if I am wrong, but if I was a library programmer,Â I wouldn't
be able to find if I am allowed to memcpy of given class or not. Solely
having "bitcopies" constructor is not enough.
STD-DISCUSSION list run by firstname.lastname@example.org
Older Archives on Google Groups