minmax
두 개의 입력된 매개 변수를 비교하여 작은 수부터 큰 수 순서대로 한 쌍으로 반환합니다.
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
두 개의 개체 중 첫 번째가 비교됩니다._Right
두 개의 개체 중 두 번째가 비교됩니다._Comp
이진 조건부 두 개체를 비교하는 데 사용됩니다._IList
멤버를 비교할 수 있는 initializer_list입니다.
반환 값
첫 번째는 작고 두 번째는 큰 한쌍의 개체를 반환합니다. initializer_list의 경우, 쌍은 목록에서 최소 개체와 최대 개체입니다.
설명
첫번째 템플릿 함수는 _Right 가 _Left보다 작을 경우, pair<const Type&, const Type&>(_Right, _Left)를 반환합니다. 그렇지 않으면 pair<const Type&, const Type&>(_Left, _Right)를 반환합니다.
두 번째 멤버 함수는 _Comp 의해 비교했을 때 첫번째 요소는 작고 두번쨰 요소는 큰 쌍을 반환합니다.
_Left 및 _Right 매개 변수를 _IList 로 대체하는 경우를 제외하고, 나머지 템플릿 함수는 동일하게 동작합니다.
함수는 정확한 비교를 수행합니다.
요구 사항
헤더: <algorithm>
네임스페이스: std