Re:Type-safe Bitmasks in C++
by TheCycoONE on Wednesday June 13, 2018 @07:34AM
(#17302108)
The article claims no runtime overhead, but my understanding is that despite the consexpr that function needs to be evaluated at runtime because the inputs are unknown?
[ Parent
| on HN ]
In many cases the input is known at compile time.
For example instead of
#define BTN_A 0x01
you have bitmask<Button>(A)
Both of these are known at compile time and they are equivalent.