sizeof an enum is essentially a sizeof its underlying type, so it should be the sum of sizeof of each type.

C and D are valid.
if the compiler can ( and should ) compare them and optimize the storage, then it could be optimized.
However then you would ensure that operator== is implemented for it to be used.

Cheers, Filip

Wiadomość napisana przez Sebastian Wittmeier via Std-Proposals <std-proposals@lists.isocpp.org> w dniu 14 mar 2025, o godz. 11:48:

 AW: [std-proposals] lambdas in enums

> All of them could be the same or different.

 

I do not understand. Is C or D valid?

Do both data types have to be stored?

What is sizeof(E)?
 

-----Ursprüngliche Nachricht-----
Von: Filip <fph2137@gmail.com>
Gesendet: Fr 14.03.2025 11:21
Betreff: Re: [std-proposals] lambdas in enums
An: std-proposals@lists.isocpp.org;
CC: Sebastian Wittmeier <wittmeier@projectalpha.org>; std-proposals@lists.isocpp.org;
C would be { 4, 0.0f }
D would be { 5, 0.5f }
 
We should probably not break the current functionality of storing the same value many times.
All of them could be the same or different.

Cheers, Filip
--
Std-Proposals mailing list
Std-Proposals@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals