The C++17 variant is great for higher-level code but it’s annoying that there’s no way to provide an embedded discriminator. Even without it, you can’t nest bitfield usefully in C++ ABIs, so you can’t define two 31-bit bitfield structures and stick them in a union with a 1-bit discriminator, you have to just use an integer type and manually stash bits. I’d love to see variants that could take advantage of the alignment of pointers and provide support for arbitrary bit-width integers.
The C++17 variant is great for higher-level code but it’s annoying that there’s no way to provide an embedded discriminator. Even without it, you can’t nest bitfield usefully in C++ ABIs, so you can’t define two 31-bit bitfield structures and stick them in a union with a 1-bit discriminator, you have to just use an integer type and manually stash bits. I’d love to see variants that could take advantage of the alignment of pointers and provide support for arbitrary bit-width integers.