[Development] API style guide: scoped enum or not?

Thiago Macieira thiago.macieira at intel.com
Fri May 5 23:15:34 CEST 2023


On Friday, 5 May 2023 03:49:58 PDT Allan Sandfeld Jensen wrote:
> Wasn't there a new C++ proposal for decoupling the two separate features of
> enum class?

It's probably the using enum, which is C++20 and requires GCC 11 or Clang 13.
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1099r5.html

It does allow us to replace enums inside a class with an enum class and mostly 
retain source compatibility -- breaking only where regular enums decay to 
their underlying types.

But it doesn't help us in the other direction, which is to *use* the scope for 
flags. I tried several different things after posting the idea last night, but I 
haven't found a way to make this work:

QIODevice::OpenMode mode = QIODevice::OpenMode::ReadOnly;

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Cloud Software Architect - Intel DCAI Cloud Engineering
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5152 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/development/attachments/20230505/d5453f99/attachment.bin>


More information about the Development mailing list