fix: optimize using constexpr and templates
@variar, I'm not sure of course, but maybe you're interested in rewriting some parameters of functions to create guaranteed C++17 metafunctions that are more optimized due to constant conditions and variables. I doubt that the functions I fixed have a big impact on performance, but this is a step towards using such a method for functions that are frequently called.
More info here: https://stackoverflow.com/a/57211067 My tests on godbolt here: https://godbolt.org/z/4qq9n38Tz
As far as I understand, this removes a branch from code path at the expense of compiling separate versions of the function for different conditions. The approach might be useful. However, I'd apply it only for hot-path and after doing some measurements that justify increase in complexity/compilation time.
@variar, should I run benchmark using std::chrono?
@variar, is this pull request still relevant?