4 ms·
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
by TheCycoONE 8y ago
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?
- vostok 8y agoIn 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.
- trebeling 8y agoConstexpr 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