Home | History | Annotate | Download | only in header.chrono.synop
      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 // UNSUPPORTED: c++98, c++03, c++11
     11 
     12 // <experimental/chrono>
     13 
     14 // template <class Rep> constexpr bool treat_as_floating_point_v;
     15 
     16 #include <experimental/chrono>
     17 #include <type_traits>
     18 
     19 namespace ex = std::chrono::experimental;
     20 namespace cr = std::chrono;
     21 
     22 template <class T, bool Expect>
     23 void test()
     24 {
     25   static_assert(
     26     ex::treat_as_floating_point_v<T> == Expect, ""
     27   );
     28   static_assert(
     29     ex::treat_as_floating_point_v<T> == cr::treat_as_floating_point<T>::value, ""
     30   );
     31 }
     32 
     33 int main()
     34 {
     35   {
     36     static_assert(
     37       std::is_same<
     38         decltype(ex::treat_as_floating_point_v<float>), const bool
     39       >::value, ""
     40     );
     41   }
     42   test<int, false>();
     43   test<unsigned, false>();
     44   test<char, false>();
     45   test<bool, false>();
     46   test<float, true>();
     47   test<double, true>();
     48   test<long double, true>();
     49 }
     50