Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // 2/3 / 1/6 = 4/1
- static_assert(
- std::is_same<
- std::ratio_divide<
- std::ratio<2, 3>::type,
- std::ratio<1, 6>::type
- >::type,
- std::ratio<4, 1>::type
- >::value,
- "ratio_divide does not work correctly");
- // 2/3 * 1/6 = 1/9
- static_assert(
- std::is_same<
- std::ratio_multiply<
- std::ratio<2, 3>::type,
- std::ratio<1, 6>::type
- >::type,
- std::ratio<1, 9>::type
- >::value,
- "ratio_multiply does not work correctly");
- // 2/3 + 1/6 = 5/6
- static_assert(
- std::is_same<
- std::ratio_add<
- std::ratio<2, 3>::type,
- std::ratio<1, 6>::type
- >::type,
- std::ratio<5, 6>::type
- >::value,
- "ratio_add does not work correctly");
- // 2/3 - 1/6 = 1/2
- static_assert(
- std::is_same<
- std::ratio_subtract<
- std::ratio<2, 3>::type,
- std::ratio<1, 6>::type
- >::type,
- std::ratio<1, 2>::type
- >::value,
- "ratio_subtract does not work correctly");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement