220 10908 <6A35DB23-8AAC-49C4-9A52-0BB194D38E01@gmail.com> article
Path: news.gmane.org!not-for-mail
From: David Krauss <potswa@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: N4009: return type of erase_if
Date: Wed, 28 May 2014 10:17:19 +0800
Lines: 38
Approved: news@gmane.org
Message-ID: <6A35DB23-8AAC-49C4-9A52-0BB194D38E01@gmail.com>
References: <09b01713-0312-495e-b984-f492307f0f47@isocpp.org> <80B2AD70-C23C-474D-88E9-24B7EA7EE545@gmail.com> <a52faa3c-58f4-4893-b225-990520e7606a@isocpp.org> <EF83EB32-4234-4505-81E2-B7216683ABAF@gmail.com> <bce3ea02-059a-4aa0-ab2a-88d1daa7f377@isocpp.org> <799E7B56-C6B1-4223-84AE-D6BCE0A99FE8@gmail.com> <lm2fdh$s63$1@ger.gmane.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.2\))
Content-Type: text/plain; charset=ISO-8859-1
X-Trace: ger.gmane.org 1401243453 28992 80.91.229.3 (28 May 2014 02:17:33 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Wed, 28 May 2014 02:17:33 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCW25A7E3QCRBNEOSWOAKGQEOSYNU4Q@isocpp.org Wed May 28 04:17:26 2014
Return-path: <std-proposals+bncBCW25A7E3QCRBNEOSWOAKGQEOSYNU4Q@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-qg0-f72.google.com ([209.85.192.72])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCW25A7E3QCRBNEOSWOAKGQEOSYNU4Q@isocpp.org>)
	id 1WpTQk-0001w7-Al
	for gclcip-std-proposals@m.gmane.org; Wed, 28 May 2014 04:17:26 +0200
Original-Received: by mail-qg0-f72.google.com with SMTP id q108sf24800812qgd.3
        for <gclcip-std-proposals@m.gmane.org>; Tue, 27 May 2014 19:17:25 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:mime-version:subject:from:in-reply-to:date
         :message-id:references:to:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:list-post:list-help:list-archive:list-subscribe
         :list-unsubscribe:content-type;
        bh=aUskNCMbvah86Si07iNNagMq+js0wJ91IRnvgaW9Be0=;
        b=IjbH+HAHn3OgG/08SprpSB9L7R733mgh3wczokgQkdoyDUegHfD49/BQp9G2zxnOf4
         CfX7YEJnUWAkLRBkeUt/iCKBkFLkFMdD96kSrJ/LJS5UR/FokdLLU4weWtWAPZDqtea7
         GzlexdgANTlQVX/7QgSmNy24dRXeosQlbNDbpcbDQhORS84TnzJpGCiffaiNrmKqOHqv
         uERxkxg9OuNG99ebWJy+N2xRTn+5iKSFFbMwCVFJGmNwIPz/hB/gTIyROdiYpvAmWsK7
         urkGdzG6aeHeYhcP2UsA2gbr+v3sIGoDVM0U25zyVVIZ4T6wlsmz8vKaCk9WRdjrB+mG
         /nOQ==
X-Gm-Message-State: ALoCoQnOLD+utAUeZzTaYFpT55i6P+ADalH7QM4WkeC9s5ePKsUNpvpZs5Ef0FVr80rLesnEGCFQ
X-Received: by 10.58.106.75 with SMTP id gs11mr14925071veb.18.1401243445201;
        Tue, 27 May 2014 19:17:25 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.50.79.135 with SMTP id j7ls2476723igx.20.gmail; Tue, 27 May
 2014 19:17:24 -0700 (PDT)
X-Received: by 10.43.138.8 with SMTP id iq8mr33694469icc.37.1401243444397;
        Tue, 27 May 2014 19:17:24 -0700 (PDT)
Original-Received: from mail-ie0-x233.google.com (mail-ie0-x233.google.com [2607:f8b0:4001:c03::233])
        by mx.google.com with ESMTPS id t8si29930235icf.77.2014.05.27.19.17.24
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Tue, 27 May 2014 19:17:24 -0700 (PDT)
Received-SPF: pass (google.com: domain of potswa@gmail.com designates 2607:f8b0:4001:c03::233 as permitted sender) client-ip=2607:f8b0:4001:c03::233;
Original-Received: by mail-ie0-f179.google.com with SMTP id rd18so9692140iec.38
        for <std-proposals@isocpp.org>; Tue, 27 May 2014 19:17:24 -0700 (PDT)
X-Received: by 10.50.114.34 with SMTP id jd2mr31767366igb.35.1401243444168;
        Tue, 27 May 2014 19:17:24 -0700 (PDT)
Original-Received: from [172.20.10.2] ([121.54.54.60])
        by mx.google.com with ESMTPSA id om5sm12173695igb.16.2014.05.27.19.17.22
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Tue, 27 May 2014 19:17:23 -0700 (PDT)
In-Reply-To: <lm2fdh$s63$1@ger.gmane.org>
X-Mailer: Apple Mail (2.1878.2)
X-Original-Sender: potswa@gmail.com
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of potswa@gmail.com designates 2607:f8b0:4001:c03::233 as permitted
 sender) smtp.mail=potswa@gmail.com;       dkim=pass header.i=@gmail.com;
       dmarc=pass (p=NONE dis=NONE) header.from=gmail.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Google-Group-Id: 399137483710
List-Post: <http://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <http://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <http://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:10908
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/10908>


On 2014-05-28, at 12:44 AM, Matthew Woehlke <mw_triad@users.sourceforge.net> wrote:

> On 2014-05-27 08:45, David Krauss wrote:
>> On 2014-05-27, at 7:14 PM, vadim.petrochenkov@gmail.com wrote:
>>> I'm curious, is there any general policy in the library on changing
>>> or not changing "return void" to something in any way useful?
>>> 
>>> Because assuming the statement If the result is discarded, the
>>> compiler will be able to elide its computation after inlining. is
>>> true, a lot of member functions, for example, could potentially
>>> benefit from returning *this instead of void, but they still return
>>> void for some reason.
>> 
>> Returning this (or *this) is of no help to the CPU, which already has
>> access to the value from wherever it got it prior to the call.
> 
> I suspect the benefit here isn't optimization, but rather code writing,
> e.g. to be able to write:

There was probably some misunderstanding about what I meant by "elide computation."

>  std::vector<int> v;
>  v.clear().push_back(2).insert(v.begin(), 1); // etc.
> 
> (Not the best example, but hopefully you get the idea.)

As good an example as any. That's not the direction of C++. A carriage return and a variable declaration never killed anyone.


-- 

--- 
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

.
