I've just written the following snippet:
// Fix for MinGW 4.9.2 bug - std::log2 is missing there
template <typename T>
T log2 (T value)
{
static const T l2 = std::log(T(2));
return std::log(value) / l2;
}
Obviously, l2
should be unique for each T
type because it is of type T
. But does it actually work that way as per the C++ standard?