220 21174 <DB6883C3-C590-4207-846C-ADAEA22EA657@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: P0007R0: Constant View: A proposal for a
 std::as_const helper function template
Date: Fri, 2 Oct 2015 22:55:54 +0800
Lines: 96
Approved: news@gmane.org
Message-ID: <DB6883C3-C590-4207-846C-ADAEA22EA657@gmail.com>
References: <mum4tp$j5r$1@ger.gmane.org> <CAFk2RUZcHzQXXfGaq1W_g5jB5kdBSJEGQHE-vZ9y27+Um3+eZQ@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\))
Content-Type: multipart/alternative; boundary="Apple-Mail=_D9C1848B-833F-449D-8E99-E4A4ECEC163F"
X-Trace: ger.gmane.org 1443797770 4571 80.91.229.3 (2 Oct 2015 14:56:10 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Fri, 2 Oct 2015 14:56:10 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCW25A7E3QCRBAFWXKYAKGQEDLQINTQ@isocpp.org Fri Oct 02 16:56:05 2015
Return-path: <std-proposals+bncBCW25A7E3QCRBAFWXKYAKGQEDLQINTQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-yk0-f198.google.com ([209.85.160.198])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCW25A7E3QCRBAFWXKYAKGQEDLQINTQ@isocpp.org>)
	id 1Zi1kh-0002q5-OO
	for gclcip-std-proposals@m.gmane.org; Fri, 02 Oct 2015 16:56:03 +0200
Original-Received: by ykft14 with SMTP id t14sf139581862ykf.0
        for <gclcip-std-proposals@m.gmane.org>; Fri, 02 Oct 2015 07:56:03 -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:content-type: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:x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=n4CyD50GcD8IonL30AhKqERhupoB3IuvTKzjOtcdFSQ=;
        b=ZpxRK4J/AQnojXdyhNvA0rRITTQt2SBIWlEXMfShjsWEP1YXNK39ZuptdEuYGbltu6
         uoE+1xcysxAcMtTybcjlZyaaWw1qe8Htec9BYJDVNqF7eoX81mkTQ7nAElNH0LRvtL6s
         j0kFTbbLt6P3zrSxU1vgAYYNiQm955THPbB6brszB7/pUp6I0iXkd13EIxO3AeO9y2b/
         OEvaHhDWuFI2KSTXBBDe5jw2iIgCCn24Z4OKPvqaoIIwKNLcjozsvtEJgVEEO5sY3tkr
         GWwpXebnAn7POlvTgu3NHjbjtpFoiuUGVuDtjBwwWOGXhnAMpdT3XHY+TIELUh9BfMzN
         AAhA==
X-Gm-Message-State: ALoCoQmQdaIJ2IDYrkxLvfo7QrNhEqD8IxqOEHvZROUmt9CWUhnFqlHDmmsRMCodNzeZLI0PfVPm
X-Received: by 10.129.125.130 with SMTP id y124mr12963580ywc.14.1443797763125;
        Fri, 02 Oct 2015 07:56:03 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.107.130.157 with SMTP id m29ls967415ioi.33.gmail; Fri, 02 Oct
 2015 07:56:00 -0700 (PDT)
X-Received: by 10.107.128.106 with SMTP id b103mr20360609iod.116.1443797760166;
        Fri, 02 Oct 2015 07:56:00 -0700 (PDT)
Original-Received: from mail-pa0-x236.google.com (mail-pa0-x236.google.com. [2607:f8b0:400e:c03::236])
        by mx.google.com with ESMTPS id y42si8959199ioi.100.2015.10.02.07.56.00
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Fri, 02 Oct 2015 07:56:00 -0700 (PDT)
Received-SPF: pass (google.com: domain of potswa@gmail.com designates 2607:f8b0:400e:c03::236 as permitted sender) client-ip=2607:f8b0:400e:c03::236;
Original-Received: by pablk4 with SMTP id lk4so107978483pab.3
        for <std-proposals@isocpp.org>; Fri, 02 Oct 2015 07:55:59 -0700 (PDT)
X-Received: by 10.67.5.66 with SMTP id ck2mr20537078pad.137.1443797759843;
        Fri, 02 Oct 2015 07:55:59 -0700 (PDT)
Original-Received: from [172.20.10.2] ([121.54.54.177])
        by smtp.gmail.com with ESMTPSA id y5sm12406887pbt.77.2015.10.02.07.55.57
        for <std-proposals@isocpp.org>
        (version=TLSv1/SSLv3 cipher=OTHER);
        Fri, 02 Oct 2015 07:55:59 -0700 (PDT)
In-Reply-To: <CAFk2RUZcHzQXXfGaq1W_g5jB5kdBSJEGQHE-vZ9y27+Um3+eZQ@mail.gmail.com>
X-Mailer: Apple Mail (2.2104)
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:400e:c03::236 as permitted
 sender) smtp.mailfrom=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-Spam-Checked-In-Group: 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:21174
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/21174>

--Apple-Mail=_D9C1848B-833F-449D-8E99-E4A4ECEC163F
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=UTF-8


> On 2015=E2=80=9310=E2=80=9302, at 10:45 PM, Ville Voutilainen <ville.vout=
ilainen@gmail.com> wrote:
>=20
> On 2 October 2015 at 17:38, Matthew Woehlke <mwoehlke.floss@gmail.com> wr=
ote:
>> While it's true that we want lifetime extension anyway, the reality is
>> that std::as_const *also* doesn't work without core language changes,
>> i.e. as a library-only solution it is incomplete. Moreover, I don't see
>> that it cannot be made to work at all for an rvalue of a type that is
>> not {copy,move}able without introducing mandatory copy elision. (The
>=20
> Ah, yes, the rvalue overload is returning by value, which doesn't work fo=
r
> forwarding cases. Then again, for forwarding cases, one can forward<const=
 T>()
> so perhaps that wasn't important.

If T is a reference type, then const will be ignored in forward<const T>.

It=E2=80=99s another use case for generalized lifetime extension (P0066) bu=
t I=E2=80=99m not sure whether that proposal is getting closer or further :=
P

A core language feature, const(expr) or const{expr} parsed as if const was =
a simple-type-specifier, would produce temporary expressions=E2=80=A6

--=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=_D9C1848B-833F-449D-8E99-E4A4ECEC163F
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=UTF-8

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html charset=
=3Dutf-8"></head><body style=3D"word-wrap: break-word; -webkit-nbsp-mode: s=
pace; -webkit-line-break: after-white-space;" class=3D""><br class=3D""><di=
v><blockquote type=3D"cite" class=3D""><div class=3D"">On 2015=E2=80=9310=
=E2=80=9302, at 10:45 PM, Ville Voutilainen &lt;<a href=3D"mailto:ville.vou=
tilainen@gmail.com" class=3D"">ville.voutilainen@gmail.com</a>&gt; wrote:</=
div><br class=3D"Apple-interchange-newline"><div class=3D"">On 2 October 20=
15 at 17:38, Matthew Woehlke &lt;<a href=3D"mailto:mwoehlke.floss@gmail.com=
" class=3D"">mwoehlke.floss@gmail.com</a>&gt; wrote:<br class=3D""><blockqu=
ote type=3D"cite" class=3D"">While it's true that we want lifetime extensio=
n anyway, the reality is<br class=3D"">that std::as_const *also* doesn't wo=
rk without core language changes,<br class=3D"">i.e. as a library-only solu=
tion it is incomplete. Moreover, I don't see<br class=3D"">that it cannot b=
e made to work at all for an rvalue of a type that is<br class=3D"">not {co=
py,move}able without introducing mandatory copy elision. (The<br class=3D""=
></blockquote><br class=3D"">Ah, yes, the rvalue overload is returning by v=
alue, which doesn't work for<br class=3D"">forwarding cases. Then again, fo=
r forwarding cases, one can forward&lt;const T&gt;()<br class=3D"">so perha=
ps that wasn't important.<br class=3D""></div></blockquote><div><br class=
=3D""></div><div>If&nbsp;<span style=3D"font-family: Courier;" class=3D"">T=
</span>&nbsp;is a reference type, then&nbsp;<span style=3D"font-family: Cou=
rier;" class=3D"">const</span>&nbsp;will be ignored in <font face=3D"Courie=
r" class=3D"">forward&lt;const T&gt;</font>.</div></div><br class=3D""><div=
 class=3D"">It=E2=80=99s another use case for generalized lifetime extensio=
n (P0066) but I=E2=80=99m not sure whether that proposal is getting closer =
or further :P</div><div class=3D""><br class=3D""></div><div class=3D"">A c=
ore language feature, <font face=3D"Courier" class=3D"">const(expr)</font> =
or <font face=3D"Courier" class=3D"">const{expr}</font>&nbsp;parsed as if&n=
bsp;<span style=3D"font-family: Courier;" class=3D"">const</span>&nbsp;was =
a simple-type-specifier, would produce temporary expressions=E2=80=A6</div>=
<div class=3D""><br class=3D""></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=_D9C1848B-833F-449D-8E99-E4A4ECEC163F--

.
