|
ALINK="#ff0000">
min
PrototypeMin is an overloaded name; there are actually two min functions.template <class T> const T& min(const T& a, const T& b); template <class T, class BinaryPredicate> const T& min(const T& a, const T& b, BinaryPredicate comp); DescriptionMin returns the lesser of its two arguments; it returns the first argument if neither is less than the other.The two versions of min differ in how they define whether one element is less than another. The first version compares objects using operator<, and the second compares objects using the function object comp. DefinitionDefined in the standard header algorithm, and in the nonstandard backward-compatibility header algo.h.Requirements on typesFor the first version:
PreconditionsComplexityExampleconst int x = min(3, 9); assert(x == 3); NotesSee alsomax, min_element, max_element, LessThan ComparableCopyright © 1999 Silicon Graphics, Inc. All Rights Reserved. TrademarkInformation
|