1 //===----------------------------------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
12 // template<LessThanComparable T>
13 // pair<const T&, const T&>
14 // minmax(const T& a, const T& b);
19 #include "test_macros.h"
23 test(const T& a, const T& b, const T& x, const T& y)
25 std::pair<const T&, const T&> p = std::minmax(a, b);
26 assert(&p.first == &x);
27 assert(&p.second == &y);
50 #if TEST_STD_VER >= 14
52 // Note that you can't take a reference to a local var, since
53 // its address is not a compile-time constant.
54 constexpr static int x = 1;
55 constexpr static int y = 0;
56 constexpr auto p1 = std::minmax (x, y);
57 static_assert(p1.first == y, "");
58 static_assert(p1.second == x, "");
59 constexpr auto p2 = std::minmax (y, x);
60 static_assert(p2.first == y, "");
61 static_assert(p2.second == x, "");