220 11793 <EF930317-EB97-402E-A3A0-CC46E7E2D998@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: N4078: Rvalue reference overloads for value()
 method returns object by value
Date: Thu, 10 Jul 2014 14:41:32 +0800
Lines: 115
Approved: news@gmane.org
Message-ID: <EF930317-EB97-402E-A3A0-CC46E7E2D998@gmail.com>
References: <b538efba-faf4-4ffc-a553-302b9d2ba2c0@isocpp.org> <CANh-dX=M7niArNp-1sCcqxaREEJSxmjMftgw7uMHN9YnZC-h+w@mail.gmail.com> <4DA018C3-2327-4F55-B7F8-7988EC7B789A@gmail.com> <1a858a77-310b-4591-aaf5-960c40d9f5fc@isocpp.org> <66AF41C1-CB37-4311-98EA-D47DBC6068DC@gmail.com> <66c38b61-7a95-4ace-b34f-2346bb334fb9@isocpp.org> <F1CBA358-0AD8-4ADD-99DA-6D00FCFE150F@gmail.com> <CAFk2RUZENmaMW5NwBaiF6byfhgRyPUsSmuyVjnRDhbjcfaTtQA@mail.gmail.com> <CC03CC1C-8487-40C8-97DF-2CA7661DAD55@gmail.com> <CAFk2RUa7-WTcL=XFYO8KMyU4rdpjDEfFM6n6SkUZ=SW_U7s5XQ@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\))
Content-Type: multipart/alternative; boundary="Apple-Mail=_33621C48-702D-40EB-B036-8C11B56B21F4"
X-Trace: ger.gmane.org 1404974507 7213 80.91.229.3 (10 Jul 2014 06:41:47 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Thu, 10 Jul 2014 06:41:47 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCW25A7E3QCRBI7L7COQKGQEZWWXHIA@isocpp.org Thu Jul 10 08:41:42 2014
Return-path: <std-proposals+bncBCW25A7E3QCRBI7L7COQKGQEZWWXHIA@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-pa0-f70.google.com ([209.85.220.70])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCW25A7E3QCRBI7L7COQKGQEZWWXHIA@isocpp.org>)
	id 1X5833-0001Eu-0y
	for gclcip-std-proposals@m.gmane.org; Thu, 10 Jul 2014 08:41:41 +0200
Original-Received: by mail-pa0-f70.google.com with SMTP id lj1sf57316300pab.5
        for <gclcip-std-proposals@m.gmane.org>; Wed, 09 Jul 2014 23:41:40 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:from:message-id:mime-version:subject:date
         :references:to:in-reply-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=v2N57wJce5Fe/qCr9ggFELXpAW5TOEF+BltK7cpOrJQ=;
        b=N+R42PtFERG2mulOkzzEiai0+EGb4uOcgJKW2To0bwwaSjc64w+XGfosjHDk85N7+G
         g2mUNpZ8zvDNfluhRghjRid1uPRb8IA8LdsYVLO88TK0HA8X4IQUU+8jpQ9wpznU6EQ5
         9I2HpT0MtgpU00ObsJSBWooPmnsGQGba2rW1rRe6SgVy69WcLw389iJFnKWVGpSR+Ko4
         aGe0Dwnll0hOdh3UlX30p1CuHfsamZ1h7aXsghSJsyQc6SmxXHH0hhoM7YQ5T0ld5foy
         hSCes2uktTzJUpJchKb2VhHJdBnqsExcd+AO9UD+uzZ3Sw+qBulkhHBUFNcsi45VES4m
         w2GQ==
X-Gm-Message-State: ALoCoQkkiZ+XO5nqf6+ZNfVsTvl36FVncVKQAT+1LC0ric4n2mpos/0KCeFfkqW1z0hJI42GjmO3
X-Received: by 10.70.135.129 with SMTP id ps1mr7841296pdb.8.1404974499957;
        Wed, 09 Jul 2014 23:41:39 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.50.154.37 with SMTP id vl5ls1418635igb.33.canary; Wed, 09 Jul
 2014 23:41:39 -0700 (PDT)
X-Received: by 10.50.141.170 with SMTP id rp10mr19137113igb.6.1404974499335;
        Wed, 09 Jul 2014 23:41:39 -0700 (PDT)
Original-Received: from mail-ig0-x236.google.com (mail-ig0-x236.google.com [2607:f8b0:4001:c05::236])
        by mx.google.com with ESMTPS id ga7si11560720igd.49.2014.07.09.23.41.39
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Wed, 09 Jul 2014 23:41:39 -0700 (PDT)
Received-SPF: pass (google.com: domain of potswa@gmail.com designates 2607:f8b0:4001:c05::236 as permitted sender) client-ip=2607:f8b0:4001:c05::236;
Original-Received: by mail-ig0-f182.google.com with SMTP id c1so2742424igq.9
        for <std-proposals@isocpp.org>; Wed, 09 Jul 2014 23:41:39 -0700 (PDT)
X-Received: by 10.42.37.13 with SMTP id w13mr45433711icd.13.1404974499240;
        Wed, 09 Jul 2014 23:41:39 -0700 (PDT)
Original-Received: from [172.20.10.2] ([121.54.54.63])
        by mx.google.com with ESMTPSA id nl8sm22525519igb.4.2014.07.09.23.41.37
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Wed, 09 Jul 2014 23:41:38 -0700 (PDT)
In-Reply-To: <CAFk2RUa7-WTcL=XFYO8KMyU4rdpjDEfFM6n6SkUZ=SW_U7s5XQ@mail.gmail.com>
X-Mailer: Apple Mail (2.1878.6)
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:c05::236 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: <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>,
 <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:11793
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/11793>

--Apple-Mail=_33621C48-702D-40EB-B036-8C11B56B21F4
Content-Type: text/plain; charset=ISO-8859-1


On 2014-07-10, at 2:31 PM, Ville Voutilainen <ville.voutilainen@gmail.com> wrote:

> On 10 July 2014 09:26, David Krauss <potswa@gmail.com> wrote:
>>>> Assuming you mean * ( f().begin() ), I would expect that to be currently
>>>> broken, but the fix is to forbid begin() and end() on an xvalue because they
>>>> are fundamentally nonsense. It's a minor issue that some would-be ill-formed
>>>> code is currently accepted.
>>> 
>>> 
>>> These "fundamentally nonsense" operations work perfectly fine in forwarding
>>> scenarios.
>> 
>> It's easy enough to bind an xvalue to a name throughout the scope it does not behave as an xvalue.
> 
> I fail to see what sort of a solution that is supposed to provide.

An xvalue by definition a kind of expression whose value is going away soon. Nobody should use an xvalue in any other context. An xvalue is presumed to be empty (but maybe not) at the semicolon.

If you're going to iterate over a sequence within a container, but you got the first iterator from an xvalue, then the sequence is presumed to be dead by the first statement in the loop.

In the context of not iterating, then it would make sense to allow a move_iterator, but that's a little far-fetched. Rvalue qualified front() and back() should be good enough for idiomatic use.

>> Maybe I don't see exactly what you mean by "forwarding scenario," an example would be nice.
> 
> The example is in this thread, as has been said multiple times already.
> https://groups.google.com/a/isocpp.org/d/msg/std-proposals/jDRQyBWYl8Q/iLJFlolCOBgJ

That's just a link to this thread, to a message containing another link. The text begin() does not occur in that thread.

> We currently have ample reasons to change the rvalue-ref-qualified
> overloads of optional
> observers to return T&& instead of T. The summary, for those who don't
> read threads before
> jumping into them head first, is in
> https://issues.isocpp.org/show_bug.cgi?id=45

I cannot access the isocpp.org server.

-- 

--- 
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/.

--Apple-Mail=_33621C48-702D-40EB-B036-8C11B56B21F4
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=ISO-8859-1

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html charset=
=3Dwindows-1252"></head><body style=3D"word-wrap: break-word; -webkit-nbsp-=
mode: space; -webkit-line-break: after-white-space;"><br><div><div>On 2014&=
ndash;07&ndash;10, at 2:31 PM, Ville Voutilainen &lt;<a href=3D"mailto:vill=
e.voutilainen@gmail.com">ville.voutilainen@gmail.com</a>&gt; wrote:</div><b=
r class=3D"Apple-interchange-newline"><blockquote type=3D"cite">On 10 July =
2014 09:26, David Krauss &lt;<a href=3D"mailto:potswa@gmail.com">potswa@gma=
il.com</a>&gt; wrote:<br><blockquote type=3D"cite"><blockquote type=3D"cite=
"><blockquote type=3D"cite">Assuming you mean * ( f().begin() ), I would ex=
pect that to be currently<br>broken, but the fix is to forbid begin() and e=
nd() on an xvalue because they<br>are fundamentally nonsense. It's a minor =
issue that some would-be ill-formed<br>code is currently accepted.<br></blo=
ckquote><br><br>These "fundamentally nonsense" operations work perfectly fi=
ne in forwarding<br>scenarios.<br></blockquote><br>It's easy enough to bind=
 an xvalue to a name throughout the scope it does not behave as an xvalue.<=
br></blockquote><br>I fail to see what sort of a solution that is supposed =
to provide.<br></blockquote><div><br></div><div>An xvalue by definition a k=
ind of expression whose value is going away soon. Nobody should use an xval=
ue in any other context. An xvalue is presumed to be empty (but maybe not) =
at the semicolon.</div><div><br></div><div>If you&rsquo;re going to iterate=
 over a sequence within a container, but you got the first iterator from an=
 xvalue, then the sequence is presumed to be dead by the first statement in=
 the loop.</div><div><br></div><div>In the context of not iterating, then i=
t would make sense to allow a <font face=3D"Courier">move_iterator</font>, =
but that&rsquo;s a little far-fetched. Rvalue qualified <font face=3D"Couri=
er">front()</font> and <font face=3D"Courier">back()</font> should be good =
enough for idiomatic use.</div><br><blockquote type=3D"cite"><blockquote ty=
pe=3D"cite">Maybe I don't see exactly what you mean by "forwarding scenario=
," an example would be nice.<br></blockquote><br>The example is in this thr=
ead, as has been said multiple times already.<br><a href=3D"https://groups.=
google.com/a/isocpp.org/d/msg/std-proposals/jDRQyBWYl8Q/iLJFlolCOBgJ">https=
://groups.google.com/a/isocpp.org/d/msg/std-proposals/jDRQyBWYl8Q/iLJFlolCO=
BgJ</a><br></blockquote><div><br></div><div>That&rsquo;s just a link to thi=
s thread, to a message containing another link. The text <font face=3D"Cour=
ier">begin()</font> does not occur in that thread.</div><br><blockquote typ=
e=3D"cite">We currently have ample reasons to change the rvalue-ref-qualifi=
ed<br>overloads of optional<br>observers to return T&amp;&amp; instead of T=
.. The summary, for those who don't<br>read threads before<br>jumping into t=
hem head first, is in<br><a href=3D"https://issues.isocpp.org/show_bug.cgi?=
id=3D45">https://issues.isocpp.org/show_bug.cgi?id=3D45</a><br></blockquote=
><div><br></div>I cannot access the <a href=3D"http://isocpp.org">isocpp.or=
g</a> server.</div><div><br></div></body></html>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--Apple-Mail=_33621C48-702D-40EB-B036-8C11B56B21F4--

.
