220 11886 <225BBAAC-B3FA-4014-9FB6-64C48DF4208E@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: Sat, 12 Jul 2014 15:50:54 +0800
Lines: 86
Approved: news@gmane.org
Message-ID: <225BBAAC-B3FA-4014-9FB6-64C48DF4208E@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>
 <EF930317-EB97-402E-A3A0-CC46E7E2D998@gmail.com> <CAFk2RUZigiwLwFpfVXuFS8cqy38hPG3OGhGUi+iNwSYuYvyAyQ@mail.gmail.com>
 <A46ADDB4-C9B0-4163-81BE-900CD879D8C8@gmail.com> <CAFk2RUZ-DqEcMeehjH8KedYgErxKMq4O9kmeN4FZzjkXMYSsiw@mail.gmail.com>
 <6F4B3C72-9962-48DC-8527-0C89EA1B9710@gmail.com> <CAFk2RUb5xynaoQx-j4cQuXC8t-0GGc9-CZyRA2V=j6cfuNQV=g@mail.gmail.com>
 <35873CE5-ED8C-4C03-A6A1-E4132DECD91F@gmail.com> <CAFk2RUYRJSNcXykj9oPd=3EehSozf7PcX8ACM_hrqhK+Ur2V8A@mail.gmail.com>
 <335948E6-8140-4673-B958-930356A52070@gmail.com> <CAFk2RUYf+tpBvxiK00O=FncB01BWe6+SXiYBN7fixd4mhm+Z-w@mail.gmail.com>
 <76ACA175-5A44-4BE8-B49F-BAC6DA65E6B1@gmail.com> <CAFk2RUah5k9zy_mQqeNN9mec0PYkmKDZp7LVXm64dTeSLaw6nQ@mail.gmail.com>
 <4D3852AD-1AEB-44BA-941C-D645BAD19405@gmail.com> <6a4b6425-1167-40c1-acd8-3945c8cd4c74@isocpp.org>
 <13DD0D7A-A146-4667-9F30-6FB3739CDBE0@gmail.com> <CADGW59=9uFv-fXRVuBCE+3fdycqTzaqCJnuVmmaT6mOF=1=-MA@mail.gmail.com>
 <E9F36B2C-A142-4B6C-ADFD-57D0E11F2C5B@gmail.com> <CAOenAXiBW+BiUkPWdGQHS9fkyEVWJg343NXH9kRSn9owk6FmgQ@mail.gmail.com>
 <DABFDEB7-ADF9-40EC-B4DB-672205A99FEB@gmail.com> <CAFk2RUa-kPWGy29siK4dUu6jbydfwbUeuzCpYOi+b9xc4-msSg@mail.gmail.com>
 <C3BA0F43-683E-4FFE-B04C-9015EB9C7CB0@gmail.com> <CAFk2RUYzt26HjKhYCZtJ4BMrjLzu9MQvZ0ynuaULWTYbE6MBAA@mail.gmail.com>
 <6B925FF7-2940-44C7-BF1D-13209A703BA2@gmail.com> <CAA7U3HOtwZ+9M1E2GUZjmT4J6onk3EdZSnskd-1OaKHv+-wJ7g@mail.gmail.com>
 <944C9C01-865B-4215-8C91-95F01AEA256E@gmail.com> <CAA7U3HPT_z2H3E84v9vOxKhAvCnv2SB2ikJDDkR7W1M+Sd-JSg@mail.gmail.com>
 <8DC3E474-3957-40B2-B492-D4AF2FDDD451@gmail.com> <0ACAE525-4FB2-4932-BBD2-F0623C4EBBFB@gmail.com>
 <52187852-ff8e-4e59-a8cf-7a29fd0a405b@isocpp.org> <8209A2E9-D947-4C00-A1F3-38F5676A4E52@gmail.com>
 <4c42f7c9-0588-4ab9-9af5-b2e692513993@isocpp.org>
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=_AB2BD471-1A28-40A3-B3E0-944E7AB57C56"
X-Trace: ger.gmane.org 1405151484 4051 80.91.229.3 (12 Jul 2014 07:51:24 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Sat, 12 Jul 2014 07:51:24 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCW25A7E3QCRB4WRQOPAKGQE5GMIOTI@isocpp.org Sat Jul 12 09:51:16 2014
Return-path: <std-proposals+bncBCW25A7E3QCRB4WRQOPAKGQE5GMIOTI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-oi0-f72.google.com ([209.85.218.72])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCW25A7E3QCRB4WRQOPAKGQE5GMIOTI@isocpp.org>)
	id 1X5s5U-0000M1-Bq
	for gclcip-std-proposals@m.gmane.org; Sat, 12 Jul 2014 09:51:16 +0200
Original-Received: by mail-oi0-f72.google.com with SMTP id a141sf439oig.7
        for <gclcip-std-proposals@m.gmane.org>; Sat, 12 Jul 2014 00:51:15 -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=FqcKop/waLQyVkluP1K08j5cdrU2dlRxSeqbyKhzUQE=;
        b=nGS4yabKJet/exSZl5aMHOUE6JDPxGpWnUUbBttQFYldck91TmaMXm1Qc6pCk0hAVV
         A4J+6JGUauXx3l1Q+/3cocbbTcgCJrbRwR0AgkBWO723+WpJxPFf37iTjmEps744G74B
         Y9BeIUpgm0yLsoYPnUm8w9iUWytieqwhfKt598aDNkq7zDVYhxABR/Ed1CCYuSeeUZQe
         /nuO11ayn0D4eIURXzQNqOAthBGxdSapSqdYN7IgVb1cm5wOr3y/24CQRgD8JNgUOgid
         /y8iPz52iZhzvjRZUpJHj+Beszq07dIahkPv6CwgYeESbt1mhZb1gFS0qN+nv85ryuEl
         2cFg==
X-Gm-Message-State: ALoCoQm1Q+hfEiVCWiLD7UNC4iM53Buc1U4NC4RxH5BK9s55TlUV9sVnSkbg9KiS1xHfUWhE04IA
X-Received: by 10.42.208.72 with SMTP id gb8mr4210797icb.24.1405151475155;
        Sat, 12 Jul 2014 00:51:15 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.50.128.194 with SMTP id nq2ls757939igb.42.canary; Sat, 12 Jul
 2014 00:51:14 -0700 (PDT)
X-Received: by 10.50.112.132 with SMTP id iq4mr10594203igb.45.1405151474521;
        Sat, 12 Jul 2014 00:51:14 -0700 (PDT)
Original-Received: from mail-ie0-x234.google.com (mail-ie0-x234.google.com [2607:f8b0:4001:c03::234])
        by mx.google.com with ESMTPS id ay7si9092515icb.11.2014.07.12.00.51.14
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Sat, 12 Jul 2014 00:51:14 -0700 (PDT)
Received-SPF: pass (google.com: domain of potswa@gmail.com designates 2607:f8b0:4001:c03::234 as permitted sender) client-ip=2607:f8b0:4001:c03::234;
Original-Received: by mail-ie0-f180.google.com with SMTP id at20so1741013iec.11
        for <std-proposals@isocpp.org>; Sat, 12 Jul 2014 00:51:14 -0700 (PDT)
X-Received: by 10.42.43.5 with SMTP id v5mr9595955ice.62.1405151474284;
        Sat, 12 Jul 2014 00:51:14 -0700 (PDT)
Original-Received: from [172.20.10.2] ([121.54.54.57])
        by mx.google.com with ESMTPSA id d4sm3458282igc.5.2014.07.12.00.51.12
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Sat, 12 Jul 2014 00:51:13 -0700 (PDT)
In-Reply-To: <4c42f7c9-0588-4ab9-9af5-b2e692513993@isocpp.org>
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:c03::234 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:11886
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/11886>

--Apple-Mail=_AB2BD471-1A28-40A3-B3E0-944E7AB57C56
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=ISO-8859-1


On 2014-07-12, at 3:27 PM, tomaszkam@gmail.com wrote:

> 3. The above code does not work if if the passed Nullable type define && =
overload of operator* that returns by value.
>     Lifetime of object bound by auto&& value =3D *std::forward<Nullable>(=
nullable); is not the same as lifetime of nullable.

Yes, but in that case what does the std::forward express? Reading that func=
tion, I would intuitively expect addressof(value) to become a dangling refe=
rence. Any other interpretation requires thinking hard about what did *not*=
 happen to the result of forward. It wasn't passed to a function, but absen=
ce of some common thing isn't a good discriminating factor. (And in fact, i=
t was passed to a function, operator *.)

Because function_taking_pointer(pointer) passes a non-owning observer, null=
able must live at least through that call. The intent is best expressed by =
simply value =3D * nullable; do not use forward(). This can be declared as =
auto && or auto & equivalently.

Am I missing something?

--=20

---=20
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 e=
mail 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-proposa=
ls/.

--Apple-Mail=_AB2BD471-1A28-40A3-B3E0-944E7AB57C56
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;12, at 3:27 PM, <a href=3D"mailto:tomaszkam@gmail.com">tomas=
zkam@gmail.com</a> wrote:</div><br class=3D"Apple-interchange-newline"><blo=
ckquote type=3D"cite"><div dir=3D"ltr">3. The above code does not work if i=
f the passed Nullable type define &amp;&amp; overload of operator* that ret=
urns by value.<br><div>&nbsp;&nbsp;&nbsp; Lifetime of object bound by auto&=
amp;&amp; value =3D *std::forward&lt;Nullable&gt;(nullable); is not the sam=
e as lifetime of nullable.<br></div></div></blockquote><div><br></div></div=
>Yes, but in that case what does the <font face=3D"Courier">std::forward</f=
ont> express? Reading that function, I would intuitively expect <font face=
=3D"Courier">addressof(value)</font> to become a dangling reference. Any ot=
her interpretation requires thinking hard about what did *<i>not</i>* happe=
n to&nbsp;the result of <font face=3D"Courier">forward</font>. It wasn&rsqu=
o;t passed to a function, but absence of some common thing isn&rsquo;t a go=
od discriminating factor. (And in fact, it was passed to a function, <font =
face=3D"Courier">operator *</font>.)<div><br></div><div>Because&nbsp;<font =
face=3D"Courier">function_taking_pointer(pointer)</font>&nbsp;passes a non-=
owning observer, <font face=3D"Courier">nullable</font> must live at least =
through that call. The intent is best expressed by simply&nbsp;<font face=
=3D"Courier">value =3D * nullable</font>; do not use&nbsp;<font face=3D"Cou=
rier">forward()</font>. This can be declared as&nbsp;<font face=3D"Courier"=
>auto &amp;&amp;</font> or <font face=3D"Courier">auto &amp;</font> equival=
ently.</div><div><br></div><div>Am I missing something?</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=_AB2BD471-1A28-40A3-B3E0-944E7AB57C56--

.
