Guaranteed copy elision
Stefan Ring
stefanrin@gmail.com
Fri Nov 18 15:05:33 GMT 2022
On Tue, Nov 15, 2022 at 6:48 AM Yubin Ruan via Gcc-help
<gcc-help@gcc.gnu.org> wrote:
>
> To be sure that a object would not be copied, we usually write something
> like
>
> SomeBigObject obj;
> func(&obj);
>
> while in most of the cases a one-liner like
>
> SomeBigObject obj = func();
>
> would suffice.
>
> Is there any language facility to help us guarantee that at compile time
> (such as some kind of static_assert() ) so that we can be confident writing
> those one-liner ?
Interesting question, but unfortunately I do not have a good answer! I
can only bump the thread. ;)
More information about the Gcc-help
mailing list