Standard C++ Library Class Reference
Click on the banner to return to the Class Reference home page.
©Copyright 1996 Rogue Wave Software
max
Algorithm
Summary
Find and return the maximum of a pair of values
Contents
Synopsis●
Description●
Example●
See Also●
Synopsis
#include <algorithm>
template <class T>
const T& max(const T&, const T&);
template <class T, class Compare>
const T& max(const T&, const T&, Compare);
Description
The max algorithm determines and returns the maximum of a pair of values. The optional
argument Compare defines a comparison function that can be used in place of the default
operator<. This function can be used with all the datatypes provided by the standard library.
max returns the first argument when the arguments are equal.