Revert min and max functions to use std::common_type rather than decltype