[Development] Proposing to change https://wiki.qt.io/API_Design_Principles#Enums_in_classes to require scoped enums
Marc Mutz
marc.mutz at qt.io
Fri Jan 17 22:52:04 CET 2025
On 17.01.25 16:52, Allan Sandfeld Jensen wrote:
> Did anyone ever suggest or put pressure on the C++ standard committee to add
> strong unscoped enums?
Someone did:
// https://gcc.godbolt.org/z/69zWsoGP9
enum class Strong { One, Two, Three };
#ifdef __cpp_using_enum
using enum Strong;
#else
inline constexpr auto One = Strong::One;
inline constexpr auto Two = Strong::Two;
inline constexpr auto Three = Strong::Three;
#endif
use(One); use(Two); use(Three);
The ice for unscoped enums becomes _very_ thin.
--
Marc Mutz <marc.mutz at qt.io> (he/his)
Principal Software Engineer
The Qt Company
Erich-Thilo-Str. 10 12489
Berlin, Germany
www.qt.io
Geschäftsführer: Mika Pälsi, Juha Varelius, Jouni Lintunen
Sitz der Gesellschaft: Berlin,
Registergericht: Amtsgericht Charlottenburg,
HRB 144331 B
More information about the Development
mailing list