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 // test rel_ops 11 12 #include <utility> 13 #include <cassert> 14 15 struct A 16 { 17 int data_; 18 AA19 explicit A(int data = -1) : data_(data) {} 20 }; 21 22 inline 23 bool operator ==(const A & x,const A & y)24operator == (const A& x, const A& y) 25 { 26 return x.data_ == y.data_; 27 } 28 29 inline 30 bool operator <(const A & x,const A & y)31operator < (const A& x, const A& y) 32 { 33 return x.data_ < y.data_; 34 } 35 main()36int main() 37 { 38 using namespace std::rel_ops; 39 A a1(1); 40 A a2(2); 41 assert(a1 == a1); 42 assert(a1 != a2); 43 assert(a1 < a2); 44 assert(a2 > a1); 45 assert(a1 <= a1); 46 assert(a1 <= a2); 47 assert(a2 >= a2); 48 assert(a2 >= a1); 49 } 50