C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Std-Proposals Digest, Vol 35, Issue 22

From: Dragan Grbic <dgrbic_at_[hidden]>
Date: Fri, 25 Feb 2022 09:42:03 +0100
Yes, it does cover all and has more on top.
And it is more elaborate than my "from top of my head" approach.
Thanks. Regards


On Wed, Feb 23, 2022 at 1:20 PM Alexander Christensen via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> I posted a similar one 2-3 weeks ago, which you may find here:
> https://github.com/alexpanter/cpp-enum-proposal
>
> This proposal covers your idea.
>
> Best,
> Alexander
>
> Sent from Outlook Mobile <https://aka.ms/blhgte>
>
> ------------------------------
> *From:* Std-Proposals <std-proposals-bounces_at_[hidden]> on behalf
> of std-proposals-request_at_[hidden] <
> std-proposals-request_at_[hidden]>
> *Sent:* Wednesday, February 23, 2022 1:00:05 PM
> *To:* std-proposals_at_[hidden] <std-proposals_at_[hidden]>
> *Subject:* Std-Proposals Digest, Vol 35, Issue 22
>
> Send Std-Proposals mailing list submissions to
> std-proposals_at_[hidden]
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
> or, via email, send a message with subject or body 'help' to
> std-proposals-request_at_[hidden]
>
> You can reach the person managing the list at
> std-proposals-owner_at_[hidden]
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Std-Proposals digest..."
>
>
> Today's Topics:
>
> 1. Enum class extensions (Dragan Grbic)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Wed, 23 Feb 2022 11:12:15 +0100
> From: Dragan Grbic <dgrbic_at_[hidden]>
> To: std-proposals_at_[hidden]
> Subject: [std-proposals] Enum class extensions
> Message-ID:
> <CAE_Xj5o2k=pP4Z+B3G=yBo6_=
> xhe1knH1Z-_4eR-ViQgecJRVA_at_[hidden]>
> Content-Type: text/plain; charset="utf-8"
>
> Proposal:
> Add static member accessors (generated by compiler) to the enum
> class/struct to enable iteration over enum.
>
> enum class Foo {
> a,
> b = 3,
> c = b,
> d
> }
>
> for (auto e: Foo::enum::values) {
> std::cout << e;
> }
>
> X::enum::values should return the static const array of underlying type
> filled with values from enum ordered as in enum definition. For example
> above, it would be [0, 3, 3, 4].
> If X::enum::values isn't used, the compiler does not generate the array.
>
> Also, X::enum::names could be added with similar semantics, except that it
> would be of type array<char*, N> (where N is count of enum elements).
> For the above example it would be ["a", "b", "c", "d"].
> -------------- next part --------------
> HTML attachment scrubbed and removed
>
> ------------------------------
>
> Subject: Digest Footer
>
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>
>
> ------------------------------
>
> End of Std-Proposals Digest, Vol 35, Issue 22
> *********************************************
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>

Received on 2022-02-25 08:42:15