C++ Logo


Advanced search

Subject: Re: [std-proposals] Re P0889
From: Antony Polukhin (antoshkka_at_[hidden])
Date: 2020-03-13 03:00:50

On Fri, Mar 13, 2020, 01:07 Maciej Cencora <m.cencora_at_[hidden]> wrote:

> Ultimate copy ellision, should relax rules of copy elision so that any
> copy/moves of constructor arguments into object members/bases is allowed as
> well.
> So that the most simple constructor definition is always optimal:
> struct Foo
> {
> Foo(Bar1 a, Bar2 b)
> : a(a), b(b)
> {}
> Bar1 a;
> Bar2 b;
> };
> Regards,
> Maciej

P0889 does not give you strong guarantees on elision. It just allows the
compilers to do optimizations, but does not require them.

So if you have cases where copying makes no sense at all then you should
write a separate paper to require elisions in those cases.


STD-PROPOSALS list run by herb.sutter at gmail.com

Standard Proposals Archives on Google Groups