Home | History | Annotate | Download | only in type.index.members
      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 // <typeindex>
     11 
     12 // class type_index
     13 
     14 // bool operator< (const type_index& rhs) const;
     15 // bool operator<=(const type_index& rhs) const;
     16 // bool operator> (const type_index& rhs) const;
     17 // bool operator>=(const type_index& rhs) const;
     18 
     19 #include <typeindex>
     20 #include <cassert>
     21 
     22 int main()
     23 {
     24     std::type_index t1 = typeid(int);
     25     std::type_index t2 = typeid(int);
     26     std::type_index t3 = typeid(long);
     27     assert(!(t1 <  t2));
     28     assert( (t1 <= t2));
     29     assert(!(t1 >  t2));
     30     assert( (t1 >= t2));
     31     if (t1 < t3)
     32     {
     33         assert( (t1 <  t3));
     34         assert( (t1 <= t3));
     35         assert(!(t1 >  t3));
     36         assert(!(t1 >= t3));
     37     }
     38     else
     39     {
     40         assert(!(t1 <  t3));
     41         assert(!(t1 <= t3));
     42         assert( (t1 >  t3));
     43         assert( (t1 >= t3));
     44     }
     45 }
     46