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/ratio> 13 14 // template <class R1, class R2> constexpr bool ratio_less_v; 15 16 #include <experimental/ratio> 17 #include <type_traits> 18 19 namespace ex = std::experimental; 20 21 int main() 22 { 23 { 24 typedef std::ratio<1, 2> R1; 25 typedef std::ratio<1, 1> R2; 26 static_assert( 27 ex::ratio_less_v<R1, R2>, "" 28 ); 29 static_assert( 30 ex::ratio_less_v<R1, R2> == std::ratio_less<R1, R2>::value, "" 31 ); 32 static_assert( 33 std::is_same<decltype(ex::ratio_less_v<R1, R2>), const bool>::value 34 , "" 35 ); 36 } 37 { 38 typedef std::ratio<1, 1> R1; 39 typedef std::ratio<1, 1> R2; 40 static_assert( 41 !ex::ratio_less_v<R1, R2>, "" 42 ); 43 static_assert( 44 ex::ratio_less_v<R1, R2> == std::ratio_less<R1, R2>::value, "" 45 ); 46 } 47 { 48 typedef std::ratio<2, 1> R1; 49 typedef std::ratio<1, 1> R2; 50 static_assert( 51 !ex::ratio_less_v<R1, R2>, "" 52 ); 53 static_assert( 54 ex::ratio_less_v<R1, R2> == std::ratio_less<R1, R2>::value, "" 55 ); 56 } 57 } 58