The complement of true is true, except when it's false
cppdashboard.dev/r/2026/10/the-complement-of-true-is-true-except-when-it-s-falseArchive Search About The complement of true is true, except when it's false 1 October 2026 · Matthew Taylor | Edit Table of Contents Putting it together When it’s false Unscoped enums, promotion, and undefined behaviour Avoiding this in…
From the article
Archive Search About The complement of true is true, except when it's false 1 October 2026 · Matthew Taylor | Edit Table of Contents Putting it together When it’s false Unscoped enums, promotion, and undefined behaviour Avoiding this in your own code Aside: What about floating point? Conclusion I recently looked at P4313R1 , a standards proposal paper which adds a set of bitmask operations for enums, using a C++26 annotation to opt-in. The core idea being that, to use an example from the paper, given code like the below:
enum class [[=std::bitmask_type]] Permission { None = 0 , Read = 1 << 0 , Write = 1 << 1 , Execute = 1 << 2 , }; The [[=std::bitmask_type]] annotation would automatically imbue Permission with an accessible set of bitwise operations so that you as a user needn’t write…
Share this resource