C++ Logo

std-proposals

Advanced search

Re: [std-proposals] std::enum_max and std::enum_min

From: Jonathan Wakely <cxx_at_[hidden]>
Date: Mon, 10 Jul 2023 12:36:18 +0100
On Mon, 10 Jul 2023 at 12:28, Jonathan Wakely <cxx_at_[hidden]> wrote:

>
>
> On Mon, 10 Jul 2023 at 10:08, Sebastian Wittmeier via Std-Proposals <
> std-proposals_at_[hidden]> wrote:
>
>> Hi Alex,
>>
>> I think you misunderstood.
>>
>> Jonathan's INT_MIN / INT_MAX do not return 1 or 16, respectively, for
>> enums.
>>
>> Quite the opposite, Jonathan pointed out that the existing values INT_MIN
>> / INT_MAX can be stored in MyEnum, so 1 or 16 are _not_ the minimum or
>> maximum possible value for the example.
>>
>
> Precisely. Any proposal related to the "min" and "max" of enums needs to
> discuss the valid values of the enumeration type.
>

P0974R0: "A Function Returning Whether An Underlying Type Value Is a Valid
Enumerator of a Given Enumeration" <https://wg21.link/p0974r0> (by Jonathan
Ringle) (2018-03-30) (which already proposed min and max traits, among
others) has the same issue.

Received on 2023-07-10 11:36:31