C++ Logo


Advanced search

Re: Enum Class Inheritance

From: Jason McKesson <jmckesson_at_[hidden]>
Date: Wed, 1 Sep 2021 16:43:52 -0400
On Wed, Sep 1, 2021 at 2:52 PM Henry Miller via Std-Proposals
<std-proposals_at_[hidden]> wrote:
> There are two issues that I can think of: How large is the first enum, right now the system is allowed to choose the size based on the number of elements, there is no way to know that the inherited will fit.

This is incorrect. A scoped enum *always* has a fixed underlying size.
If you don't provide one, then it is `int`.

Granted, if "enum inheritance" is a useful thing, I don't think it's a
good idea to limit it to just scoped enums; regular enums ought to be
able to use it too.

Received on 2021-09-01 15:44:06