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 // <tuple> 11 12 // template <class... Types> class tuple; 13 14 // template<class... TTypes, class... UTypes> 15 // bool 16 // operator==(const tuple<TTypes...>& t, const tuple<UTypes...>& u); 17 18 #include <tuple> 19 #include <string> 20 #include <cassert> 21 22 int main() 23 { 24 { 25 typedef std::tuple<> T1; 26 typedef std::tuple<> T2; 27 const T1 t1; 28 const T2 t2; 29 assert(t1 == t2); 30 assert(!(t1 != t2)); 31 } 32 { 33 typedef std::tuple<int> T1; 34 typedef std::tuple<double> T2; 35 const T1 t1(1); 36 const T2 t2(1.1); 37 assert(!(t1 == t2)); 38 assert(t1 != t2); 39 } 40 { 41 typedef std::tuple<int> T1; 42 typedef std::tuple<double> T2; 43 const T1 t1(1); 44 const T2 t2(1); 45 assert(t1 == t2); 46 assert(!(t1 != t2)); 47 } 48 { 49 typedef std::tuple<int, double> T1; 50 typedef std::tuple<double, char> T2; 51 const T1 t1(1, 2); 52 const T2 t2(1, char(2)); 53 assert(t1 == t2); 54 assert(!(t1 != t2)); 55 } 56 { 57 typedef std::tuple<int, double> T1; 58 typedef std::tuple<double, char> T2; 59 const T1 t1(1, 2); 60 const T2 t2(1, char(3)); 61 assert(!(t1 == t2)); 62 assert(t1 != t2); 63 } 64 { 65 typedef std::tuple<int, double> T1; 66 typedef std::tuple<double, char> T2; 67 const T1 t1(1, 2); 68 const T2 t2(1.1, char(2)); 69 assert(!(t1 == t2)); 70 assert(t1 != t2); 71 } 72 { 73 typedef std::tuple<int, double> T1; 74 typedef std::tuple<double, char> T2; 75 const T1 t1(1, 2); 76 const T2 t2(1.1, char(3)); 77 assert(!(t1 == t2)); 78 assert(t1 != t2); 79 } 80 { 81 typedef std::tuple<char, int, double> T1; 82 typedef std::tuple<double, char, int> T2; 83 const T1 t1(1, 2, 3); 84 const T2 t2(1, 2, 3); 85 assert(t1 == t2); 86 assert(!(t1 != t2)); 87 } 88 { 89 typedef std::tuple<char, int, double> T1; 90 typedef std::tuple<double, char, int> T2; 91 const T1 t1(1, 2, 3); 92 const T2 t2(1.1, 2, 3); 93 assert(!(t1 == t2)); 94 assert(t1 != t2); 95 } 96 { 97 typedef std::tuple<char, int, double> T1; 98 typedef std::tuple<double, char, int> T2; 99 const T1 t1(1, 2, 3); 100 const T2 t2(1, 3, 3); 101 assert(!(t1 == t2)); 102 assert(t1 != t2); 103 } 104 { 105 typedef std::tuple<char, int, double> T1; 106 typedef std::tuple<double, char, int> T2; 107 const T1 t1(1, 2, 3); 108 const T2 t2(1, 2, 4); 109 assert(!(t1 == t2)); 110 assert(t1 != t2); 111 } 112 { 113 typedef std::tuple<char, int, double> T1; 114 typedef std::tuple<double, char, int> T2; 115 const T1 t1(1, 2, 3); 116 const T2 t2(1, 3, 2); 117 assert(!(t1 == t2)); 118 assert(t1 != t2); 119 } 120 { 121 typedef std::tuple<char, int, double> T1; 122 typedef std::tuple<double, char, int> T2; 123 const T1 t1(1, 2, 3); 124 const T2 t2(1.1, 2, 2); 125 assert(!(t1 == t2)); 126 assert(t1 != t2); 127 } 128 { 129 typedef std::tuple<char, int, double> T1; 130 typedef std::tuple<double, char, int> T2; 131 const T1 t1(1, 2, 3); 132 const T2 t2(1.1, 3, 3); 133 assert(!(t1 == t2)); 134 assert(t1 != t2); 135 } 136 { 137 typedef std::tuple<char, int, double> T1; 138 typedef std::tuple<double, char, int> T2; 139 const T1 t1(1, 2, 3); 140 const T2 t2(1.1, 3, 2); 141 assert(!(t1 == t2)); 142 assert(t1 != t2); 143 } 144 #if _LIBCPP_STD_VER > 11 145 { 146 typedef std::tuple<char, int, double> T1; 147 typedef std::tuple<double, char, int> T2; 148 constexpr T1 t1(1, 2, 3); 149 constexpr T2 t2(1.1, 3, 2); 150 static_assert(!(t1 == t2), ""); 151 static_assert(t1 != t2, ""); 152 } 153 #endif 154 } 155