C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Relocation in C++

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Wed, 2 Mar 2022 13:19:49 +0200
On Wed, 2 Mar 2022 at 13:15, Maciej Cencora <m.cencora_at_[hidden]> wrote:
>
> You may assume whatever you want, but behaviour of your program may
> change depending on consume impl (because managed resource will be
> destroyed at different times).
> And without language level move/relocate, the only way to workaround
> this problem is to x = {}, after the consume call - but that requires
> default constructiblity which may not be possible/may be costly.

Yay, more lofty declarations how relocation is the _only way_ to solve
this problem. If I need
relocation to solve this problem, I have a much bigger problem, where
code I call doesn't do what
it advertises to do in its interfaces, and relocation is not going to
solve a problem as significant
as that on that level. It's a performance tool, but I guess you're
suggesting that it should be a correctness
tool as well. Just out of curiosity, is that borrowing a page from the
book of Rust?

Received on 2022-03-02 11:20:01