220 27941 <npn3iq$4ah$1@blaine.gmane.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Larry Evans <cppljevans@suddenlink.net>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Make (strongly typed) enums castable to char
 const * const
Date: Thu, 25 Aug 2016 10:41:15 -0500
Lines: 36
Approved: news@gmane.org
Message-ID: <npn3iq$4ah$1@blaine.gmane.org>
References: <1472132849.17129.9.camel@bsdforen.de>
 <CAFk2RUZiqeTBGir3fKehHzju6YDtbigdvThW=CsgkBSaExjrug@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
X-Trace: blaine.gmane.org 1472139696 11061 195.159.176.226 (25 Aug 2016 15:41:36 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Thu, 25 Aug 2016 15:41:36 +0000 (UTC)
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
 Thunderbird/45.2.0
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDAYTI72VMGRBJVD7S6QKGQEHEUQJHA@isocpp.org Thu Aug 25 17:41:30 2016
Return-path: <std-proposals+bncBDAYTI72VMGRBJVD7S6QKGQEHEUQJHA@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-lf0-f71.google.com ([209.85.215.71])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBDAYTI72VMGRBJVD7S6QKGQEHEUQJHA@isocpp.org>)
	id 1bcwmV-000241-9n
	for gclcip-std-proposals@m.gmane.org; Thu, 25 Aug 2016 17:41:27 +0200
Original-Received: by mail-lf0-f71.google.com with SMTP id 33sf34927803lfw.1
        for <gclcip-std-proposals@m.gmane.org>; Thu, 25 Aug 2016 08:41:28 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=to:from:subject:date:lines:message-id:references:mime-version
         :user-agent:in-reply-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=rKQvf3Xt3qT0ybliJUN+poFiT4pTROF+grqrb7CBaD0=;
        b=NZzS5RxIobev91L63Aj5lFlZBComlvDXDOyVw7cmgF1gsx6HckiXmxQELfNqbnK/C5
         h6/R3bWrOESo0j2SLQY450GPHKrQpnoqze0yTuJvcppbL5rJ/O+3k843GMRmMDUH2V2g
         E+3eSiO0lOzehSoMvnWPD1gI8zExPZkm+NYBrlBwyiXrR34bkqrx3OijTJcr/ciE9UUf
         pBsvd1/ISjZt23nJqlCLabzct1r627giwumrSz288IOkhnbebCjI8lMoDM8wy8zDEoG3
         03Sv6HZmc6UHlZiiSiKPNScUXM2Oo24dzgBAhS4Sa5BHTAuUxCcTA/KR+d5pWt2KjtRL
         dLFg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:to:from:subject:date:lines:message-id:references
         :mime-version:user-agent:in-reply-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=rKQvf3Xt3qT0ybliJUN+poFiT4pTROF+grqrb7CBaD0=;
        b=dnRRrHjtEG/M8El0dTFH7eOu2N1pw+IZjvUexaOegdgf6SQz8jom+3FvXO/ksaEE/y
         xug0MtjNwCGtWTOzBYuZgfcc4o4bGmWDnEOAJ2wGXZfHc8HhiQIt5+vlDXvnzeFVZtQH
         pBJc1nZYtPsPJ2Ih9ng1dRwU/m9c3YnvUojV+0Z8gPjdQp3+IS5xU+rCjFqieq5VZaiE
         368Zl+bPv4ggduLAnPrMNK6u5kLe8LLAJ0uCjisLBVME1u5Aeiy235ZUiCioDhDmwsL6
         f6qx0qzgc+k9judjfxFVwIFakRfkuKRlUSLxBp2roHDX3Orv58MCgyOLJMvZoRoHHreQ
         mXVA==
X-Gm-Message-State: AE9vXwO9heVzRnZOWqSO2F+oqZz1CXhyaT4cxl4czP2TA/BCdlfYVz16rzVfAjVc+V+mUw==
X-Received: by 10.28.27.205 with SMTP id b196mr1470035wmb.0.1472139688284;
        Thu, 25 Aug 2016 08:41:28 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.46.0.87 with SMTP id 84ls83051lja.49.gmail; Thu, 25 Aug 2016
 08:41:26 -0700 (PDT)
X-Received: by 10.25.212.212 with SMTP id l203mr2257074lfg.2.1472139686372;
        Thu, 25 Aug 2016 08:41:26 -0700 (PDT)
Original-Received: from blaine.gmane.org ([195.159.176.226])
        by mx.google.com with ESMTPS id j195si6405790lfj.140.2016.08.25.08.41.26
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Thu, 25 Aug 2016 08:41:26 -0700 (PDT)
Received-SPF: neutral (google.com: 195.159.176.226 is neither permitted nor denied by best guess record for domain of gclcip-std-proposals@m.gmane.org) client-ip=195.159.176.226;
Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2)
	(envelope-from <gclcip-std-proposals@m.gmane.org>)
	id 1bcwmP-0001X6-FE
	for std-proposals@isocpp.org; Thu, 25 Aug 2016 17:41:21 +0200
X-Injected-Via-Gmane: http://gmane.org/
Original-Lines: 29
Original-X-Complaints-To: usenet@blaine.gmane.org
In-Reply-To: <CAFk2RUZiqeTBGir3fKehHzju6YDtbigdvThW=CsgkBSaExjrug@mail.gmail.com>
X-Original-Sender: cppljevans@suddenlink.net
X-Original-Authentication-Results: mx.google.com;       spf=neutral
 (google.com: 195.159.176.226 is neither permitted nor denied by best guess
 record for domain of gclcip-std-proposals@m.gmane.org) smtp.mailfrom=gclcip-std-proposals@m.gmane.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:27941
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/27941>

On 08/25/2016 09:12 AM, Ville Voutilainen wrote:
> On 25 August 2016 at 16:47, Dominic Fandrey <kamikaze@bsdforen.de> wrote:
>> I searched this list for similar suggestions, but of course I may
>> have overlooked something.
>>
>> I frequently use the following pattern:
>>
>>     enum class FooBar { KEKS, DOSE };
>>     char const * const FooBarStr[]{"KEKS", "DOSE"};
>>
>> I use the strings to in error messages, verbose output, etc.
>>
>>     FooBarStr[static_cast<int>(FooBar::KEKS)] // "KEKS"
>>
>> This has some disadvantages, e.g. enums with explicitly stated values
>> may have gaps, negative values and may be defined out of order.
>> Also, changing the enum also means changing the strings manually.
>>
>> What I'd like to see:
>>
>>     static_cast<char const *>(FooBar::KEKS) // "KEKS"
>
>
> See http://open-std.org/JTC1/SC22/WG21/docs/papers/2016/p0194r1.html
>
Could you be more specific.  I grepped for enumName, for char const*,
and scanned briefly for other strings that might show where
conversion from enum to char const* might be, without success :(


-- 
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/npn3iq%244ah%241%40blaine.gmane.org.

.
