diff --git a/include/algorithm b/include/algorithm index 367489fb..b022f317 100644 --- a/include/algorithm +++ b/include/algorithm @@ -528,19 +528,19 @@ template template const T& - min(const T& a, const T& b); + min(const T& a, const T& b); // constexpr in C++14 template const T& - min(const T& a, const T& b, Compare comp); + min(const T& a, const T& b, Compare comp); // constexpr in C++14 template T - min(initializer_list t); + min(initializer_list t); // constexpr in C++14 template T - min(initializer_list t, Compare comp); + min(initializer_list t, Compare comp); // constexpr in C++14 template ForwardIterator @@ -552,19 +552,19 @@ template template const T& - max(const T& a, const T& b); + max(const T& a, const T& b); // constexpr in C++14 template const T& - max(const T& a, const T& b, Compare comp); + max(const T& a, const T& b, Compare comp); // constexpr in C++14 template T - max(initializer_list t); + max(initializer_list t); // constexpr in C++14 template T - max(initializer_list t, Compare comp); + max(initializer_list t, Compare comp); // constexpr in C++14 template pair @@ -576,19 +576,19 @@ template template pair - minmax(const T& a, const T& b); + minmax(const T& a, const T& b); // constexpr in C++14 template pair - minmax(const T& a, const T& b, Compare comp); + minmax(const T& a, const T& b, Compare comp); // constexpr in C++14 template pair - minmax(initializer_list t); + minmax(initializer_list t); // constexpr in C++14 template pair - minmax(initializer_list t, Compare comp); + minmax(initializer_list t, Compare comp); // constexpr in C++14 template bool @@ -643,6 +643,9 @@ template _LIBCPP_BEGIN_NAMESPACE_STD +// I'd like to replace these with _VSTD::equal_to, but can't because: +// * That only works with C++14 and later, and +// * We haven't included here. template struct __equal_to { @@ -655,46 +658,59 @@ struct __equal_to template struct __equal_to<_T1, _T1> { - _LIBCPP_INLINE_VISIBILITY bool operator()(const _T1& __x, const _T1& __y) const {return __x == __y;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 + bool operator()(const _T1& __x, const _T1& __y) const {return __x == __y;} }; template struct __equal_to { - _LIBCPP_INLINE_VISIBILITY bool operator()(const _T1& __x, const _T1& __y) const {return __x == __y;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 + bool operator()(const _T1& __x, const _T1& __y) const {return __x == __y;} }; template struct __equal_to<_T1, const _T1> { - _LIBCPP_INLINE_VISIBILITY bool operator()(const _T1& __x, const _T1& __y) const {return __x == __y;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 + bool operator()(const _T1& __x, const _T1& __y) const {return __x == __y;} }; template struct __less { - _LIBCPP_INLINE_VISIBILITY bool operator()(const _T1& __x, const _T1& __y) const {return __x < __y;} - _LIBCPP_INLINE_VISIBILITY bool operator()(const _T1& __x, const _T2& __y) const {return __x < __y;} - _LIBCPP_INLINE_VISIBILITY bool operator()(const _T2& __x, const _T1& __y) const {return __x < __y;} - _LIBCPP_INLINE_VISIBILITY bool operator()(const _T2& __x, const _T2& __y) const {return __x < __y;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 + bool operator()(const _T1& __x, const _T1& __y) const {return __x < __y;} + + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 + bool operator()(const _T1& __x, const _T2& __y) const {return __x < __y;} + + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 + bool operator()(const _T2& __x, const _T1& __y) const {return __x < __y;} + + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 + bool operator()(const _T2& __x, const _T2& __y) const {return __x < __y;} }; template struct __less<_T1, _T1> { - _LIBCPP_INLINE_VISIBILITY bool operator()(const _T1& __x, const _T1& __y) const {return __x < __y;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 + bool operator()(const _T1& __x, const _T1& __y) const {return __x < __y;} }; template struct __less { - _LIBCPP_INLINE_VISIBILITY bool operator()(const _T1& __x, const _T1& __y) const {return __x < __y;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 + bool operator()(const _T1& __x, const _T1& __y) const {return __x < __y;} }; template struct __less<_T1, const _T1> { - _LIBCPP_INLINE_VISIBILITY bool operator()(const _T1& __x, const _T1& __y) const {return __x < __y;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 + bool operator()(const _T1& __x, const _T1& __y) const {return __x < __y;} }; template @@ -2505,9 +2521,9 @@ rotate_copy(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterato // min_element template -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 _ForwardIterator -min_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) +__min_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) { if (__first != __last) { @@ -2519,19 +2535,27 @@ min_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) return __first; } +template +inline _LIBCPP_INLINE_VISIBILITY +_ForwardIterator +min_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) +{ + return __min_element(__first, __last, __comp); +} + template inline _LIBCPP_INLINE_VISIBILITY _ForwardIterator min_element(_ForwardIterator __first, _ForwardIterator __last) { - return _VSTD::min_element(__first, __last, + return __min_element(__first, __last, __less::value_type>()); } // min template -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const _Tp& min(const _Tp& __a, const _Tp& __b, _Compare __comp) { @@ -2539,7 +2563,7 @@ min(const _Tp& __a, const _Tp& __b, _Compare __comp) } template -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const _Tp& min(const _Tp& __a, const _Tp& __b) { @@ -2549,19 +2573,19 @@ min(const _Tp& __a, const _Tp& __b) #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS template -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 _Tp min(initializer_list<_Tp> __t, _Compare __comp) { - return *_VSTD::min_element(__t.begin(), __t.end(), __comp); + return *__min_element(__t.begin(), __t.end(), __comp); } template -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 _Tp min(initializer_list<_Tp> __t) { - return *_VSTD::min_element(__t.begin(), __t.end()); + return *__min_element(__t.begin(), __t.end(), __less<_Tp>()); } #endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS @@ -2569,9 +2593,9 @@ min(initializer_list<_Tp> __t) // max_element template -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 _ForwardIterator -max_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) +__max_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) { if (__first != __last) { @@ -2583,19 +2607,28 @@ max_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) return __first; } + +template +inline _LIBCPP_INLINE_VISIBILITY +_ForwardIterator +max_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) +{ + return __max_element(__first, __last, __comp); +} + template inline _LIBCPP_INLINE_VISIBILITY _ForwardIterator max_element(_ForwardIterator __first, _ForwardIterator __last) { - return _VSTD::max_element(__first, __last, + return __max_element(__first, __last, __less::value_type>()); } // max template -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const _Tp& max(const _Tp& __a, const _Tp& __b, _Compare __comp) { @@ -2603,7 +2636,7 @@ max(const _Tp& __a, const _Tp& __b, _Compare __comp) } template -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const _Tp& max(const _Tp& __a, const _Tp& __b) { @@ -2613,19 +2646,19 @@ max(const _Tp& __a, const _Tp& __b) #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS template -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 _Tp max(initializer_list<_Tp> __t, _Compare __comp) { - return *_VSTD::max_element(__t.begin(), __t.end(), __comp); + return *__max_element(__t.begin(), __t.end(), __comp); } template -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 _Tp max(initializer_list<_Tp> __t) { - return *_VSTD::max_element(__t.begin(), __t.end()); + return *__max_element(__t.begin(), __t.end(), __less<_Tp>()); } #endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS @@ -2684,13 +2717,14 @@ inline _LIBCPP_INLINE_VISIBILITY std::pair<_ForwardIterator, _ForwardIterator> minmax_element(_ForwardIterator __first, _ForwardIterator __last) { - return _VSTD::minmax_element(__first, __last, __less::value_type>()); + return _VSTD::minmax_element(__first, __last, + __less::value_type>()); } // minmax template -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 pair minmax(const _Tp& __a, const _Tp& __b, _Compare __comp) { @@ -2699,7 +2733,7 @@ minmax(const _Tp& __a, const _Tp& __b, _Compare __comp) } template -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 pair minmax(const _Tp& __a, const _Tp& __b) { @@ -2708,24 +2742,49 @@ minmax(const _Tp& __a, const _Tp& __b) #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS -template -inline _LIBCPP_INLINE_VISIBILITY -pair<_Tp, _Tp> -minmax(initializer_list<_Tp> __t) -{ - pair __p = - _VSTD::minmax_element(__t.begin(), __t.end()); - return pair<_Tp, _Tp>(*__p.first, *__p.second); -} - template -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 pair<_Tp, _Tp> minmax(initializer_list<_Tp> __t, _Compare __comp) { - pair __p = - _VSTD::minmax_element(__t.begin(), __t.end(), __comp); - return pair<_Tp, _Tp>(*__p.first, *__p.second); + typedef typename initializer_list<_Tp>::const_iterator _Iter; + _Iter __first = __t.begin(); + _Iter __last = __t.end(); + std::pair<_Tp, _Tp> __result ( *__first, *__first ); + + ++__first; + if (__t.size() % 2 == 0) + { + if (__comp(*__first, __result.first)) + __result.first = *__first; + else + __result.second = *__first; + ++__first; + } + + while (__first != __last) + { + _Tp __prev = *__first++; + if (__comp(__prev, *__first)) { + if (__comp(__prev, __result.first)) __result.first = __prev; + if (__comp(__result.second, *__first)) __result.second = *__first; + } + else { + if (__comp(*__first, __result.first)) __result.first = *__first; + if (__comp(__result.second, __prev)) __result.second = __prev; + } + + __first++; + } + return __result; +} + +template +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 +pair<_Tp, _Tp> +minmax(initializer_list<_Tp> __t) +{ + return _VSTD::minmax(__t, __less<_Tp>()); } #endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS diff --git a/test/algorithms/alg.sorting/alg.min.max/max.pass.cpp b/test/algorithms/alg.sorting/alg.min.max/max.pass.cpp index ebb42a9d..c560c22f 100644 --- a/test/algorithms/alg.sorting/alg.min.max/max.pass.cpp +++ b/test/algorithms/alg.sorting/alg.min.max/max.pass.cpp @@ -43,4 +43,12 @@ int main() test(x, y, x); test(y, x, x); } +#if _LIBCPP_STD_VER > 11 + { + constexpr int x = 1; + constexpr int y = 0; + static_assert(std::max(x, y) == x, "" ); + static_assert(std::max(y, x) == x, "" ); + } +#endif } diff --git a/test/algorithms/alg.sorting/alg.min.max/max_comp.pass.cpp b/test/algorithms/alg.sorting/alg.min.max/max_comp.pass.cpp index e92d2b92..95241af5 100644 --- a/test/algorithms/alg.sorting/alg.min.max/max_comp.pass.cpp +++ b/test/algorithms/alg.sorting/alg.min.max/max_comp.pass.cpp @@ -45,4 +45,12 @@ int main() test(x, y, std::greater(), y); test(y, x, std::greater(), y); } +#if _LIBCPP_STD_VER > 11 + { + constexpr int x = 1; + constexpr int y = 0; + static_assert(std::max(x, y, std::greater()) == y, "" ); + static_assert(std::max(y, x, std::greater()) == y, "" ); + } +#endif } diff --git a/test/algorithms/alg.sorting/alg.min.max/max_init_list.pass.cpp b/test/algorithms/alg.sorting/alg.min.max/max_init_list.pass.cpp index 0b28c832..0438412d 100644 --- a/test/algorithms/alg.sorting/alg.min.max/max_init_list.pass.cpp +++ b/test/algorithms/alg.sorting/alg.min.max/max_init_list.pass.cpp @@ -31,5 +31,12 @@ int main() assert(i == 3); i = std::max({1, 3, 2}); assert(i == 3); +#if _LIBCPP_STD_VER > 11 + { + static_assert(std::max({1, 3, 2}) == 3, ""); + static_assert(std::max({2, 1, 3}) == 3, ""); + static_assert(std::max({3, 2, 1}) == 3, ""); + } +#endif #endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/algorithms/alg.sorting/alg.min.max/max_init_list_comp.pass.cpp b/test/algorithms/alg.sorting/alg.min.max/max_init_list_comp.pass.cpp index 62484b2d..4dd47a73 100644 --- a/test/algorithms/alg.sorting/alg.min.max/max_init_list_comp.pass.cpp +++ b/test/algorithms/alg.sorting/alg.min.max/max_init_list_comp.pass.cpp @@ -32,5 +32,12 @@ int main() assert(i == 1); i = std::max({1, 3, 2}, std::greater()); assert(i == 1); +#if _LIBCPP_STD_VER > 11 + { + static_assert(std::max({1, 3, 2}, std::greater()) == 1, ""); + static_assert(std::max({2, 1, 3}, std::greater()) == 1, ""); + static_assert(std::max({3, 2, 1}, std::greater()) == 1, ""); + } +#endif #endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/algorithms/alg.sorting/alg.min.max/min.pass.cpp b/test/algorithms/alg.sorting/alg.min.max/min.pass.cpp index 573adfa6..bbbd97bc 100644 --- a/test/algorithms/alg.sorting/alg.min.max/min.pass.cpp +++ b/test/algorithms/alg.sorting/alg.min.max/min.pass.cpp @@ -43,4 +43,12 @@ int main() test(x, y, y); test(y, x, y); } +#if _LIBCPP_STD_VER > 11 + { + constexpr int x = 1; + constexpr int y = 0; + static_assert(std::min(x, y) == y, "" ); + static_assert(std::min(y, x) == y, "" ); + } +#endif } diff --git a/test/algorithms/alg.sorting/alg.min.max/min_comp.pass.cpp b/test/algorithms/alg.sorting/alg.min.max/min_comp.pass.cpp index 37205f5c..4ef705e7 100644 --- a/test/algorithms/alg.sorting/alg.min.max/min_comp.pass.cpp +++ b/test/algorithms/alg.sorting/alg.min.max/min_comp.pass.cpp @@ -45,4 +45,12 @@ int main() test(x, y, std::greater(), x); test(y, x, std::greater(), x); } +#if _LIBCPP_STD_VER > 11 + { + constexpr int x = 1; + constexpr int y = 0; + static_assert(std::min(x, y, std::greater()) == x, "" ); + static_assert(std::min(y, x, std::greater()) == x, "" ); + } +#endif } diff --git a/test/algorithms/alg.sorting/alg.min.max/min_init_list.pass.cpp b/test/algorithms/alg.sorting/alg.min.max/min_init_list.pass.cpp index 33ac1955..eed4ebd4 100644 --- a/test/algorithms/alg.sorting/alg.min.max/min_init_list.pass.cpp +++ b/test/algorithms/alg.sorting/alg.min.max/min_init_list.pass.cpp @@ -31,5 +31,12 @@ int main() assert(i == 1); i = std::min({1, 3, 2}); assert(i == 1); +#if _LIBCPP_STD_VER > 11 + { + static_assert(std::min({1, 3, 2}) == 1, ""); + static_assert(std::min({2, 1, 3}) == 1, ""); + static_assert(std::min({3, 2, 1}) == 1, ""); + } +#endif #endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/algorithms/alg.sorting/alg.min.max/min_init_list_comp.pass.cpp b/test/algorithms/alg.sorting/alg.min.max/min_init_list_comp.pass.cpp index c20b15b3..5e0301b6 100644 --- a/test/algorithms/alg.sorting/alg.min.max/min_init_list_comp.pass.cpp +++ b/test/algorithms/alg.sorting/alg.min.max/min_init_list_comp.pass.cpp @@ -32,5 +32,12 @@ int main() assert(i == 3); i = std::min({1, 3, 2}, std::greater()); assert(i == 3); +#if _LIBCPP_STD_VER > 11 + { + static_assert(std::min({1, 3, 2}, std::greater()) == 3, ""); + static_assert(std::min({2, 1, 3}, std::greater()) == 3, ""); + static_assert(std::min({3, 2, 1}, std::greater()) == 3, ""); + } +#endif #endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/algorithms/alg.sorting/alg.min.max/minmax.pass.cpp b/test/algorithms/alg.sorting/alg.min.max/minmax.pass.cpp index 6ebf9643..1774ffd7 100644 --- a/test/algorithms/alg.sorting/alg.min.max/minmax.pass.cpp +++ b/test/algorithms/alg.sorting/alg.min.max/minmax.pass.cpp @@ -45,4 +45,18 @@ int main() test(x, y, y, x); test(y, x, y, x); } +#if _LIBCPP_STD_VER > 11 + { +// Note that you can't take a reference to a local var, since +// it's address is not a compile-time constant. + constexpr static int x = 1; + constexpr static int y = 0; + constexpr auto p1 = std::minmax (x, y); + static_assert(p1.first == y, ""); + static_assert(p1.second == x, ""); + constexpr auto p2 = std::minmax (y, x); + static_assert(p2.first == y, ""); + static_assert(p2.second == x, ""); + } +#endif } diff --git a/test/algorithms/alg.sorting/alg.min.max/minmax_comp.pass.cpp b/test/algorithms/alg.sorting/alg.min.max/minmax_comp.pass.cpp index bddc01fa..66b2e780 100644 --- a/test/algorithms/alg.sorting/alg.min.max/minmax_comp.pass.cpp +++ b/test/algorithms/alg.sorting/alg.min.max/minmax_comp.pass.cpp @@ -27,6 +27,7 @@ test(const T& a, const T& b, C c, const T& x, const T& y) assert(&p.second == &y); } + int main() { { @@ -47,4 +48,18 @@ int main() test(x, y, std::greater(), x, y); test(y, x, std::greater(), x, y); } +#if _LIBCPP_STD_VER > 11 + { +// Note that you can't take a reference to a local var, since +// it's address is not a compile-time constant. + constexpr static int x = 1; + constexpr static int y = 0; + constexpr auto p1 = std::minmax(x, y, std::greater<>()); + static_assert(p1.first == x, ""); + static_assert(p1.second == y, ""); + constexpr auto p2 = std::minmax(y, x, std::greater<>()); + static_assert(p2.first == x, ""); + static_assert(p2.second == y, ""); + } +#endif } diff --git a/test/algorithms/alg.sorting/alg.min.max/minmax_init_list.pass.cpp b/test/algorithms/alg.sorting/alg.min.max/minmax_init_list.pass.cpp index 57e0737d..0196d10d 100644 --- a/test/algorithms/alg.sorting/alg.min.max/minmax_init_list.pass.cpp +++ b/test/algorithms/alg.sorting/alg.min.max/minmax_init_list.pass.cpp @@ -25,5 +25,15 @@ int main() assert((std::minmax({2, 3, 1}) == std::pair(1, 3))); assert((std::minmax({3, 1, 2}) == std::pair(1, 3))); assert((std::minmax({3, 2, 1}) == std::pair(1, 3))); +#if _LIBCPP_STD_VER > 11 + { + static_assert((std::minmax({1, 2, 3}) == std::pair(1, 3)), ""); + static_assert((std::minmax({1, 3, 2}) == std::pair(1, 3)), ""); + static_assert((std::minmax({2, 1, 3}) == std::pair(1, 3)), ""); + static_assert((std::minmax({2, 3, 1}) == std::pair(1, 3)), ""); + static_assert((std::minmax({3, 1, 2}) == std::pair(1, 3)), ""); + static_assert((std::minmax({3, 2, 1}) == std::pair(1, 3)), ""); + } +#endif #endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/algorithms/alg.sorting/alg.min.max/minmax_init_list_comp.pass.cpp b/test/algorithms/alg.sorting/alg.min.max/minmax_init_list_comp.pass.cpp index 9288ccc9..95a8c85c 100644 --- a/test/algorithms/alg.sorting/alg.min.max/minmax_init_list_comp.pass.cpp +++ b/test/algorithms/alg.sorting/alg.min.max/minmax_init_list_comp.pass.cpp @@ -26,5 +26,15 @@ int main() assert((std::minmax({2, 3, 1}, std::greater()) == std::pair(3, 1))); assert((std::minmax({3, 1, 2}, std::greater()) == std::pair(3, 1))); assert((std::minmax({3, 2, 1}, std::greater()) == std::pair(3, 1))); +#if _LIBCPP_STD_VER > 11 + { + static_assert((std::minmax({1, 2, 3}, std::greater()) == std::pair(3, 1)), ""); + static_assert((std::minmax({1, 3, 2}, std::greater()) == std::pair(3, 1)), ""); + static_assert((std::minmax({2, 1, 3}, std::greater()) == std::pair(3, 1)), ""); + static_assert((std::minmax({2, 3, 1}, std::greater()) == std::pair(3, 1)), ""); + static_assert((std::minmax({3, 1, 2}, std::greater()) == std::pair(3, 1)), ""); + static_assert((std::minmax({3, 2, 1}, std::greater()) == std::pair(3, 1)), ""); + } +#endif #endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS }