Guaranteed copy elision

Jonathan Wakely jwakely.gcc@gmail.com
Mon Nov 21 14:20:06 GMT 2022


On Mon, 21 Nov 2022 at 14:17, Yubin Ruan wrote:
> It seems that currently the only way to guarantee  efficiency is to use move instead.

The move will happen automatically. All you need to do is have an
efficient move constructor, the compiler does the rest.

You do not need to say 'return std::move(local1);' because that
happens automatically.


More information about the Gcc-help mailing list