public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely.gcc@gmail.com>
To: Yubin Ruan <ablacktshirt@gmail.com>
Cc: gcc-help <gcc-help@gcc.gnu.org>
Subject: Re: Guaranteed copy elision
Date: Mon, 21 Nov 2022 14:20:06 +0000	[thread overview]
Message-ID: <CAH6eHdQbTwSvmxoTC21NMokBupMBDQdx6hwpuyZ3P+HR83RSpQ@mail.gmail.com> (raw)
In-Reply-To: <CAJYFCiOtHWYRKMGtMka=vidM+jbq03nURXyuPQ4VNAw-vhPH1Q@mail.gmail.com>

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.

      reply	other threads:[~2022-11-21 14:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-15  5:47 Yubin Ruan
2022-11-18 15:05 ` Stefan Ring
2022-11-18 21:35   ` Martin Oberzalek
2022-11-18 21:58     ` Segher Boessenkool
2022-11-19 10:07       ` Jonathan Wakely
2022-11-19 10:12 ` Jonathan Wakely
2022-11-21 14:17   ` Yubin Ruan
2022-11-21 14:20     ` Jonathan Wakely [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAH6eHdQbTwSvmxoTC21NMokBupMBDQdx6hwpuyZ3P+HR83RSpQ@mail.gmail.com \
    --to=jwakely.gcc@gmail.com \
    --cc=ablacktshirt@gmail.com \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).