C++ Standard Library min_element() Sample

Description

min_element() is used to find the minimum element in a sequence. The default ordering uses the built-in operator <, and the user can optionally supply a comparison function.

Declaration

	template <class For>
	    For min_element(For, For);
	template <class For, class Cmp>
	    For min_element(For, For, Cmp);

Concept

The minimum value (-59) in the vector of five elements is computed and displayed. Then, with the user-defined comparison function specified, the ordering is reversed, and the maximum value (100) is printed.

Supported
Supported
Supported