Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

minmax

 

Compares two input parameters and returns them as a pair, in order of lesser to greater.

template<class Type>
    pair<const Type&, const Type&>
        minmax(
            const Type& _Left, 
            const Type& _Right
        );
template<class Type, class BinaryPredicate>
    pair<const Type&, const Type&>
        minmax(
            const Type& _Left,
            const Type& _Right,
            BinaryPredicate _Comp
        );
template<class Type>     pair<Type&, Type&>         minmax(
            initializer_list<Type> _Ilist
        );
template<class Type, class BinaryPredicate> 
    pair<Type&, Type&>         minmax(
            initializer_list<Type> _Ilist, 
            BinaryPredicate _Comp
        );

_Left

The first of the two objects being compared.

_Right

The second of the two objects being compared.

_Comp

A binary predicate used to compare the two objects.

_IList

The initializer_list that contains the members to be compared.

Returns a pair of objects where the first is the lesser and the second is the greater. In the case of an initializer_list, the pair is the least object and the greatest object in the list.

The first template function returns pair<const Type&, const Type&>(_Right, _Left) if _Right is less than _Left. Otherwise, it returns pair<const Type&, const Type&>(_Left, _Right).

The second member function returns a pair where the first element is the lesser and the second is the greater when compared by the predicate _Comp.

The remaining template functions behave the same, except that they replace the _Left and _Right parameters with _IList.

The function performs exactly one comparison.

Requirements

Header: <algorithm>

Namespace: std

Show:
© 2016 Microsoft