C++ Logo

std-proposals

Advanced search

Re: Re P0889

From: Antony Polukhin <antoshkka_at_[hidden]>
Date: Fri, 13 Mar 2020 11:00:50 +0300
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.

>

Received on 2020-03-13 03:05:06