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);
21 test(const T& a, const T& b, const T& x, const T& y)
23 std::pair<const T&, const T&> p = std::minmax(a, b);
24 assert(&p.first == &x);
25 assert(&p.second == &y);
48 #if _LIBCPP_STD_VER > 11
50 // Note that you can't take a reference to a local var, since
51 // it's address is not a compile-time constant.
52 constexpr static int x = 1;
53 constexpr static int y = 0;
54 constexpr auto p1 = std::minmax (x, y);
55 static_assert(p1.first == y, "");
56 static_assert(p1.second == x, "");
57 constexpr auto p2 = std::minmax (y, x);
58 static_assert(p2.first == y, "");
59 static_assert(p2.second == x, "");