220 37491 <2f3f1821-385e-4357-bcf4-9a87312853fe@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: florian.csdt@gmail.com
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Allowing std::complex's magic permission for
 other types
Date: Tue, 27 Mar 2018 02:53:23 -0700 (PDT)
Lines: 195
Approved: news@gmane.org
Message-ID: <2f3f1821-385e-4357-bcf4-9a87312853fe@isocpp.org>
References: <a3462649-a7bd-4215-b162-e8fe922df02d@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_17608_1844072844.1522144403475"
X-Trace: blaine.gmane.org 1522144283 15304 195.159.176.226 (27 Mar 2018 09:51:23 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Tue, 27 Mar 2018 09:51:23 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBC26HM4V3MIRBFFJ5DKQKGQE5ZEPS2A@isocpp.org Tue Mar 27 11:51:19 2018
Return-path: <std-proposals+bncBC26HM4V3MIRBFFJ5DKQKGQE5ZEPS2A@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ua0-f197.google.com ([209.85.217.197])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBC26HM4V3MIRBFFJ5DKQKGQE5ZEPS2A@isocpp.org>)
	id 1f0lGA-0003px-MV
	for gclcip-std-proposals@m.gmane.org; Tue, 27 Mar 2018 11:51:18 +0200
Original-Received: by mail-ua0-f197.google.com with SMTP id r1sf14985089uae.6
        for <gclcip-std-proposals@m.gmane.org>; Tue, 27 Mar 2018 02:53:26 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :x-original-sender:reply-to:precedence:mailing-list:list-id
         :list-post:list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=38zN1OZAz5eWEW+AerypdRGwddGTm4DTtog11VUHj1Y=;
        b=unQ/mWi4SRqLEL/EJgD8/MiHZ9RE7PnJGLaCQXhboF6voBY/ec7bDsZ2lH+MWcFIpq
         AIUcf0CBouXUO1WhmWALr7z46WVbiWnV2qu9yG/9KUhNlbck0PBqNkZdKiM0h8eNnd6L
         oEXq22NrjuO+Sz4dU93TsUkIhwp9zaejZNf/0YvSdtwgO1clSvQVqsf+xeEYTz+xfAEL
         laxpk5LMvunJgYicN+/YGaceSaa9oXYIbIkDdzWyBaMzs3vuY+0YNvpGqCAwz1ln8IY+
         DbEZ9/cMNZrgQej8TxYxkWZbwheF7GJETnCWv8e98Ma5R4WC1/4TARmouF9nEBGeRlE/
         0fhQ==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :x-original-sender:reply-to:precedence:mailing-list:list-id
         :list-post:list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=38zN1OZAz5eWEW+AerypdRGwddGTm4DTtog11VUHj1Y=;
        b=pRPB3TKBv1beulk/We/Nw5jI33SmQaH0i7klh64lDFrtG9bFrGJSV4hOp3vsjoIGSr
         5lHeDAhgy4S3og32EceWjraxoTAcN8C1hns7sEtS4x3ae/1XSHNmrm/6oXDLOnnDxyYT
         q7BkyvzXKPi9CjhzVcRAsjxe/Ln7Vh29rDWCkhKv1U3VQThHuuw+BL2hhrCXgUOX2qjZ
         fOZLzPgOU0yk0kFJdmcOD27I4npftWQTSw7gR8JQkkd7dR2DVPg9EAttbeqP8htF4Lvf
         oy7y9ag9Fc5QcSokOyfA3A9UXHgI/3nsahslUgyweDyRtGLa+vvU5UTR4eA36vkR+AJq
         L7XA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:date:from:to: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=38zN1OZAz5eWEW+AerypdRGwddGTm4DTtog11VUHj1Y=;
        b=I4QP1mf+9WT56eTK2vElQkL3mQzsSs2hnRnVc/acc9DQ7z4cCrn4qpsR86U1PR/ujE
         HFaLWs//nf4yvIlfp0oF1ealWgsqaqn0gCAoWj2aYkIjTUcwMZEwOpThFxlv3EW6p0yp
         8WTUF1x9wh2lad0GAj3l3d8hQb2tuVAQDSD8XexXHhvzYpzG7VhMtv7JiRDlvJ3ol1rk
         6HKX1X2pm6nCiLGucdWz0sLWHnYIdL66CID89rJoi4FecOzNY3N9S1OvH/UkgpTnhbei
         nOB3UBJoc4FZZ8pgmqCqtngRWmp6wQgSeAT1wbvT2bCHbZ6a3QotWP1EMhh+sCIBxQu7
         isHg==
X-Gm-Message-State: AElRT7FWz2+Rl2pB2N2ZSoMJjSW4RDx0omBMn0MuK8san68dA5EnSCFj
	dYsh7I82Sx27BeFX2Jq+UJ+iLA==
X-Google-Smtp-Source: AG47ELsBn68v/dgn1bBAKQw0KkRhZANnNX3yqAOzJHrrJ6ZWQtUdTkLuhfTAIhz6P9BtbgenaO62qg==
X-Received: by 10.31.130.15 with SMTP id e15mr18393664vkd.115.1522144405740;
        Tue, 27 Mar 2018 02:53:25 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.31.161.86 with SMTP id k83ls343139vke.4.gmail; Tue, 27 Mar
 2018 02:53:24 -0700 (PDT)
X-Received: by 10.31.158.83 with SMTP id h80mr5284510vke.9.1522144404085;
        Tue, 27 Mar 2018 02:53:24 -0700 (PDT)
In-Reply-To: <a3462649-a7bd-4215-b162-e8fe922df02d@isocpp.org>
X-Original-Sender: florian.csdt@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: <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:37491
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/37491>

------=_Part_17608_1844072844.1522144403475
Content-Type: multipart/alternative; 
	boundary="----=_Part_17609_1346117342.1522144403475"

------=_Part_17609_1346117342.1522144403475
Content-Type: text/plain; charset="UTF-8"

I have the impression that people are missing the big picture here.

I see one big problem that can be solved with overloadable 
reinterpret_cast: smart pointers.
If you look closely at shared_pointer for instance, you will see:

template <class T, class U>
std::shared_ptr<T> static_pointer_cast(const std::shared_ptr<U>& r) noexcept
;

template <class T, class U>
std::shared_ptr<T> dynamic_pointer_cast(const std::shared_ptr<U>& r) 
noexcept;

template <class T, class U>
std::shared_ptr<T> const_pointer_cast(const std::shared_ptr<U>& r) noexcept;

template <class T, class U>
std::shared_ptr<T> reinterpret_pointer_cast(const std::shared_ptr<U>& r) 
noexcept;

If it were possible to overload dynamic_cast const_cast and 
reinterpret_cast, this would have been unnecessary to have a different 
interface for shared pointers than for regular pointers.

-- 
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/2f3f1821-385e-4357-bcf4-9a87312853fe%40isocpp.org.

------=_Part_17609_1346117342.1522144403475
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">I have the impression that people are missing the big pict=
ure here.<br><br>I see one big problem that can be solved with overloadable=
 reinterpret_cast: smart pointers.<br>If you look closely at shared_pointer=
 for instance, you will see:<br><br><div style=3D"background-color: rgb(250=
, 250, 250); border-color: rgb(187, 187, 187); border-style: solid; border-=
width: 1px; overflow-wrap: break-word;" class=3D"prettyprint"><code class=
=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"></span><span style=3D"color: #008;" class=3D"=
styled-by-prettify">template</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">&lt;</span><span style=3D"color: #008;" class=3D"styled-by-prettif=
y">class</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> T=
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">class</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> U</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">&gt;</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"><br>std</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">::</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify">shared_ptr</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">&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"> sta=
tic_pointer_cast</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">(</span><span style=3D"color: #008;" class=3D"styled-by-prettify">con=
st</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> std</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">::</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify">shared_ptr</span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify">U</span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">&gt;&amp;</span><span style=3D"color:=
 #000;" class=3D"styled-by-prettify"> r</span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">)</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> noexcept</span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">;</span><br><span style=3D"color: #000;" class=3D"styled=
-by-prettify"><code class=3D"prettyprint"><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"><br></span><span style=3D"color: #008;" class=3D"s=
tyled-by-prettify">template</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">&lt;</span><span style=3D"color: #008;" class=3D"styled-by-prettify=
">class</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> T<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">class</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> U</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">&gt;</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"><br>std</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">::</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify">shared_ptr</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">&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"> dyn=
amic_pointer_cast</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">(</span><span style=3D"color: #008;" class=3D"styled-by-prettify">co=
nst</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> std</s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">::</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify">shared_ptr</span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify">U</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">&gt;&amp;</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"> r</span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">)</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> noexcept</span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">;</span></code></span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"><code class=3D"prettyprint"><span style=3D"color: =
#660;" class=3D"styled-by-prettify"><code class=3D"prettyprint"><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br><br></span><span style=
=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">class</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> T</span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify"=
>class</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> U</=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">&gt;</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"><br>std</span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify">shared_ptr</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"co=
lor: #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;" cla=
ss=3D"styled-by-prettify"> const_pointer_cast</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #008;" cla=
ss=3D"styled-by-prettify">const</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> std</span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">::</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify">shared_ptr</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">&lt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
>U</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&gt;&amp=
;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> r</span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">)</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> noexcept</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"><br></span></code></span></code></sp=
an><code class=3D"prettyprint"><span style=3D"color: #000;" class=3D"styled=
-by-prettify"><br></span><span style=3D"color: #008;" class=3D"styled-by-pr=
ettify">template</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt=
;</span><span style=3D"color: #008;" class=3D"styled-by-prettify">class</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"> T</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: #=
008;" class=3D"styled-by-prettify">class</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"> U</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>std</span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">::</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify">shared_ptr</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">&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;</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"> reinterpret_p=
ointer_cast</span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>(</span><span style=3D"color: #008;" class=3D"styled-by-prettify">const</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> std</span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">::</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify">shared_ptr</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify">U</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">&gt;&amp;</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"> r</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">)</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> noexcept</span><span style=3D"color: #660;" class=3D"styled=
-by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"><br></span></code></div></code></div><br>If it were possible to overlo=
ad dynamic_cast const_cast and reinterpret_cast, this would have been unnec=
essary to have a different interface for shared pointers than for regular p=
ointers.<br><br><div style=3D"background-color: rgb(250, 250, 250); border-=
color: rgb(187, 187, 187); border-style: solid; border-width: 1px; overflow=
-wrap: break-word;" class=3D"prettyprint"><code class=3D"prettyprint"><div =
class=3D"subprettyprint"><table class=3D"t-dcl-begin"></table></div></code>=
</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/2f3f1821-385e-4357-bcf4-9a87312853fe%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/2f3f1821-385e-4357-bcf4-9a87312853fe=
%40isocpp.org</a>.<br />

------=_Part_17609_1346117342.1522144403475--

------=_Part_17608_1844072844.1522144403475--

.
