220 29029 <d348adb2-19b5-48f9-8836-adf9c3fa3300@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: joseph.thomson@gmail.com
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: [propagate_const] Implicit conversion to T
Date: Fri, 21 Oct 2016 10:22:19 -0700 (PDT)
Lines: 131
Approved: news@gmane.org
Message-ID: <d348adb2-19b5-48f9-8836-adf9c3fa3300@isocpp.org>
References: <1f43ffe8-b267-4c8c-8834-f3e60035f18d@isocpp.org>
 <7f61be69-4f4c-40a5-9199-805edc90b428@isocpp.org> <13a71b20-8fd3-4a29-9279-716a2c9082a6@isocpp.org>
 <7abb6203-6ca7-4e04-ab6a-dc6a60e223ca@isocpp.org> <CAFk2RUZSZ4_mUv8S=O5khg9ErDSxJ8vT5R9Z3ULwKLnQqELAVw@mail.gmail.com>
 <60ae1a96-7a31-491d-bcf8-c81590544006@isocpp.org>
 <CAAbBDD-Txt57g_XEpKhRaJhW7WXLen+emuXKgn2g19DzK5m9Bg@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_1464_112836723.1477070539556"
X-Trace: blaine.gmane.org 1477070551 32207 195.159.176.226 (21 Oct 2016 17:22:31 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Fri, 21 Oct 2016 17:22:31 +0000 (UTC)
Cc: jbcoe@me.com
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBDQM7AFVVUERBTE5VHAAKGQEPT2RFOI@isocpp.org Fri Oct 21 19:22:26 2016
Return-path: <std-proposals+bncBDQM7AFVVUERBTE5VHAAKGQEPT2RFOI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-qt0-f197.google.com ([209.85.216.197])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBDQM7AFVVUERBTE5VHAAKGQEPT2RFOI@isocpp.org>)
	id 1bxdWO-0006xg-VF
	for gclcip-std-proposals@m.gmane.org; Fri, 21 Oct 2016 19:22:21 +0200
Original-Received: by mail-qt0-f197.google.com with SMTP id g49sf103255534qtc.7
        for <gclcip-std-proposals@m.gmane.org>; Fri, 21 Oct 2016 10:22:23 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=date:from:to:cc:message-id:in-reply-to:references:subject
         :mime-version:x-original-sender:reply-to:precedence:mailing-list
         :list-id:x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=fOrvtyPrv5YfRIsSiEBeqHamZ1j0AS0n8vUBzJY/Me0=;
        b=zDoqHRQD5NHmRQzyQVRItgGFPD2ONU2n08dO3ScbWULhFE91Kpv2W29Ry+egbkTIww
         OlGlLLSsf3T0V58yTcvZq+0OmNr/UInF6H5I+fzMvtHoYhp2n6EFL65pwCh+B/q/3csb
         GkG6Mirns5bduCMYkv4bEyxx+fBqY/JIpbG/iCs6LuPW+e3IlM4Bw/WUfMzpDBk81KsL
         nCaK+CfIfMBgYxkqKwALw0TdlCaux9bII9OBc1QC44wozTtRXCokUC/INoXnKAaNWhyQ
         DA3R304vLKb3ev8g39iDWrcL8S3/4YCH/O6O47tvhdZA+Da4ECFwB7xGMTTbbOOF/REw
         F4DQ==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=date:from:to:cc:message-id:in-reply-to:references:subject
         :mime-version:x-original-sender:reply-to:precedence:mailing-list
         :list-id:x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=fOrvtyPrv5YfRIsSiEBeqHamZ1j0AS0n8vUBzJY/Me0=;
        b=mc+kC7hpRoIQImFygJMlq9A/TuAual1LxjZ67yjLgCZiSRLHwGqwDV4x6gsLjSRNOc
         twtXBwIOwyKXjyS31Tv2F7MnqPZj3GRwWu3qDl93+YF6CXlrWEW0sXIc4lvGQEy2XV5s
         m7k3knfcV76Ym1Y57minzAdP/OOQ9xbyXC7UTn2JQojrGRGLeIrdc/Yjlhv985PLxo/o
         SfcfUCtsrJ09ZoZ9zV/qCEeW3ZQGkbRZEctAxWLG/XmEvxu8zzcB1aSpt//KRZ990lwt
         PRS15thWePg5rKRsYcmLWrOdYXeAiVfP7rex7oUtbFmEM6Ay1xXl3ImZVa0qBn/HmnJC
         Ow4Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:date:from:to:cc:message-id:in-reply-to
         :references:subject:mime-version:x-original-sender:reply-to
         :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post
         :list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=fOrvtyPrv5YfRIsSiEBeqHamZ1j0AS0n8vUBzJY/Me0=;
        b=IWT6UJZ7OqguDVGak3xEsS3uwQ4iqVgKQx89vG7WOuHUWSqKyz4Vs+ZGhO8Y58Q6ol
         uUihW8vLtkx+CbcngO9Z8CpKgrTqaoW6bzolSr5AHjZZVd8bfRpDgAk5T2MPRPi+cLFr
         NcITDtQ2qtyZJSdY7mBlgSHnQdW/X7+U8lz3pv3nCtVlbBlc7Cyc3zlQ2yOhXgGSl8lU
         97vQ3y+XhSpjsik7tuHQTYthyI8kyagAhdfBrFm0Cr+RHCWobEURFEjnI049CHUrjyhg
         oCm+/eaPoQmKP2JQrvFhZ38Sd5+wWrVmV3XXT+EIYesDqr8emnGsbRpO8JJZfNe1jfP4
         H6og==
X-Gm-Message-State: AA6/9RndFIkD46G8qeAUmlDZQKR+J97jrh4MnyLw97XV/p6OWIPA8qQzRLY4CxiAtZXxdQ==
X-Received: by 10.237.34.47 with SMTP id n44mr5764303qtc.46.1477070543020;
        Fri, 21 Oct 2016 10:22:23 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.107.142.17 with SMTP id q17ls2620384iod.1.gmail; Fri, 21 Oct
 2016 10:22:20 -0700 (PDT)
X-Received: by 10.36.103.199 with SMTP id u190mr1436561itc.6.1477070540551;
        Fri, 21 Oct 2016 10:22:20 -0700 (PDT)
In-Reply-To: <CAAbBDD-Txt57g_XEpKhRaJhW7WXLen+emuXKgn2g19DzK5m9Bg@mail.gmail.com>
X-Original-Sender: joseph.thomson@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: <https://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <https://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <https://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <https://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>,
 <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:29029
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/29029>

------=_Part_1464_112836723.1477070539556
Content-Type: multipart/alternative; 
	boundary="----=_Part_1465_729748463.1477070539557"

------=_Part_1465_729748463.1477070539557
Content-Type: text/plain; charset=UTF-8

On Friday, 21 October 2016 05:08:54 UTC+8, Jonathan Coe wrote:
>
> Adding `const_type` so that `const propagate_const<T>` is implicitly 
> convertible to `const_type_t<T>` seems pretty appealing to me.
>
> `get_underlying` is very much like a cast operation, it was added so the 
> user can discard const_propagation when required.
>

It's worth noting that with this new implicit conversion, the 
implementation of get_underlying pretty much becomes a call to const_cast:

template <typename T>
T const& get_underlying(propagate_const<T> const& pc) {
    return const_cast<propagate_const<T>&>(pc);
}

template <typename T>
T& get_underlying(propagate_const<T>& pc) {
    return pc;
}

-- 
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.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/d348adb2-19b5-48f9-8836-adf9c3fa3300%40isocpp.org.

------=_Part_1465_729748463.1477070539557
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Friday, 21 October 2016 05:08:54 UTC+8, Jonathan Coe  w=
rote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8e=
x;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr">Adding `=
const_type` so that `const propagate_const&lt;T&gt;` is implicitly converti=
ble to `const_type_t&lt;T&gt;` seems pretty appealing to me.<div><br></div>=
<div>`get_underlying` is very much like a cast operation, it was added so t=
he user can discard const_propagation when required.<br></div></div></block=
quote><div><br>It&#39;s worth noting that with this new implicit conversion=
, the implementation of <span style=3D"font-family: courier new,monospace;"=
>get_underlying</span> pretty much becomes a call to <span style=3D"font-fa=
mily: courier new,monospace;">const_cast</span>:<br><br><div style=3D"backg=
round-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-s=
tyle: solid; border-width: 1px; overflow-wrap: break-word;" class=3D"pretty=
print"><code class=3D"prettyprint"><div class=3D"subprettyprint"><span styl=
e=3D"color: #008;" class=3D"styled-by-prettify">template</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"color: #008=
;" class=3D"styled-by-prettify">typename</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"> T</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">&gt;</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"><br>T </span><span style=3D"color: #008;" class=3D"styled=
-by-prettify">const</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">&amp;</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> get_underlying</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">(</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
propagate_const</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">&lt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify">T=
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&gt;</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span st=
yle=3D"color: #008;" class=3D"styled-by-prettify">const</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">&amp;</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> pc</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">)</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">{</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"styl=
ed-by-prettify">return</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettif=
y">const_cast</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">&lt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify">pro=
pagate_const</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">&lt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify">T</s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">&gt;&amp;&gt;=
(</span><span style=3D"color: #000;" class=3D"styled-by-prettify">pc</span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">);</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">}</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"><br><br></span><span style=3D"color: #00=
8;" class=3D"styled-by-prettify">template</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">&lt;</span><span style=3D"color: #008;" class=3D"st=
yled-by-prettify">typename</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> T</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">&gt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"><br>T</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&am=
p;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> get_und=
erlying</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify">propagate_co=
nst</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify">T</span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">&gt;&amp;</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"> pc</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">)</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" c=
lass=3D"styled-by-prettify">return</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> pc</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"><br></span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">}</span></div></code></div><br></div></div>

<p></p>

-- <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 />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/d348adb2-19b5-48f9-8836-adf9c3fa3300%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/d348adb2-19b5-48f9-8836-adf9c3fa3300=
%40isocpp.org</a>.<br />

------=_Part_1465_729748463.1477070539557--

------=_Part_1464_112836723.1477070539556--

.
