Avoid max() macro from windows.h by wrapping std::numeric_limits<T>::max in parens.