News for hackers. Stuff that matters.
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?
Re:Type-safe Bitmasks in C++ by vostok on Wednesday June 13, 2018 @08:00AM (#17302240)
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.
Re:Type-safe Bitmasks in C++ by trebeling on Wednesday June 13, 2018 @12:26PM (#17304568)
Constexpr aside any modern optomizer will handle this easily. Constexpr is more for allowing results to be passed to templates, static_assert, etc.. and less about optimization imo