Date: Fri, 14 Mar 2025 15:25:03 +0100
But you said before that D and E were correct and valid, although A and E have the same int and A and D the same float.
So you always have to provide the pair of numbers and not a single element can be back-converted into the enum.
enum struct E : int, float {
A { 0, 0.5f },
B { 3, 0.42f },
C { …, 0.0f },
D { ..., 0.5f},
E {0, 1.f}
};
Or you just want to be able to convert enums into arbitrary types? E.g. an enum into a stringified name? Or a stringified name back to an enum? That only works, if they are unique, which you explicitly said, is not necessary.
-----Ursprüngliche Nachricht-----
Von:Filip <fph2137_at_[hidden]>
Gesendet:Fr 14.03.2025 15:23
Betreff:Re: [std-proposals] lambdas in enums
An:std-proposals_at_[hidden];
CC:Sebastian Wittmeier <wittmeier_at_[hidden]>; std-proposals_at_[hidden];
I would like any types to be listed, however I’m unsure about accessing them then.
Using static_cast seems impossible with the same type written couple of times.
Perhaps distinct types should be the only option here and dynamic_cast to access them, since it does evoke the idea of “change between inheritance”.
I would like to avoid adding additional operator or keyword here so I’m open to suggestions. I also don’t like dynamic_cast here but it seems like, an option at least, that would not break anything.
Cheers, Filip
Wiadomość napisana przez Sebastian Wittmeier via Std-Proposals <std-proposals_at_[hidden]> w dniu 14 mar 2025, o godz. 13:53:
Do you want to allow
enum class E : int, int, int, int, int {
-----Ursprüngliche Nachricht-----
Von:Filip <fph2137_at_[hidden]>
Gesendet:Fr 14.03.2025 11:21
Betreff:Re: [std-proposals] lambdas in enums
An:std-proposals_at_[hidden];
CC:Sebastian Wittmeier <wittmeier_at_[hidden]>; std-proposals_at_[hidden];
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.
--
Std-Proposals mailing list
Std-Proposals_at_[hidden]
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
Received on 2025-03-14 14:30:13