Home | History | Annotate | Download | only in meta.hel
      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 // type_traits
     11 
     12 // integral_constant
     13 
     14 #include <type_traits>
     15 #include <cassert>
     16 
     17 int main()
     18 {
     19     typedef std::integral_constant<int, 5> _5;
     20     static_assert(_5::value == 5, "");
     21     static_assert((std::is_same<_5::value_type, int>::value), "");
     22     static_assert((std::is_same<_5::type, _5>::value), "");
     23 #ifndef _LIBCPP_HAS_NO_CONSTEXPR
     24     static_assert((_5() == 5), "");
     25 #else
     26     assert(_5() == 5);
     27 #endif
     28 
     29     static_assert(std::false_type::value == false, "");
     30     static_assert((std::is_same<std::false_type::value_type, bool>::value), "");
     31     static_assert((std::is_same<std::false_type::type, std::false_type>::value), "");
     32 
     33     static_assert(std::true_type::value == true, "");
     34     static_assert((std::is_same<std::true_type::value_type, bool>::value), "");
     35     static_assert((std::is_same<std::true_type::type, std::true_type>::value), "");
     36 
     37     std::false_type f1;
     38     std::false_type f2 = f1;
     39 
     40     std::true_type t1;
     41     std::true_type t2 = t1;
     42 }
     43