1 //===----------------------------------------------------------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 // <utility>
11
12 // template <class T1, class T2> struct pair
13
14 // template <class T1, class T2> bool operator==(const pair<T1,T2>&, const pair<T1,T2>&);
15 // template <class T1, class T2> bool operator!=(const pair<T1,T2>&, const pair<T1,T2>&);
16 // template <class T1, class T2> bool operator< (const pair<T1,T2>&, const pair<T1,T2>&);
17 // template <class T1, class T2> bool operator> (const pair<T1,T2>&, const pair<T1,T2>&);
18 // template <class T1, class T2> bool operator>=(const pair<T1,T2>&, const pair<T1,T2>&);
19 // template <class T1, class T2> bool operator<=(const pair<T1,T2>&, const pair<T1,T2>&);
20
21 #include <utility>
22 #include <cassert>
23
main()24 int main()
25 {
26 {
27 typedef std::pair<int, short> P;
28 P p1(3, 4);
29 P p2(3, 4);
30 assert( (p1 == p2));
31 assert(!(p1 != p2));
32 assert(!(p1 < p2));
33 assert( (p1 <= p2));
34 assert(!(p1 > p2));
35 assert( (p1 >= p2));
36 }
37 {
38 typedef std::pair<int, short> P;
39 P p1(2, 4);
40 P p2(3, 4);
41 assert(!(p1 == p2));
42 assert( (p1 != p2));
43 assert( (p1 < p2));
44 assert( (p1 <= p2));
45 assert(!(p1 > p2));
46 assert(!(p1 >= p2));
47 }
48 {
49 typedef std::pair<int, short> P;
50 P p1(3, 2);
51 P p2(3, 4);
52 assert(!(p1 == p2));
53 assert( (p1 != p2));
54 assert( (p1 < p2));
55 assert( (p1 <= p2));
56 assert(!(p1 > p2));
57 assert(!(p1 >= p2));
58 }
59 {
60 typedef std::pair<int, short> P;
61 P p1(3, 4);
62 P p2(2, 4);
63 assert(!(p1 == p2));
64 assert( (p1 != p2));
65 assert(!(p1 < p2));
66 assert(!(p1 <= p2));
67 assert( (p1 > p2));
68 assert( (p1 >= p2));
69 }
70 {
71 typedef std::pair<int, short> P;
72 P p1(3, 4);
73 P p2(3, 2);
74 assert(!(p1 == p2));
75 assert( (p1 != p2));
76 assert(!(p1 < p2));
77 assert(!(p1 <= p2));
78 assert( (p1 > p2));
79 assert( (p1 >= p2));
80 }
81
82 #if _LIBCPP_STD_VER > 11
83 {
84 typedef std::pair<int, short> P;
85 constexpr P p1(3, 4);
86 constexpr P p2(3, 2);
87 static_assert(!(p1 == p2), "");
88 static_assert( (p1 != p2), "");
89 static_assert(!(p1 < p2), "");
90 static_assert(!(p1 <= p2), "");
91 static_assert( (p1 > p2), "");
92 static_assert( (p1 >= p2), "");
93 }
94 #endif
95 }
96