Date: Fri, 24 Apr 2026 20:59:55 +0100
Note that `using enum` exists and probably does what you need.
On Fri, 24 Apr 2026, 10:21 Andrey Fokin via Std-Proposals, <
std-proposals_at_[hidden]> wrote:
> Munem, thanks for your comment. Looks like my idea is not so clear enough.
> You are absolutely right and your example really works and can be used in
> code as is. And when I got extra data in the enum problem my idea was
> pretty same. I used struts inheritance and variadic template to set data
> to. But in my case (and in yours as well) are:
> 1. A lot of extra code (according single code string in my suggestion)
> 2. Code a bit more complicated
> And because of statements above if this feature will be done by
> compiler it will really useful
>
> BRG, Andrey
>
> On Mon, Apr 20, 2026 at 2:31 PM Muneem via Std-Proposals <
> std-proposals_at_[hidden]> wrote:
>
>> I would highly suggest for you to tell the exact issue that you have with
>> current enums. Start with an example that you think takes too much
>> boilerplate code, then we can work on a wrapper and determine is such
>> wrappers should be standardized.
>>
>> Regards, Muneem.
>>
>> On Mon, 20 Apr 2026, 3:47 pm Andrey Fokin via Std-Proposals, <
>> std-proposals_at_[hidden]> wrote:
>>
>>> Title: Pxxxx: Add inheritance for Enum Class enumerations
>>> Author: Andrey Fokin, lazzyfox_at_[hidden]
>>> Date: 2026-04-20
>>> Project: Programming Language C++, Library Working Group
>>> Abstract: New inheritance feature to enum class (scoped enumerations)
>>> 1. Introduction
>>> According my experience the are situations when scped enumerations could
>>> be presented in OOP style – base enumeration type and some ancestors of.
>>> For example – we have to define a list of colors for traffic lights device.
>>> Is simple case we have just three colors and our enum could looks like
>>> enum class TrafficLight:uint8_t { Red, Yellow, Green };
>>> And probably this enum will cover biggest part of cases. But if we need
>>> to have a case wit Trafficligt wit left, rgih or two arrows we need ot use
>>> three diffeerent data types for each with big part of duplicated data in
>>> eatch.
>>> Case 1- additional letf arrow enum class TrafficLight_LefatArrow:uint8_t
>>> { Red, Yellow, Green, LeftArrow };
>>> Case 2- additional right arrow enum class
>>> TrafficLight_RightArrow:uint8_t { Red, Yellow, Green, RightArrow };
>>> Case 3- two additional arrows enum class TrafficLight_TwoArrows:uint8_t
>>> { Red, Yellow, Green, LeftArrow, RightArrow };
>>>
>>> In case of inheritance could be possible use as first case as a base
>>> class and athers as inherited to exclude overlapping data duplication and
>>> casese above cold looks like
>>> Case 4- additional letf arrow enum class TrafficLight:LefatArrow:uint8_t
>>> {LeftArrow };
>>> Case 5- additional right arrow enum class
>>> TrafficLight:RightArrow:uint8_t {RightArrow };
>>> Case 6- two additional arrows enum class TrafficLight_TwoArrows:uint8_t
>>> {LeftArrow, RightArrow };
>>>
>>> 2. Motivation and scope
>>> Proposal could make more cleare code structure and decrease code
>>> overlapping and had writing
>>> 3. Design decisions
>>> It could be compiler extension
>>>
>>>
>>>
>>>
>>> BRG,
>>> Andrey
>>> --
>>> Std-Proposals mailing list
>>> Std-Proposals_at_[hidden]
>>> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>>>
>> --
>> Std-Proposals mailing list
>> Std-Proposals_at_[hidden]
>> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>>
>
>
> --
> BRG,
> Andrey
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>
On Fri, 24 Apr 2026, 10:21 Andrey Fokin via Std-Proposals, <
std-proposals_at_[hidden]> wrote:
> Munem, thanks for your comment. Looks like my idea is not so clear enough.
> You are absolutely right and your example really works and can be used in
> code as is. And when I got extra data in the enum problem my idea was
> pretty same. I used struts inheritance and variadic template to set data
> to. But in my case (and in yours as well) are:
> 1. A lot of extra code (according single code string in my suggestion)
> 2. Code a bit more complicated
> And because of statements above if this feature will be done by
> compiler it will really useful
>
> BRG, Andrey
>
> On Mon, Apr 20, 2026 at 2:31 PM Muneem via Std-Proposals <
> std-proposals_at_[hidden]> wrote:
>
>> I would highly suggest for you to tell the exact issue that you have with
>> current enums. Start with an example that you think takes too much
>> boilerplate code, then we can work on a wrapper and determine is such
>> wrappers should be standardized.
>>
>> Regards, Muneem.
>>
>> On Mon, 20 Apr 2026, 3:47 pm Andrey Fokin via Std-Proposals, <
>> std-proposals_at_[hidden]> wrote:
>>
>>> Title: Pxxxx: Add inheritance for Enum Class enumerations
>>> Author: Andrey Fokin, lazzyfox_at_[hidden]
>>> Date: 2026-04-20
>>> Project: Programming Language C++, Library Working Group
>>> Abstract: New inheritance feature to enum class (scoped enumerations)
>>> 1. Introduction
>>> According my experience the are situations when scped enumerations could
>>> be presented in OOP style – base enumeration type and some ancestors of.
>>> For example – we have to define a list of colors for traffic lights device.
>>> Is simple case we have just three colors and our enum could looks like
>>> enum class TrafficLight:uint8_t { Red, Yellow, Green };
>>> And probably this enum will cover biggest part of cases. But if we need
>>> to have a case wit Trafficligt wit left, rgih or two arrows we need ot use
>>> three diffeerent data types for each with big part of duplicated data in
>>> eatch.
>>> Case 1- additional letf arrow enum class TrafficLight_LefatArrow:uint8_t
>>> { Red, Yellow, Green, LeftArrow };
>>> Case 2- additional right arrow enum class
>>> TrafficLight_RightArrow:uint8_t { Red, Yellow, Green, RightArrow };
>>> Case 3- two additional arrows enum class TrafficLight_TwoArrows:uint8_t
>>> { Red, Yellow, Green, LeftArrow, RightArrow };
>>>
>>> In case of inheritance could be possible use as first case as a base
>>> class and athers as inherited to exclude overlapping data duplication and
>>> casese above cold looks like
>>> Case 4- additional letf arrow enum class TrafficLight:LefatArrow:uint8_t
>>> {LeftArrow };
>>> Case 5- additional right arrow enum class
>>> TrafficLight:RightArrow:uint8_t {RightArrow };
>>> Case 6- two additional arrows enum class TrafficLight_TwoArrows:uint8_t
>>> {LeftArrow, RightArrow };
>>>
>>> 2. Motivation and scope
>>> Proposal could make more cleare code structure and decrease code
>>> overlapping and had writing
>>> 3. Design decisions
>>> It could be compiler extension
>>>
>>>
>>>
>>>
>>> BRG,
>>> Andrey
>>> --
>>> Std-Proposals mailing list
>>> Std-Proposals_at_[hidden]
>>> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>>>
>> --
>> Std-Proposals mailing list
>> Std-Proposals_at_[hidden]
>> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>>
>
>
> --
> BRG,
> Andrey
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>
Received on 2026-04-24 20:00:15
