Include <algorithm> for std::minmax()