220 30191 <42463446.MPeEFdAbRV@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: Tue, 03 Jan 2017 17:12:34 -0200
Lines: 38
Approved: news@gmane.org
Message-ID: <42463446.MPeEFdAbRV@tjmaciei-mobl1>
References: <efdf2357-00a6-408a-8772-12f99135a880@isocpp.org> <2998762.etaySSRi7N@tjmaciei-mobl1> <d4b84145-05e8-452f-ba08-dae9bbe34e04@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
Content-Transfer-Encoding: quoted-printable
X-Trace: blaine.gmane.org 1483470759 26430 195.159.176.226 (3 Jan 2017 19:12:39 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Tue, 3 Jan 2017 19:12:39 +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+bncBCB4TK757YBRBJPPV7BQKGQE7GAZ74Q@isocpp.org Tue Jan 03 20:12:34 2017
Return-path: <std-proposals+bncBCB4TK757YBRBJPPV7BQKGQE7GAZ74Q@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-qk0-f199.google.com ([209.85.220.199])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCB4TK757YBRBJPPV7BQKGQE7GAZ74Q@isocpp.org>)
	id 1cOUVe-0006Ds-Eu
	for gclcip-std-proposals@m.gmane.org; Tue, 03 Jan 2017 20:12:34 +0100
Original-Received: by mail-qk0-f199.google.com with SMTP id c69sf1879187qkg.1
        for <gclcip-std-proposals@m.gmane.org>; Tue, 03 Jan 2017 11:12:39 -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:content-transfer-encoding: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=YYd83IepypTema5P95VKiegzRbyS11rC95NMrCFvqfo=;
        b=q4zqjt7t7kiNJ80uIylxM/bmw9MAoGlsCXFoWnO/Ylw7ZNu1jPb8lDR3xqkKhTR8VJ
         MH1spTiZQqIeFSXizwM/WSDGgQyVWh9JFScLci0goskRaWQG+nGab9V27dpGH3zD1qxb
         R5AKyN6ffXBHkdueVxnuF7S0Ux+ej3IMvg6VqAPrMewJ/yEe/AWeDQTigXaFv8dRK9cK
         zbUe37RD7DZTINO5gKeJrBYX/eSMdXYkWLDrwjRro2XokOR1NwgUlAEsYqOmt/5C2Llk
         lYnqm+hmqyltE1UTi0Jv3+qi+VHBSAKAZYpgnTxo+4XCW5PHZI/+sprZHlRdgE5jbXea
      
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:content-transfer-encoding
         :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=YYd83IepypTema5P95VKiegzRbyS11rC95NMrCFvqfo=;
        b=ShMoWUZvmcqIh9puskEuOwVZ9L1nF7tgP4+dqrj4DSOao8BxhNdmGMiHvTAgYZDoR2
         q5BPYR2kAjXAhlTA5RWWCAbx6G0zUlH6hHXNaKGTParBGvsIzBmdTe/nVhsPY6Ky8CW6
         pWcPgjsRua3xfvK3z08+WT5jecNBosNlihx9W49GTHA6UUNFeETywy82tXV7RLDGpRuS
         zDtCfpF/0BM+rMWlrPXFz/vxMH8j8Y3zrxRBymnZ+pAhwT/KcnRq72dccGgj2jw3XIA2
         tYGeZz6RN0sdkoex+Jo5KzVzu/ZJmDXKF6BuADRtTpS2mQgAVGypMTq6e6XtLWtZf/Cm
  
X-Gm-Message-State: AIkVDXIerC24ALtNesDu9+M7qS632O+mJaVOzP9nHS5gM8v5YRLYOl4v+GxuvEdFVwfE7g==
X-Received: by 10.200.51.11 with SMTP id t11mr15522058qta.23.1483470758548;
        Tue, 03 Jan 2017 11:12:38 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.157.5.41 with SMTP id 38ls18583321otw.35.gmail; Tue, 03 Jan
 2017 11:12:37 -0800 (PST)
X-Received: by 10.55.143.195 with SMTP id r186mr68039537qkd.152.1483470757771;
        Tue, 03 Jan 2017 11:12:37 -0800 (PST)
Original-Received: from gondolin.macieira.info (gondolin.macieira.info. [2a01:4f8:d13:f81:21c:14ff:fe01:12a3])
        by mx.google.com with ESMTP id m127si33407555qke.66.2017.01.03.11.12.37
        for <std-proposals@isocpp.org>;
        Tue, 03 Jan 2017 11:12:37 -0800 (PST)
Received-SPF: pass (google.com: domain of thiago@macieira.org designates 2a01:4f8:d13:f81:21c:14ff:fe01:12a3 as permitted sender) client-ip=2a01:4f8:d13:f81:21c:14ff:fe01:12a3;
Original-Received: from tjmaciei-mobl1.localnet (unknown [187.34.234.250])
	by gondolin.macieira.info (Postfix) with ESMTPSA id B150711B7FF
	for <std-proposals@isocpp.org>; Tue,  3 Jan 2017 11:12:36 -0800 (PST)
In-Reply-To: <d4b84145-05e8-452f-ba08-dae9bbe34e04@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 2a01:4f8:d13:f81:21c:14ff:fe01:12a3
 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:30191
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/30191>

On ter=C3=A7a-feira, 3 de janeiro de 2017 08:22:52 BRST m.cencora@gmail.com=
 wrote:
> > How do you know whether a use of enum_cast is compile-time or whether i=
t
> > is
> > runtime?
>=20
> I don't know and I don't care. The function should be constexpr to suppor=
t
> both cases.

Well, I think people may care. A constexpr invocation has zero cost at=20
runtime, since it will have failed to convert by producing an error message=
,=20
or it will succeed by becoming a no-op (like static_cast, minus pointer=20
adjustment). But a non-constexpr invocation will have a runtime cost.

> What I'd like to hear now is whether anyone else would find such a
> functionality useful?
> Do you consider it a good idea to put it into C++ standard/library?

Maybe you should rename it to mean a check if the value is a valid enumerat=
or=20
and drop the "cast" part.

--=20
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center

--=20
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 e=
mail 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/42463446.MPeEFdAbRV%40tjmaciei-mobl1.

.
