220 33552 <CAFk2RUZncz91iozp5d=WVhPCHwLa67dhmpwBRMEU5xioJvPuRA@mail.gmail.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Ville Voutilainen <ville.voutilainen@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: Catch block for multiple exceptions
Date: Thu, 3 Aug 2017 02:37:58 +0300
Lines: 40
Approved: news@gmane.org
Message-ID: <CAFk2RUZncz91iozp5d=WVhPCHwLa67dhmpwBRMEU5xioJvPuRA@mail.gmail.com>
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>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Trace: blaine.gmane.org 1501717086 3794 195.159.176.226 (2 Aug 2017 23:38:06 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Wed, 2 Aug 2017 23:38:06 +0000 (UTC)
To: "ISO C++ Standard - Future Proposals" <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBC5JHI7A7ALRBV6ERHGAKGQE5NYOIFI@isocpp.org Thu Aug 03 01:38:02 2017
Return-path: <std-proposals+bncBC5JHI7A7ALRBV6ERHGAKGQE5NYOIFI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-pf0-f199.google.com ([209.85.192.199])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBC5JHI7A7ALRBV6ERHGAKGQE5NYOIFI@isocpp.org>)
	id 1dd3D9-0000ST-OS
	for gclcip-std-proposals@m.gmane.org; Thu, 03 Aug 2017 01:37:55 +0200
Original-Received: by mail-pf0-f199.google.com with SMTP id r62sf58873425pfj.1
        for <gclcip-std-proposals@m.gmane.org>; Wed, 02 Aug 2017 16:38:01 -0700 (PDT)
ARC-Seal: i=2; a=rsa-sha256; t=1501717081; cv=pass;
        d=google.com; s=arc-20160816;
        b=Jvq66oolaMEKbq1/0X44ICPbdhgl1+DW07ToNbTYT40b6V2A60b0l4LZSn5mu5ROT4
         zGjbQHURU8YCbmDpM+8vMccQwni7y/1TgjA9qM/mnaLkYnBcpPUeHaDU8HEreQBfd6k4
         mBZOrYE65PjfviaGbmUfjGWLACGEMCpNp99dSTQK3LxBPKoENkIG7IMYX2YrNm3Ye2nw
         agiRXj+h9VlVLeCAysQBR579Ha595N0yn3q/3rvfJRXWA9nVVia9CsO6JDmh8z4uvpm6
         k+YmmKOvJxBY4LxZA5LLwTx32aka6InMWQo23NMhTp2AkUwzAa/qaNY2Py1nAxsaxW67
         scBA==
ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post
         :list-id:mailing-list:precedence:reply-to:to:subject:message-id:date
         :from:references:in-reply-to:mime-version:arc-authentication-results
         :arc-message-signature:dkim-signature:arc-authentication-results;
        bh=xEMld5DUn5X+k7kXOoQCjV3kF/clSY4hzUFMjjEEeig=;
        b=tkmL/HJHimyloSvdIpzzCI+8GTnMKh2HdZH9hc/cDub5PL0M9Ff2w2ApAMEHfpoINi
         ZGLD1+v5XBp5mhCAOT1mXDZ5aXS7BpTBy0HnPz2JTqW5Z1QK5kWtOhGhmK/IwXJxxqX6
         TfrEQLK31b0DLP9JM9pD6Jb7TBVhOO4qu/K2+TSvWHwUo3AbkBKRp/6LLxsF1QgG0kvB
         HppLgLAZypeloh90R0iHnsLLIQ26dDiaP8ZcFR/ICsX7c6eX4/JzyupzRePju1wqwEBn
         +oRwZEGOF/8cg3qrKsTOGW9NV0HyOHuADqlxZR8muZ5QXl4Pg77PyHudYvQa+rwqocsP
         8f2g==
ARC-Authentication-Results: i=2; mx.google.com;
       dkim=pass header.i=@gmail.com header.b=vI4MZ2gh;
       spf=pass (google.com: domain of ville.voutilainen@gmail.com designates 2607:f8b0:400c:c08::242 as permitted sender) smtp.mailfrom=ville.voutilainen@gmail.com;
       dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=mime-version:in-reply-to:references:from:date:message-id:subject: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;
        bh=xEMld5DUn5X+k7kXOoQCjV3kF/clSY4hzUFMjjEEeig=;
        b=DSRKNVDVXUISjqHnFkRryitPUJ6L7w2Pah5uE4l/mrWYmkkQYyaEBkX7m0viPm3wGD
         3yWKRt3EXsS25Jux3bwFObclrKD3zPoOu6HA6sTw23yxfJU1Fza96iuE6jgXlQhXwYhn
         ks78ETR/Q6TXyuUUpekFhKb3IXsvSG/HQVdx3cX8/YFs1wqJeaGivIGGisoCjfsIpP25
         5sfWPfjOWHniwgXQBS2UM4KJd+8o4zlcDrSDnESQmzXCat31WdYzn3joFZKgP3sJBdcC
         kvKKOWi6pooJxaOrFGGJbk3o4yKHsW7XMt2CxJaVEKMqQMqFjbU31BcW7rzC0pS2KGIs
         ZT3w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:mime-version:in-reply-to:references:from:date
         :message-id:subject: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=xEMld5DUn5X+k7kXOoQCjV3kF/clSY4hzUFMjjEEeig=;
        b=RwMdWVFsQxm+P/n5MXVViKbmJUdzlW34myRMpQgDTguGtJGl00x40M8J5785nkDBU9
         AqdmPMfysNq5WZiDKUdLJyjBT3SzlGt5XaQQGA5UbLJdCACRW7dVBZ3whcXI/AbNRC77
         XnOyhyrMIxLlw2F4lH3jX+F28pvVxpvqInP0NRRfS/5vksnK06ZbLWgiUlx7sFrgoVD+
         koKcrfHCcUy1slmQrkw2/XyrwNoFa5EmIj4bG4hFqsSUZcea8J4e6ecuFlG8QN+fLOkI
         KNt0weuO9v4WLB6m+RihboIcSU2WupJDUIcaTB/MvXhNyBVQj8bdhNt5SdY8l9ZVoZ5N
         q3Gg==
X-Gm-Message-State: AIVw110wBkDvnGeemya1VvxkDYnO3FM/G/EatOCrJUVfvDf6hPP6d4p/
	K/AidmJKNWqatu26
X-Received: by 10.99.147.75 with SMTP id w11mr17879328pgm.77.1501717081027;
        Wed, 02 Aug 2017 16:38:01 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.107.182.213 with SMTP id g204ls401604iof.29.gmail; Wed, 02 Aug
 2017 16:37:59 -0700 (PDT)
X-Received: by 10.159.60.171 with SMTP id s43mr19444913uai.47.1501717079710;
        Wed, 02 Aug 2017 16:37:59 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1501717079; cv=none;
        d=google.com; s=arc-20160816;
        b=zRcRckKHq8SdrwsTQ35gwrObjzUJ+KP9YhyGcBfqjCrjXdmbWUjrWyUHYz9N2rUaT5
         K8MVGhbCu4FetL04q1fe46tFt3DK1Kj/jpvcI6/cGzPDz9x+hIrLZASYqNfnpZrq45am
         wZu9dVpQtdELkqJsHNeVGnykumjDdTRmd5oeR+hfl53amVQyFYDAhlQtiFqt/UpuA+1Q
         Al4LbNBTK0ubxx/nIV6VNvFz1MLpXvDBElJkLc+ieC+DmDgrNczwNav0g6RWREKNgw6I
         Oh0yt/jpL68Z5wEKETZuE+CF+yz6XCYawheR/01LLT1KaUgYYiHZmsrsvUxtGw4rUYEh
         qz8A==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=to:subject:message-id:date:from:references:in-reply-to:mime-version
         :dkim-signature:arc-authentication-results;
        bh=IwKZIm90jenY4rqXn+9/NlOSgdSCFM56bKXd6M3F1DQ=;
        b=W1fDfl0BVs/fY8agQmg3x0QbjRHqT+8GkKtOBAjJHLt5LrcPQUn9dJfdu62cCAY/Zj
         V6tw5lkdxl5h1+KtVA02w4ngDYcL2sEHlc+lT29CjjyyUm0Dn0iLVxRrGRniU2/nSeY2
         Vh6h5yNdnZmscgfwJbAsMRr5z7fAmZszucaBxVDqL0zFbWV8xRsSxLoWMpztZC5WJNSS
         +pB3OBIQXi37DYp9zozz0qSlWPHbwbgMKBuwD0le/KJ++3sGq9XG+ZA3cQi0luqwtANy
         DnorSxeuM40mPvDEUbRFdQHjZLKNJ9whjXlOOY42eokLTXdnz9l1aZg8CwP/vTxJPQrG
         rk/w==
ARC-Authentication-Results: i=1; mx.google.com;
       dkim=pass header.i=@gmail.com header.b=vI4MZ2gh;
       spf=pass (google.com: domain of ville.voutilainen@gmail.com designates 2607:f8b0:400c:c08::242 as permitted sender) smtp.mailfrom=ville.voutilainen@gmail.com;
       dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com
Original-Received: from mail-ua0-x242.google.com (mail-ua0-x242.google.com. [2607:f8b0:400c:c08::242])
        by mx.google.com with ESMTPS id p30si8415776uad.373.2017.08.02.16.37.59
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Wed, 02 Aug 2017 16:37:59 -0700 (PDT)
Received-SPF: pass (google.com: domain of ville.voutilainen@gmail.com designates 2607:f8b0:400c:c08::242 as permitted sender) client-ip=2607:f8b0:400c:c08::242;
Original-Received: by mail-ua0-x242.google.com with SMTP id q25so3374963uah.0
        for <std-proposals@isocpp.org>; Wed, 02 Aug 2017 16:37:59 -0700 (PDT)
X-Received: by 10.159.60.34 with SMTP id u34mr17468397uah.69.1501717079047;
 Wed, 02 Aug 2017 16:37:59 -0700 (PDT)
Original-Received: by 10.103.103.65 with HTTP; Wed, 2 Aug 2017 16:37:58 -0700 (PDT)
In-Reply-To: <54580edb-4a76-4241-b5c8-19ccbc1a562e@isocpp.org>
X-Original-Sender: ville.voutilainen@gmail.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com header.b=vI4MZ2gh;       spf=pass (google.com: domain of
 ville.voutilainen@gmail.com designates 2607:f8b0:400c:c08::242 as permitted
 sender) smtp.mailfrom=ville.voutilainen@gmail.com;       dmarc=pass (p=NONE
 sp=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: <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:33552
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/33552>

On 3 August 2017 at 01:56, Arthur O'Dwyer <arthur.j.odwyer@gmail.com> wrote:
> FYI, this exact puzzle (variadic "catch") was discussed in the
> #meta_programming Slack channel on June 30th; participants were Vittorio
> Romeo, Barry Revzin, Eric Niebler, Peter Dimov, and myself (belatedly). My
> solution is here. Its punch line is:
>
>         try {
>             throw Derived();  // this is just a placeholder for some code
> that might throw
>         } catch (...) {
>             variant_catch<const Derived&, const Base&>([](auto&& e) {
>                 printf("caught %s (%s)\n", typeid(e).name(),
> __PRETTY_FUNCTION__);
>             });
>         }
>
> but with the caveat that this signature (also provided at the Wandbox link
> above) will be more performant (not that we care about the performance of
> the exceptional path, of course):
>
>     variant_catch<const Derived&, const Base&>([&]() {
>         throw Derived();  // this is just a placeholder for some code that
> might throw
>     }, [](auto&& e) {
>         printf("caught %s (%s)\n", typeid(e).name(), __PRETTY_FUNCTION__);
>     });


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.

-- 
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/CAFk2RUZncz91iozp5d%3DWVhPCHwLa67dhmpwBRMEU5xioJvPuRA%40mail.gmail.com.

.
