I agree with @Marcin_Jaczewski
The most useful would be to have ‘;’ after the last enum member would solve this issue.
Maybe we could add some extra values here:
‘’’
enum struct E : int, float {
A { 0, 0.5f },
B { 3, 0.42f },
C { …, 0.0f }
; // end of enumeration @Marcin
int foo() // would act like a namespaced function
// getting values
operator int() …
operator float() …
};
‘’’
Instead of ‘=‘ we could use an initializer list and list values of the “inherited” types on top.
Each type would then need to have constexpr constructor and ++ operator if the types are not listed explicitly.
“…” would indicate that it should just follow incremental values.
Cheers, Filip
Wiadomość napisana przez Marcin Jaczewski via Std-Proposals <std-proposals@lists.isocpp.org> w dniu 12 mar 2025, o godz. 23:56:
```
enum class E {
A = 1, B = getSometing(), C = 3
, // last comma to still allow standard formatting of `,` after each value
; // <- here! end of values
//now parsing is similar to `class`, you can't declare new values of enum.
bool foo();
E getSometing();
};
```