220 28084 <CAJnLdOZAFnHVov-+RWp2JwjFjLp5ZpnRW7PmLgAiFCv=x_4a_w@mail.gmail.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: "'Edward Catmur' via ISO C++ Standard - Future Proposals" <std-proposals@isocpp.org>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: Make (strongly typed) enums castable to char
 const * const
Date: Wed, 31 Aug 2016 22:11:13 +0100
Lines: 140
Approved: news@gmane.org
Message-ID: <CAJnLdOZAFnHVov-+RWp2JwjFjLp5ZpnRW7PmLgAiFCv=x_4a_w@mail.gmail.com>
References: <878tvfl89r.fsf@gmail.com> <CAKiZDp3O2piEZy7Dr4XSPQqO+Zd-rv06aiQVnaCJ=F8d0A83sw@mail.gmail.com>
 <CAPVNwa9R8EQm_py0x4=sneEog39Ksgxp+oVNiqerxLTO2qxH8w@mail.gmail.com>
 <e8e400ef-d60f-448c-9594-15c75e9728e9@isocpp.org> <ce4634af-e0ab-251b-d804-8fb721e855f9@wanadoo.fr>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary=94eb2c0560d68fce98053b6489ef
X-Trace: blaine.gmane.org 1472677881 22505 195.159.176.226 (31 Aug 2016 21:11:21 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Wed, 31 Aug 2016 21:11:21 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDZLZTXF7UJBB4UPTW7AKGQEGIHVP4I@isocpp.org Wed Aug 31 23:11:17 2016
Return-path: <std-proposals+bncBDZLZTXF7UJBB4UPTW7AKGQEGIHVP4I@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-it0-f70.google.com ([209.85.214.70])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBDZLZTXF7UJBB4UPTW7AKGQEGIHVP4I@isocpp.org>)
	id 1bfCmx-0005Ci-4x
	for gclcip-std-proposals@m.gmane.org; Wed, 31 Aug 2016 23:11:15 +0200
Original-Received: by mail-it0-f70.google.com with SMTP id g185sf102136093ith.2
        for <gclcip-std-proposals@m.gmane.org>; Wed, 31 Aug 2016 14:11:16 -0700 (PDT)
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:x-spam-checked-in-group:list-post
         :list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=2uohrRc2tMOljwW37xo8m6STZCExbI9BYgv3hxaT2mI=;
        b=XkC7TmxeLbf64D27AHBW0UHB9vwqf9H9+Ve6MRbHmWpU/9pDUZX/XtKOLHhw0yuivR
         y+ylj/G7OGHQGmBtFlctNgQ2juUnDn1/qtybErZCBf5FerBPz0rEWCkVC31zU4KdRwBP
         ZA8SHTCimCrxA48QwrADtCHJVoptbRjBRa1SProLN08YIFfq8POjURyTCsABQ+41Wln8
         D2EC2l3zQQgoceVR9Fcmt5/pv6mEelaaaAtzwLfB9TvxIBUvI16YBLO1syybx9riFMik
         HHJ7lIYoxFcYZ3E+MK6cyLeFt0DrW3RM2gAYbyDuEx7nOjPof0TXS/85FgZxrwy4pbUL
         s2HQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        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=2uohrRc2tMOljwW37xo8m6STZCExbI9BYgv3hxaT2mI=;
        b=FnOrlzzPn4h1Em9KAqfu/EC/R3PzdnJfpbYWYE1rTNycQ87ZHkzAWZR68GxUScm/8W
         CpftnhRJCotsJ7zAj1Nwl+wVJWq3m7lkO3P6DNTV5B89or2cK+jc9/NjnJxMvc+FLL1p
         0X3HFfUwSl5Uun7AQTLO/o1Chofn5+8JJfd9N/tpNpSxP8hZBT6Hb43VfEOjuCgILRmp
         E03LUhkAQfwqvbStuXavfB0ORzLTT9jCQqeKHQUxU8eAXBKYsPpJNWpjZJ236ECObeCu
         YuhB+ei4fVvtH823Cx2kE5tyWOVoqU1FtdFLIXgrs60goSCNCVQjtNOEkOsCnx0HbOfR
         KTTg==
X-Gm-Message-State: AE9vXwMc51L1QCMQOLI5K5YowhHiH9jvjyMK8OPdPxZA+8oaHHccaukNMrawhIy4U3LfDA==
X-Received: by 10.237.49.36 with SMTP id 33mr8976911qtg.15.1472677875830;
        Wed, 31 Aug 2016 14:11:15 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.157.52.249 with SMTP id t54ls5028934otd.2.gmail; Wed, 31 Aug
 2016 14:11:14 -0700 (PDT)
X-Received: by 10.55.192.135 with SMTP id v7mr12919838qkv.236.1472677874660;
        Wed, 31 Aug 2016 14:11:14 -0700 (PDT)
Original-Received: from mail-qk0-x22f.google.com (mail-qk0-x22f.google.com. [2607:f8b0:400d:c09::22f])
        by mx.google.com with ESMTPS id f189si1338703qkb.297.2016.08.31.14.11.14
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Wed, 31 Aug 2016 14:11:14 -0700 (PDT)
Received-SPF: pass (google.com: domain of ecatmur@googlemail.com designates 2607:f8b0:400d:c09::22f as permitted sender) client-ip=2607:f8b0:400d:c09::22f;
Original-Received: by mail-qk0-x22f.google.com with SMTP id z190so65370917qkc.0
        for <std-proposals@isocpp.org>; Wed, 31 Aug 2016 14:11:14 -0700 (PDT)
X-Received: by 10.55.140.131 with SMTP id o125mr13537343qkd.17.1472677874209;
 Wed, 31 Aug 2016 14:11:14 -0700 (PDT)
Original-Received: by 10.237.32.135 with HTTP; Wed, 31 Aug 2016 14:11:13 -0700 (PDT)
In-Reply-To: <ce4634af-e0ab-251b-d804-8fb721e855f9@wanadoo.fr>
X-Original-Sender: ecatmur@googlemail.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@googlemail.com;       spf=pass (google.com: domain of
 ecatmur@googlemail.com designates 2607:f8b0:400d:c09::22f as permitted
 sender) smtp.mailfrom=ecatmur@googlemail.com;       dmarc=pass (p=QUARANTINE
 dis=NONE) header.from=googlemail.com
X-Original-From: Edward Catmur <ecatmur@googlemail.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:28084
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/28084>

--94eb2c0560d68fce98053b6489ef
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On Wed, Aug 31, 2016 at 9:20 PM, Vicente J. Botet Escriba <
vicente.botet@wanadoo.fr> wrote:

> Le 30/08/2016 =C3=A0 13:05, Edward Catmur a =C3=A9crit :
>
> On Tuesday, 30 August 2016 06:23:04 UTC+1, Matus Chochlik wrote:
>>
>> I've added few examples showing simple implementation of
>> enumerator-to-string and string-to-enumerator using both the TMP and
>> constexpr MP libraries to the mirror reflection utilities:
>>
>> https://github.com/matus-chochlik/mirror/blob/develop/exampl
>> e/mirror/005_enum_to_string.cpp
>> https://github.com/matus-chochlik/mirror/blob/develop/exampl
>> e/mirror/006_string_to_enum.cpp
>> https://github.com/matus-chochlik/mirror/blob/develop/exampl
>> e/puddle/005_enum_to_string.cpp
>> https://github.com/matus-chochlik/mirror/blob/develop/exampl
>> e/puddle/006_string_to_enum.cpp
>>
>
> Is it really necessary to construct the lookup table as a library
> container? Wouldn't a switch statement perform better?
>
> No, we don't need a map, but I believe that Matus wanted to show a probe
> of concept.
>
> I don't know how we can generate a switch with the current language. We
> can do some recursive if and expect that the compiler optimize it.
>

Fair enough; recursive templates are even worse, so a container is the
simplest option for now. You can generate a switch with the preprocessor,
but then you have to set an (arbitrary) upper limit on the number of cases.
We really need variadic expansion of case labels, but I guess it's a fairly
niche interest.

--=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/CAJnLdOZAFnHVov-%2BRWp2JwjFjLp5ZpnRW7PmLgAiFCv%3=
Dx_4a_w%40mail.gmail.com.

--94eb2c0560d68fce98053b6489ef
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><div class=3D"gmail_extra"><br><div class=3D"gmail_quo=
te">On Wed, Aug 31, 2016 at 9:20 PM, Vicente J. Botet Escriba <span dir=3D"=
ltr">&lt;<a href=3D"mailto:vicente.botet@wanadoo.fr" target=3D"_blank">vice=
nte.botet@wanadoo.fr</a>&gt;</span> wrote:<br><blockquote class=3D"gmail_qu=
ote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex=
">
 =20
   =20
 =20
  <div bgcolor=3D"#FFFFFF" text=3D"#000000"><span class=3D"">
    <div>Le 30/08/2016 =C3=A0 13:05, Edward Catmur a
      =C3=A9crit=C2=A0:<br>
    </div>
    <blockquote type=3D"cite">
      <div dir=3D"ltr">On Tuesday, 30 August 2016 06:23:04 UTC+1, Matus
        Chochlik wrote:
        <blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8=
ex;border-left:1px #ccc solid;padding-left:1ex">I&#39;ve
          added few examples showing simple implementation of
          <br>
          enumerator-to-string and string-to-enumerator using both the
          TMP and
          <br>
          constexpr MP libraries to the mirror reflection utilities:
          <br>
          <br>
          <a href=3D"https://github.com/matus-chochlik/mirror/blob/develop/=
example/mirror/005_enum_to_string.cpp" rel=3D"nofollow" target=3D"_blank">h=
ttps://github.com/matus-choch<wbr>lik/mirror/blob/develop/exampl<wbr>e/mirr=
or/005_enum_to_string.<wbr>cpp</a>
          <br>
          <a href=3D"https://github.com/matus-chochlik/mirror/blob/develop/=
example/mirror/006_string_to_enum.cpp" rel=3D"nofollow" target=3D"_blank">h=
ttps://github.com/matus-choch<wbr>lik/mirror/blob/develop/exampl<wbr>e/mirr=
or/006_string_to_enum.<wbr>cpp</a>
          <br>
          <a href=3D"https://github.com/matus-chochlik/mirror/blob/develop/=
example/puddle/005_enum_to_string.cpp" rel=3D"nofollow" target=3D"_blank">h=
ttps://github.com/matus-choch<wbr>lik/mirror/blob/develop/exampl<wbr>e/pudd=
le/005_enum_to_string.<wbr>cpp</a>
          <br>
          <a href=3D"https://github.com/matus-chochlik/mirror/blob/develop/=
example/puddle/006_string_to_enum.cpp" rel=3D"nofollow" target=3D"_blank">h=
ttps://github.com/matus-choch<wbr>lik/mirror/blob/develop/exampl<wbr>e/pudd=
le/006_string_to_enum.<wbr>cpp</a>=C2=A0<br>
        </blockquote>
        <div>=C2=A0</div>
        <div>Is it really necessary to construct the lookup table as a
          library container? Wouldn&#39;t a switch statement perform better=
?</div>
        <div><br>
        </div>
      </div>
    </blockquote></span>
    No, we don&#39;t need a map, but I believe that Matus wanted to show a
    probe of concept. <br>
    <br>
    I don&#39;t know how we can generate a switch with the current language=
..
    We can do some recursive if and expect that the compiler optimize
    it.</div></blockquote><div><br></div><div>Fair enough; recursive templa=
tes are even worse, so a container is the simplest option for now. You can =
generate a switch with the preprocessor, but then you have to set an (arbit=
rary) upper limit on the number of cases. We really need variadic expansion=
 of case labels, but I guess it&#39;s a fairly niche interest.</div></div><=
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/CAJnLdOZAFnHVov-%2BRWp2JwjFjLp5ZpnRW7=
PmLgAiFCv%3Dx_4a_w%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter"=
>https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAJnLdOZAFnHV=
ov-%2BRWp2JwjFjLp5ZpnRW7PmLgAiFCv%3Dx_4a_w%40mail.gmail.com</a>.<br />

--94eb2c0560d68fce98053b6489ef--

.
