convert getmax and getmin to std::max, std::min template functions