From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 46328 invoked by alias); 25 Jan 2017 18:39:10 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 46313 invoked by uid 89); 25 Jan 2017 18:39:08 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.2 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_SOFTFAIL autolearn=no version=3.3.2 spammy=HX-PHP-Originating-Script:rcube.php, H*u:1.2.3, H*UA:1.2.3, H*f:sk:0a004b5 X-HELO: simark.ca Received: from simark.ca (HELO simark.ca) (158.69.221.121) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 25 Jan 2017 18:39:06 +0000 Received: by simark.ca (Postfix, from userid 33) id 9508F1E163; Wed, 25 Jan 2017 13:39:04 -0500 (EST) To: Pedro Alves Subject: Re: [PATCH v2 5/5] Eliminate make_cleanup_ui_file_delete / make ui_file a class hierarchy X-PHP-Originating-Script: 33:rcube.php MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 25 Jan 2017 18:39:00 -0000 From: Simon Marchi Cc: gdb-patches@sourceware.org In-Reply-To: <0a004b52-a388-e7ec-fe3e-ccac3e31f7b2@redhat.com> References: <1484617147-2506-1-git-send-email-palves@redhat.com> <1484617147-2506-6-git-send-email-palves@redhat.com> <5533317a1fdb2e5f36e64731aef84993@polymtl.ca> <4a6cce94-1533-36e9-6015-330e2e014a98@redhat.com> <558e1e55-23eb-716e-8117-c18d7bded7b8@redhat.com> <91ab941736dd82a711868ea56651c20d@polymtl.ca> <0a004b52-a388-e7ec-fe3e-ccac3e31f7b2@redhat.com> Message-ID: <8cee3d1e0a4219a8eeaacf07a8841f5b@polymtl.ca> X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.2.3 X-IsSubscribed: yes X-SW-Source: 2017-01/txt/msg00551.txt.bz2 On 2017-01-25 13:28, Pedro Alves wrote: >> If it had been "to std::move the string contents out..." it might have >> been a bit clearer, I'm not entirely sure. > > That would read a bit odd to me, since "std::move" itself > does nothing, it's just a cast. I think it's obvious that if you're going to use std::move, it's to move the value somewhere, not just "std::move (buf);" by itself. But if you want to go with the more explicit comment below, it's fine with me. It shows the use case more clearly. > Maybe it'll be clearer with > an example? Something like: > > /* Accesses the std::string containing the entire output collected > - so far. Returns a non-const reference so that it's easy to move > - the string contents out of the string_file. */ > + so far. > + > + Returns a non-const reference so that it's easy to move the > + string contents out of the string_file. E.g.: > + > + string_file buf; > + buf.printf (...."); > + buf.printf (...."); > + return std::move (buf.string ()); > + */ > std::string &string () { return m_string; }