4.8 KiB
[ratio.syn]
21 Metaprogramming library [meta]
21.5 Compile-time rational arithmetic [ratio]
21.5.2 Header synopsis [ratio.syn]
// all freestandingnamespace std {// [ratio.ratio], class template ratiotemplate<intmax_t N, intmax_t D = 1> class ratio; // [ratio.arithmetic], ratio arithmetictemplate<class R1, class R2> using ratio_add = see below; template<class R1, class R2> using ratio_subtract = see below; template<class R1, class R2> using ratio_multiply = see below; template<class R1, class R2> using ratio_divide = see below; // [ratio.comparison], ratio comparisontemplate<class R1, class R2> struct ratio_equal; template<class R1, class R2> struct ratio_not_equal; template<class R1, class R2> struct ratio_less; template<class R1, class R2> struct ratio_less_equal; template<class R1, class R2> struct ratio_greater; template<class R1, class R2> struct ratio_greater_equal; template<class R1, class R2>constexpr bool ratio_equal_v = ratio_equal<R1, R2>::value; template<class R1, class R2>constexpr bool ratio_not_equal_v = ratio_not_equal<R1, R2>::value; template<class R1, class R2>constexpr bool ratio_less_v = ratio_less<R1, R2>::value; template<class R1, class R2>constexpr bool ratio_less_equal_v = ratio_less_equal<R1, R2>::value; template<class R1, class R2>constexpr bool ratio_greater_v = ratio_greater<R1, R2>::value; template<class R1, class R2>constexpr bool ratio_greater_equal_v = ratio_greater_equal<R1, R2>::value; // [ratio.si], convenience SI typedefsusing quecto = ratio<1, 1'000'000'000'000'000'000'000'000'000'000>; // see belowusing ronto = ratio<1, 1'000'000'000'000'000'000'000'000'000>; // see belowusing yocto = ratio<1, 1'000'000'000'000'000'000'000'000>; // see belowusing zepto = ratio<1, 1'000'000'000'000'000'000'000>; // see belowusing atto = ratio<1, 1'000'000'000'000'000'000>; using femto = ratio<1, 1'000'000'000'000'000>; using pico = ratio<1, 1'000'000'000'000>; using nano = ratio<1, 1'000'000'000>; using micro = ratio<1, 1'000'000>; using milli = ratio<1, 1'000>; using centi = ratio<1, 100>; using deci = ratio<1, 10>; using deca = ratio< 10, 1>; using hecto = ratio< 100, 1>; using kilo = ratio< 1'000, 1>; using mega = ratio< 1'000'000, 1>; using giga = ratio< 1'000'000'000, 1>; using tera = ratio< 1'000'000'000'000, 1>; using peta = ratio< 1'000'000'000'000'000, 1>; using exa = ratio< 1'000'000'000'000'000'000, 1>; using zetta = ratio< 1'000'000'000'000'000'000'000, 1>; // see belowusing yotta = ratio< 1'000'000'000'000'000'000'000'000, 1>; // see belowusing ronna = ratio< 1'000'000'000'000'000'000'000'000'000, 1>; // see belowusing quetta = ratio<1'000'000'000'000'000'000'000'000'000'000, 1>; // see below}