C++ Standard Library min() Sample

Description

min() computes the minimum of two values. An optional user-defined comparison can be supplied to control the ordering.

Declaration

	template <class T>
	    const T& min(const T&, const T&);
	template <class T, class Cmp>
	    const T& min(const T&, const T&, Cmp);

Concept

The sample calls min() twice, once to perform a standard computation of the minimum of two integer values, and once to compute the minimum based on a user-supplied comparison. In the first case, the value -47 is printed, because it is less than 37. In the second case, the absolute magnitude is used for making the comparison, and 37 is printed.

Supported
Supported
Supported