C++ Logo


Advanced search

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

From: Alexander Christensen <alex_c007_at_[hidden]>
Date: Wed, 23 Feb 2022 12:20:19 +0000
I posted a similar one 2-3 weeks ago, which you may find here:

This proposal covers your idea.


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

To subscribe or unsubscribe via the World Wide Web, visit
or, via email, send a message with subject or body 'help' to

You can reach the person managing the list at

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
Content-Type: text/plain; charset="utf-8"

Add static member accessors (generated by compiler) to the enum
class/struct to enable iteration over enum.

enum class Foo {
    b = 3,
    c = b,

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


End of Std-Proposals Digest, Vol 35, Issue 22

Received on 2022-02-23 12:20:21