220 33573 <5aa1302e-36e6-499d-8936-ebd523f293f9@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Nicol Bolas <jmckesson@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: Catch block for multiple exceptions
Date: Thu, 3 Aug 2017 16:49:45 -0700 (PDT)
Lines: 295
Approved: news@gmane.org
Message-ID: <5aa1302e-36e6-499d-8936-ebd523f293f9@isocpp.org>
References: <effe744d-f832-42c7-9b2a-ef31551067d0@isocpp.org>
 <deaedeb0-a699-49e9-826a-c41e674902c0@isocpp.org> <CAEfefmzCWDwP2ha7UfvvPrW_56TT4DEgvwRyxWm=6gS_GZc7pA@mail.gmail.com>
 <4126837.jZlGhgVnua@tjmaciei-mobl1> <d14636de-fb57-47b3-8666-7976ccdb6fe8@isocpp.org>
 <d58143f8-c128-3745-b835-1e04a5760d0d@gmail.com> <CA+fGSbMB3=H4hetWu3GFPzUskLP_sh0Q=Q4oxsUsZ6ci-jrpxg@mail.gmail.com>
 <CAFk2RUbdEQMQB4qLCDeaHeF0Q4ntbZG7-Cuf0X2G8d5+Dpf1Pw@mail.gmail.com> <54580edb-4a76-4241-b5c8-19ccbc1a562e@isocpp.org>
 <CAFk2RUZncz91iozp5d=WVhPCHwLa67dhmpwBRMEU5xioJvPuRA@mail.gmail.com>
 <4c872807-7d50-4b58-bbb5-595a8bac1246@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_257_257773712.1501804185993"
X-Trace: blaine.gmane.org 1501804188 19073 195.159.176.226 (3 Aug 2017 23:49:48 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Thu, 3 Aug 2017 23:49:48 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCEKFTV6ZUMBBGXNR3GAKGQE67R4IDA@isocpp.org Fri Aug 04 01:49:43 2017
Return-path: <std-proposals+bncBCEKFTV6ZUMBBGXNR3GAKGQE67R4IDA@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-io0-f199.google.com ([209.85.223.199])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCEKFTV6ZUMBBGXNR3GAKGQE67R4IDA@isocpp.org>)
	id 1ddPs6-0004cs-KK
	for gclcip-std-proposals@m.gmane.org; Fri, 04 Aug 2017 01:49:42 +0200
Original-Received: by mail-io0-f199.google.com with SMTP id s23sf1496723ioe.8
        for <gclcip-std-proposals@m.gmane.org>; Thu, 03 Aug 2017 16:49:48 -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=7N8+xhG9K2WPD2NDSviEL1vpXLJHQl07Oh0N6mhG4qk=;
        b=vuw3M347sViQH0zfDOqj9la0w2Ls57zUKbzYQ4K7I6RRi198hMZaGCrkXyrQRyDZ6f
         cCzVmNQBpJPfXuwanxr1jsvyMuQQ55Yk1VdI8dNURys3lWqt7UruNKGZ9H0tbgNpLqAe
         PgtYQTnOZ7y9zMUH3XaKUfS3h5AJ03HYIPB4R+oZ/lUQO2wcNNWcGMKiWsA8Sfb7pJ1a
         Orj35Hpxe+0ABdPF3DfGVg6K6IgIKwBwWXRmMarlfjOqAeXZVfiHq5pB8ombkehJO1w9
         zysmTshrTJ8D9ZYvGrg/Ok9vX8s/Dc7C3yDUtci7/IN5paoiNHme0MW6P4agA6DNnLF7
         rqHQ==
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=7N8+xhG9K2WPD2NDSviEL1vpXLJHQl07Oh0N6mhG4qk=;
        b=R7Ry7ML+/2/eA1ey5LItRH8Qfp0pF8qzrEHBRpurq2jMRsxTu2Y+xe1DdAajykvFN3
         N+jHkJE2doOjvF7cvmZTkUy9BqAy4Yh7ryFKA9ZlnhjG26+XdVgZOmIB5y+5sXx3Q4br
         702eE2GpMgXVtmBzaZv4pgjjD6lgQpsSsOfW0PNv77jWrt0ot8aFKxUWUUO72cRalHap
         2JANcVfDQpWbIQZjLjX/M7iI/yQF5c7M3dxBQYAZIrSrN2tmZHPTXKYm5ec++JgnkTHz
         hLk+cmOIL5bvmzBjPcwG/HOKiak8csnYaTueSycSDoC9fRyjAhO+vhNOzyOzxmmieBjd
         b3iw==
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=7N8+xhG9K2WPD2NDSviEL1vpXLJHQl07Oh0N6mhG4qk=;
        b=RGUrR3CPt3QA6J0fjC7KMC1aFw+ia506LVF88MuKSwFtKfXDRmALYrjQmPkLOMq6wy
         G09JEfgNETSC7N7UM2kAh9KptjCi7Kn7OhlNyaIHoZtaR+utrvvcJdWKn/wLu8Wztv/A
         oq04Zr0BkeFSas4eW2RFuHsJqp110aw5uJMG+Iof/Nt9s+RSs7M5Xr8Yn9vWZ0xLaQVV
         UpM5iYOWuIwnDfcL/+f6n6BkmE9KXZbYd1YADz6t9bVBgVHxoRq5NRpgabKDaIc/07nq
         a3gzuRQbc7+4DER9dSeE+x6vVDF8yTKM5vg/N77WY+y1YnkUMtAhqq0wEM1MdDXqGQ2M
         IKSQ==
X-Gm-Message-State: AIVw1137dQXzQTZBh+kFQFrDJ/yKZMzhCKsQ3IMhlX+SQaRoMt+0Gpfm
	jefHALS3Exthm0LF
X-Received: by 10.107.28.6 with SMTP id c6mr439423ioc.70.1501804188157;
        Thu, 03 Aug 2017 16:49:48 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.107.192.65 with SMTP id q62ls2377889iof.0.gmail; Thu, 03 Aug
 2017 16:49:46 -0700 (PDT)
X-Received: by 10.31.169.17 with SMTP id s17mr2381vke.11.1501804186491;
        Thu, 03 Aug 2017 16:49:46 -0700 (PDT)
In-Reply-To: <4c872807-7d50-4b58-bbb5-595a8bac1246@isocpp.org>
X-Original-Sender: jmckesson@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:33573
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/33573>

------=_Part_257_257773712.1501804185993
Content-Type: multipart/alternative; 
	boundary="----=_Part_258_1000085904.1501804185994"

------=_Part_258_1000085904.1501804185994
Content-Type: text/plain; charset="UTF-8"

On Thursday, August 3, 2017 at 7:17:43 PM UTC-4, Arthur O'Dwyer wrote:
>
> On Wednesday, August 2, 2017 at 4:38:01 PM UTC-7, Ville Voutilainen wrote:
>>
>>
>> Note that both of our solutions suffer from the problem that the code 
>> in the catch-clause 
>> cannot break, continue, goto or return like plain code could. An 
>> if-else chain of any_casts 
>> from exception_ptr would be able to do that. 
>>
>
> Do you think LEWG would be amenable to a proposal to make std::any_cast an 
> all-purpose "type-un-erasing" mechanism in C++2a?
> Right now we have a different type-un-erasure mechanism for each 
> type-erased type, and more proliferating with each revision of the Standard:
>
> std::any a = xx;assert( std::any_cast<Type>(a) == 42 );
> std::function<long()> f = xx;assert( *f.target<Type>() == xx );
> std::shared_ptr<int> p(new int, xx);assert( *std::get_deleter<Type>(p) == xx );
>
> (from 
> https://stackoverflow.com/questions/44788017/retrieve-typeid-of-shared-ptr-deleter
> )
> (and from this thread, we can add std::exception_ptr to the list of 
> type-erased types)
>
> I'm not sure "any_cast" would necessarily be the right spelling, but it is 
> pretty awkward IMHO that various library designers keep reinventing it over 
> and over with different spellings.
>
>
Well, `any_cast` is most definitely not the right spelling. As shown with 
`shared_ptr`,  the deleter is something that is separate from the main 
purpose of `shared_ptr`, so getting at it requires an interface that 
shouldn't look like `func_name(ptr)`.

You might do it by having `get_deleter<>` return an implementation-defined 
type that you can call `any_cast` or whatever on.

There's also the fact that it has to have different behavior. With 
`any_cast`, you can move the object out of the `any` (the `any` is still 
engaged with a moved-from value); with `function`, you don't have that 
power.

But this is all getting pretty far afield from the main topic.

-- 
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/5aa1302e-36e6-499d-8936-ebd523f293f9%40isocpp.org.

------=_Part_258_1000085904.1501804185994
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Thursday, August 3, 2017 at 7:17:43 PM UTC-4, Arthur O&=
#39;Dwyer wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin=
-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"lt=
r">On Wednesday, August 2, 2017 at 4:38:01 PM UTC-7, Ville Voutilainen wrot=
e:<blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;bor=
der-left:1px #ccc solid;padding-left:1ex">
<br>Note that both of our solutions suffer from the problem that the code
<br>in the catch-clause
<br>cannot break, continue, goto or return like plain code could. An
<br>if-else chain of any_casts
<br>from exception_ptr would be able to do that.
<br></blockquote><div><br></div><div>Do you think LEWG would be amenable to=
 a proposal to make std::any_cast an all-purpose &quot;type-un-erasing&quot=
; mechanism in C++2a?</div><div>Right now we have a different type-un-erasu=
re mechanism for each type-erased type, and more proliferating with each re=
vision of the Standard:</div><div><br></div><div><pre style=3D"margin-botto=
m:1em;padding:5px;font-family:Consolas,Menlo,Monaco,&#39;Lucida Console&#39=
;,&#39;Liberation Mono&#39;,&#39;DejaVu Sans Mono&#39;,&#39;Bitstream Vera =
Sans Mono&#39;,&#39;Courier New&#39;,monospace,sans-serif;line-height:inher=
it;vertical-align:baseline;width:auto;max-height:600px;overflow:auto;backgr=
ound-color:rgb(239,240,241);color:rgb(57,51,24);word-wrap:normal"><code sty=
le=3D"font-family:Consolas,Menlo,Monaco,&#39;Lucida Console&#39;,&#39;Liber=
ation Mono&#39;,&#39;DejaVu Sans Mono&#39;,&#39;Bitstream Vera Sans Mono&#3=
9;,&#39;Courier New&#39;,monospace,sans-serif;font-style:inherit;line-heigh=
t:inherit;vertical-align:baseline;white-space:inherit"><span style=3D"font-=
family:inherit;font-size:inherit;font-style:inherit;line-height:inherit;ver=
tical-align:baseline;color:rgb(48,51,54)">std</span><span style=3D"font-fam=
ily:inherit;font-size:inherit;font-style:inherit;line-height:inherit;vertic=
al-align:baseline;color:rgb(48,51,54)">::</span><span style=3D"font-family:=
inherit;font-size:inherit;font-style:inherit;line-height:inherit;vertical-a=
lign:baseline;color:rgb(48,51,54)">any a </span><span style=3D"font-family:=
inherit;font-size:inherit;font-style:inherit;line-height:inherit;vertical-a=
lign:baseline;color:rgb(48,51,54)">=3D</span><span style=3D"font-family:inh=
erit;font-size:inherit;font-style:inherit;line-height:inherit;vertical-alig=
n:baseline;color:rgb(48,51,54)"> xx</span><span style=3D"font-family:inheri=
t;font-size:inherit;font-style:inherit;line-height:inherit;vertical-align:b=
aseline;color:rgb(48,51,54)">;</span><span style=3D"font-family:inherit;fon=
t-size:inherit;font-style:inherit;line-height:inherit;vertical-align:baseli=
ne;color:rgb(48,51,54)">
</span><span style=3D"font-family:inherit;font-size:inherit;font-style:inhe=
rit;line-height:inherit;vertical-align:baseline;color:rgb(16,16,148)">asser=
t</span><span style=3D"font-family:inherit;font-size:inherit;font-style:inh=
erit;line-height:inherit;vertical-align:baseline;color:rgb(48,51,54)">(</sp=
an><span style=3D"font-family:inherit;font-size:inherit;font-style:inherit;=
line-height:inherit;vertical-align:baseline;color:rgb(48,51,54)"> std</span=
><span style=3D"font-family:inherit;font-size:inherit;font-style:inherit;li=
ne-height:inherit;vertical-align:baseline;color:rgb(48,51,54)">::</span><sp=
an style=3D"font-family:inherit;font-size:inherit;font-style:inherit;line-h=
eight:inherit;vertical-align:baseline;color:rgb(48,51,54)">any_cast</span><=
span style=3D"font-family:inherit;font-size:inherit;font-style:inherit;line=
-height:inherit;vertical-align:baseline;color:rgb(48,51,54)">&lt;</span><sp=
an style=3D"font-family:inherit;font-size:inherit;font-style:inherit;line-h=
eight:inherit;vertical-align:baseline;color:rgb(43,145,175)">Type</span><sp=
an style=3D"font-family:inherit;font-size:inherit;font-style:inherit;line-h=
eight:inherit;vertical-align:baseline;color:rgb(48,51,54)">&gt;(</span><spa=
n style=3D"font-family:inherit;font-size:inherit;font-style:inherit;line-he=
ight:inherit;vertical-align:baseline;color:rgb(48,51,54)">a</span><span sty=
le=3D"font-family:inherit;font-size:inherit;font-style:inherit;line-height:=
inherit;vertical-align:baseline;color:rgb(48,51,54)">)</span><span style=3D=
"font-family:inherit;font-size:inherit;font-style:inherit;line-height:inher=
it;vertical-align:baseline;color:rgb(48,51,54)"> </span><span style=3D"font=
-family:inherit;font-size:inherit;font-style:inherit;line-height:inherit;ve=
rtical-align:baseline;color:rgb(48,51,54)">=3D=3D</span><span style=3D"font=
-family:inherit;font-size:inherit;font-style:inherit;line-height:inherit;ve=
rtical-align:baseline;color:rgb(48,51,54)"> </span><span style=3D"font-fami=
ly:inherit;font-size:inherit;font-style:inherit;line-height:inherit;vertica=
l-align:baseline;color:rgb(125,39,39)">42</span><span style=3D"font-family:=
inherit;font-size:inherit;font-style:inherit;line-height:inherit;vertical-a=
lign:baseline;color:rgb(48,51,54)"> </span><span style=3D"font-family:inher=
it;font-size:inherit;font-style:inherit;line-height:inherit;vertical-align:=
baseline;color:rgb(48,51,54)">);</span><span style=3D"font-family:inherit;f=
ont-size:inherit;font-style:inherit;line-height:inherit;vertical-align:base=
line;color:rgb(48,51,54)">

</span><span style=3D"font-family:inherit;font-size:inherit;font-style:inhe=
rit;line-height:inherit;vertical-align:baseline;color:rgb(48,51,54)">std</s=
pan><span style=3D"font-family:inherit;font-size:inherit;font-style:inherit=
;line-height:inherit;vertical-align:baseline;color:rgb(48,51,54)">::</span>=
<span style=3D"font-family:inherit;font-size:inherit;font-style:inherit;lin=
e-height:inherit;vertical-align:baseline;color:rgb(16,16,148)">function</sp=
an><span style=3D"font-family:inherit;font-size:inherit;font-style:inherit;=
line-height:inherit;vertical-align:baseline;color:rgb(48,51,54)">&lt;</span=
><span style=3D"font-family:inherit;font-size:inherit;font-style:inherit;li=
ne-height:inherit;vertical-align:baseline;color:rgb(16,16,148)">long</span>=
<span style=3D"font-family:inherit;font-size:inherit;font-style:inherit;lin=
e-height:inherit;vertical-align:baseline;color:rgb(48,51,54)">()&gt;</span>=
<span style=3D"font-family:inherit;font-size:inherit;font-style:inherit;lin=
e-height:inherit;vertical-align:baseline;color:rgb(48,51,54)"> f </span><sp=
an style=3D"font-family:inherit;font-size:inherit;font-style:inherit;line-h=
eight:inherit;vertical-align:baseline;color:rgb(48,51,54)">=3D</span><span =
style=3D"font-family:inherit;font-size:inherit;font-style:inherit;line-heig=
ht:inherit;vertical-align:baseline;color:rgb(48,51,54)"> xx</span><span sty=
le=3D"font-family:inherit;font-size:inherit;font-style:inherit;line-height:=
inherit;vertical-align:baseline;color:rgb(48,51,54)">;</span><span style=3D=
"font-family:inherit;font-size:inherit;font-style:inherit;line-height:inher=
it;vertical-align:baseline;color:rgb(48,51,54)">
</span><span style=3D"font-family:inherit;font-size:inherit;font-style:inhe=
rit;line-height:inherit;vertical-align:baseline;color:rgb(16,16,148)">asser=
t</span><span style=3D"font-family:inherit;font-size:inherit;font-style:inh=
erit;line-height:inherit;vertical-align:baseline;color:rgb(48,51,54)">(</sp=
an><span style=3D"font-family:inherit;font-size:inherit;font-style:inherit;=
line-height:inherit;vertical-align:baseline;color:rgb(48,51,54)"> </span><s=
pan style=3D"font-family:inherit;font-size:inherit;font-style:inherit;line-=
height:inherit;vertical-align:baseline;color:rgb(48,51,54)">*</span><span s=
tyle=3D"font-family:inherit;font-size:inherit;font-style:inherit;line-heigh=
t:inherit;vertical-align:baseline;color:rgb(48,51,54)">f</span><span style=
=3D"font-family:inherit;font-size:inherit;font-style:inherit;line-height:in=
herit;vertical-align:baseline;color:rgb(48,51,54)">.</span><span style=3D"f=
ont-family:inherit;font-size:inherit;font-style:inherit;line-height:inherit=
;vertical-align:baseline;color:rgb(48,51,54)">target</span><span style=3D"f=
ont-family:inherit;font-size:inherit;font-style:inherit;line-height:inherit=
;vertical-align:baseline;color:rgb(48,51,54)">&lt;</span><span style=3D"fon=
t-family:inherit;font-size:inherit;font-style:inherit;line-height:inherit;v=
ertical-align:baseline;color:rgb(43,145,175)">Type</span><span style=3D"fon=
t-family:inherit;font-size:inherit;font-style:inherit;line-height:inherit;v=
ertical-align:baseline;color:rgb(48,51,54)">&gt;()</span><span style=3D"fon=
t-family:inherit;font-size:inherit;font-style:inherit;line-height:inherit;v=
ertical-align:baseline;color:rgb(48,51,54)"> </span><span style=3D"font-fam=
ily:inherit;font-size:inherit;font-style:inherit;line-height:inherit;vertic=
al-align:baseline;color:rgb(48,51,54)">=3D=3D</span><span style=3D"font-fam=
ily:inherit;font-size:inherit;font-style:inherit;line-height:inherit;vertic=
al-align:baseline;color:rgb(48,51,54)"> xx </span><span style=3D"font-famil=
y:inherit;font-size:inherit;font-style:inherit;line-height:inherit;vertical=
-align:baseline;color:rgb(48,51,54)">);</span><span style=3D"font-family:in=
herit;font-size:inherit;font-style:inherit;line-height:inherit;vertical-ali=
gn:baseline;color:rgb(48,51,54)">

</span><span style=3D"font-family:inherit;font-size:inherit;font-style:inhe=
rit;line-height:inherit;vertical-align:baseline;color:rgb(48,51,54)">std</s=
pan><span style=3D"font-family:inherit;font-size:inherit;font-style:inherit=
;line-height:inherit;vertical-align:baseline;color:rgb(48,51,54)">::</span>=
<span style=3D"font-family:inherit;font-size:inherit;font-style:inherit;lin=
e-height:inherit;vertical-align:baseline;color:rgb(48,51,54)">shared_ptr</s=
pan><span style=3D"font-family:inherit;font-size:inherit;font-style:inherit=
;line-height:inherit;vertical-align:baseline;color:rgb(125,39,39)">&lt;int&=
gt;</span><span style=3D"font-family:inherit;font-size:inherit;font-style:i=
nherit;line-height:inherit;vertical-align:baseline;color:rgb(48,51,54)"> p<=
/span><span style=3D"font-family:inherit;font-size:inherit;font-style:inher=
it;line-height:inherit;vertical-align:baseline;color:rgb(48,51,54)">(</span=
><span style=3D"font-family:inherit;font-size:inherit;font-style:inherit;li=
ne-height:inherit;vertical-align:baseline;color:rgb(16,16,148)">new</span><=
span style=3D"font-family:inherit;font-size:inherit;font-style:inherit;line=
-height:inherit;vertical-align:baseline;color:rgb(48,51,54)"> </span><span =
style=3D"font-family:inherit;font-size:inherit;font-style:inherit;line-heig=
ht:inherit;vertical-align:baseline;color:rgb(16,16,148)">int</span><span st=
yle=3D"font-family:inherit;font-size:inherit;font-style:inherit;line-height=
:inherit;vertical-align:baseline;color:rgb(48,51,54)">,</span><span style=
=3D"font-family:inherit;font-size:inherit;font-style:inherit;line-height:in=
herit;vertical-align:baseline;color:rgb(48,51,54)"> xx</span><span style=3D=
"font-family:inherit;font-size:inherit;font-style:inherit;line-height:inher=
it;vertical-align:baseline;color:rgb(48,51,54)">);</span><span style=3D"fon=
t-family:inherit;font-size:inherit;font-style:inherit;line-height:inherit;v=
ertical-align:baseline;color:rgb(48,51,54)">
</span><span style=3D"font-family:inherit;font-size:inherit;font-style:inhe=
rit;line-height:inherit;vertical-align:baseline;color:rgb(16,16,148)">asser=
t</span><span style=3D"font-family:inherit;font-size:inherit;font-style:inh=
erit;line-height:inherit;vertical-align:baseline;color:rgb(48,51,54)">(</sp=
an><span style=3D"font-family:inherit;font-size:inherit;font-style:inherit;=
line-height:inherit;vertical-align:baseline;color:rgb(48,51,54)"> </span><s=
pan style=3D"font-family:inherit;font-size:inherit;font-style:inherit;line-=
height:inherit;vertical-align:baseline;color:rgb(48,51,54)">*</span><span s=
tyle=3D"font-family:inherit;font-size:inherit;font-style:inherit;line-heigh=
t:inherit;vertical-align:baseline;color:rgb(48,51,54)">std</span><span styl=
e=3D"font-family:inherit;font-size:inherit;font-style:inherit;line-height:i=
nherit;vertical-align:baseline;color:rgb(48,51,54)">::</span><span style=3D=
"font-family:inherit;font-size:inherit;font-style:inherit;line-height:inher=
it;vertical-align:baseline;color:rgb(48,51,54)">get_deleter</span><span sty=
le=3D"font-family:inherit;font-size:inherit;font-style:inherit;line-height:=
inherit;vertical-align:baseline;color:rgb(48,51,54)">&lt;</span><span style=
=3D"font-family:inherit;font-size:inherit;font-style:inherit;line-height:in=
herit;vertical-align:baseline;color:rgb(43,145,175)">Type</span><span style=
=3D"font-family:inherit;font-size:inherit;font-style:inherit;line-height:in=
herit;vertical-align:baseline;color:rgb(48,51,54)">&gt;(</span><span style=
=3D"font-family:inherit;font-size:inherit;font-style:inherit;line-height:in=
herit;vertical-align:baseline;color:rgb(48,51,54)">p</span><span style=3D"f=
ont-family:inherit;font-size:inherit;font-style:inherit;line-height:inherit=
;vertical-align:baseline;color:rgb(48,51,54)">)</span><span style=3D"font-f=
amily:inherit;font-size:inherit;font-style:inherit;line-height:inherit;vert=
ical-align:baseline;color:rgb(48,51,54)"> </span><span style=3D"font-family=
:inherit;font-size:inherit;font-style:inherit;line-height:inherit;vertical-=
align:baseline;color:rgb(48,51,54)">=3D=3D</span><span style=3D"font-family=
:inherit;font-size:inherit;font-style:inherit;line-height:inherit;vertical-=
align:baseline;color:rgb(48,51,54)"> xx </span><span style=3D"font-family:i=
nherit;font-size:inherit;font-style:inherit;line-height:inherit;vertical-al=
ign:baseline;color:rgb(48,51,54)">);</span></code></pre></div><div>(from=C2=
=A0<a href=3D"https://stackoverflow.com/questions/44788017/retrieve-typeid-=
of-shared-ptr-deleter" target=3D"_blank" rel=3D"nofollow" onmousedown=3D"th=
is.href=3D&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fstackoverflow.=
com%2Fquestions%2F44788017%2Fretrieve-typeid-of-shared-ptr-deleter\x26sa\x3=
dD\x26sntz\x3d1\x26usg\x3dAFQjCNEUHb8eX4u48og52SpAhJYZOgvDxA&#39;;return tr=
ue;" onclick=3D"this.href=3D&#39;https://www.google.com/url?q\x3dhttps%3A%2=
F%2Fstackoverflow.com%2Fquestions%2F44788017%2Fretrieve-typeid-of-shared-pt=
r-deleter\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEUHb8eX4u48og52SpAhJYZOgv=
DxA&#39;;return true;">https://stackoverflow.<wbr>com/questions/44788017/<w=
br>retrieve-typeid-of-shared-ptr-<wbr>deleter</a>)<br></div><div>(and from =
this thread, we can add std::exception_ptr to the list of type-erased types=
)</div><div><br></div><div>I&#39;m not sure &quot;any_cast&quot; would nece=
ssarily be the right spelling, but it is pretty awkward IMHO that various l=
ibrary designers keep reinventing it over and over with different spellings=
..</div><br></div></blockquote><div><br>Well, `any_cast` is most definitely =
not the right spelling. As shown with `shared_ptr`,=C2=A0 the deleter is so=
mething that is separate from the main purpose of `shared_ptr`, so getting =
at it requires an interface that shouldn&#39;t look like `func_name(ptr)`.<=
br><br>You might do it by having `get_deleter&lt;&gt;` return an implementa=
tion-defined type that you can call `any_cast` or whatever on.<br><br>There=
&#39;s also the fact that it has to have different behavior. With `any_cast=
`, you can move the object out of the `any` (the `any` is still engaged wit=
h a moved-from value); with `function`, you don&#39;t have that power.<br><=
br>But this is all getting pretty far afield from the main topic.<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/5aa1302e-36e6-499d-8936-ebd523f293f9%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/5aa1302e-36e6-499d-8936-ebd523f293f9=
%40isocpp.org</a>.<br />

------=_Part_258_1000085904.1501804185994--

------=_Part_257_257773712.1501804185993--

.
