The comparison uses operator< for the first version, and comp for the second.
The behavior of this function template is equivalent to:
| 1 2 3 |
|
Parameters
- a, b
- Items to compare.
T is any type supporting copy constructions and comparisons with operator<. - comp
- Comparison function object that, taking two values of the same type, returns true if the first argument is to be considered less than the second, and false otherwise.
Return value
The lesser of its two argumentsExample
| 1 2 3 4 5 6 7 8 9 10 11 12 |
|
Output:
min(1,2)==1
min(2,1)==1
min('a','z')==a
min(3.14,2.72)==2.72
|
See also
| max | Return the greater of two arguments (function template) |
| min_element | Return smallest element in range (function template) |
