220 30228 <64617344.0Ggdhq6B90@tjmaciei-mobl1> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Thiago Macieira <thiago@macieira.org>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: enum_cast proposal
Date: Wed, 04 Jan 2017 12:29:35 -0200
Lines: 25
Approved: news@gmane.org
Message-ID: <64617344.0Ggdhq6B90@tjmaciei-mobl1>
References: <efdf2357-00a6-408a-8772-12f99135a880@isocpp.org> <42463446.MPeEFdAbRV@tjmaciei-mobl1> <1730f9cb-837d-4af3-a771-107e21de0adc@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 1483540221 31973 195.159.176.226 (4 Jan 2017 14:30:21 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Wed, 4 Jan 2017 14:30:21 +0000 (UTC)
User-Agent: KMail/5.3.3 (Linux/4.8.13-1-default; KDE/5.28.0; x86_64; ; )
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCB4TK757YBRB4UNWTBQKGQEKSMA33Q@isocpp.org Wed Jan 04 15:30:17 2017
Return-path: <std-proposals+bncBCB4TK757YBRB4UNWTBQKGQEKSMA33Q@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ua0-f199.google.com ([209.85.217.199])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCB4TK757YBRB4UNWTBQKGQEKSMA33Q@isocpp.org>)
	id 1cOmZr-0006wP-Tu
	for gclcip-std-proposals@m.gmane.org; Wed, 04 Jan 2017 15:30:08 +0100
Original-Received: by mail-ua0-f199.google.com with SMTP id s34sf420681805uas.2
        for <gclcip-std-proposals@m.gmane.org>; Wed, 04 Jan 2017 06:30:12 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=from:to:subject:date:message-id:user-agent:in-reply-to:references
         :mime-version: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=ATzjdO3jTwCMLNLfYzokKlzwe6lQS+XQa//cs2LB9J4=;
        b=E0Jk5qgQj6fGBSFGZQIJPnB1kv3jHsSlvl07lcjghA9NsJRRAv5QAbvHFZGUpKG+X3
         dNOet1TmgAGIPJbDEbFCao+RXPyFJk2zvXlQ4SEQ+N6Rh9RayGJy6ql2iWuCSy4aNney
         QXG2msgD4szV3Eft/XnjL9D6jzYCHxrtDk6ZyouiWPSShcya69dx+hWDzJ2XASm90Elo
         7B75TA2TG3fA43W6vxBWKYQH2GqF4S+6pCbmBDhlYDpfQKfwZaSKrYmQ/sipfqcmyipQ
         VVTHVCR/mDNW+I8SrieLtq6XHhazX1GDkhC9EkuPYc1V9PsvmI5lKbCrVlsT80anQ2fz
         kFmQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:from:to:subject:date:message-id:user-agent
         :in-reply-to:references:mime-version: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=ATzjdO3jTwCMLNLfYzokKlzwe6lQS+XQa//cs2LB9J4=;
        b=pameomSjKCbcRiGG12fpu8+UYuBtgpocPquPVVxpmyA4DOvHEq7f2Bru/hnQPiYqYn
         05OSHttQ15AsHLX3HV3zi6wPxQFKaO/WY/y/3umolIxXqAnLCcIZXSSMUkxJI4B7vRGL
         mBGpsAl1F9d7NtY90Hn7eZgIP5biv1bPaS99obsh1xEyc3W6szVnVNmNiA6ddBuSqw03
         HxWB/V0vcEotDg+KJ8YOcCUa1iMzwLnEXCD6Y6KAF7RWZWvlSCPFN4TGABzpm6Rrsh2i
         CC8heoZ3gDOgls7ETTNndemUuz0I8D/pQxrBww0qBzjbma42yTOUG8OZylnv3UhlXc39
         WqOQ==
X-Gm-Message-State: AIkVDXIZaou5tIEHyoxNTfNu9TFUcWBz5XyvD1jOaQ3f4qbuC8t5jYB6NVjweUHOS7QD4Q==
X-Received: by 10.176.75.3 with SMTP id h3mr30895732uaf.1.1483540211541;
        Wed, 04 Jan 2017 06:30:11 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.157.45.195 with SMTP id g61ls40712362otb.37.gmail; Wed, 04 Jan
 2017 06:30:10 -0800 (PST)
X-Received: by 10.237.33.69 with SMTP id 63mr60737323qtc.182.1483540210798;
        Wed, 04 Jan 2017 06:30:10 -0800 (PST)
Original-Received: from gondolin.macieira.info (gondolin.macieira.info. [78.47.120.188])
        by mx.google.com with ESMTP id s49si45222883qta.264.2017.01.04.06.30.10
        for <std-proposals@isocpp.org>;
        Wed, 04 Jan 2017 06:30:10 -0800 (PST)
Received-SPF: pass (google.com: domain of thiago@macieira.org designates 78.47.120.188 as permitted sender) client-ip=78.47.120.188;
Original-Received: from tjmaciei-mobl1.localnet (unknown [187.34.234.250])
	by gondolin.macieira.info (Postfix) with ESMTPSA id 432AE11B812
	for <std-proposals@isocpp.org>; Wed,  4 Jan 2017 06:30:09 -0800 (PST)
In-Reply-To: <1730f9cb-837d-4af3-a771-107e21de0adc@isocpp.org>
X-Original-Sender: thiago@macieira.org
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of thiago@macieira.org designates 78.47.120.188 as permitted sender) smtp.mailfrom=thiago@macieira.org
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:30228
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/30228>

On quarta-feira, 4 de janeiro de 2017 00:44:09 BRST m.cencora@gmail.com wrote:
> I thought about it, but I see no use case for just a check.
> In all the use cases I can think of user wants the cast after the check.
> 
> Do you have a example in mind where such a check without a cast later
> would be useful?

The problem is that a cast that can fail needs a way out. dynamic_cast can 
fail by returning nullptr (for pointers) or by throwing std::bad_cast (for 
references).

So you need to find a way to report that failure.

And I don't want exceptions in my code.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center

-- 
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/64617344.0Ggdhq6B90%40tjmaciei-mobl1.

.
