名前空間
変種
操作

標準ライブラリヘッダー <ratio> (C++11)

From cppreference.com
 
 
標準ライブラリヘッダー
 

このヘッダーはコンパイル時有理数演算ライブラリの一部です。

目次

クラス

(C++11)
正確な有理数を表現する
(クラステンプレート) [編集]
算術演算
(C++11)
コンパイル時に2つのratioオブジェクトを加算する
(エイリアステンプレート)[編集]
コンパイル時に2つのratioオブジェクトを減算する
(エイリアステンプレート)[編集]
コンパイル時に2つのratioオブジェクトを乗算する
(エイリアステンプレート)[編集]
コンパイル時に2つのratioオブジェクトを除算する
(エイリアステンプレート)[編集]
比較
コンパイル時に2つのratioオブジェクトが等しいか比較する
(クラステンプレート) [編集]
コンパイル時に2つのratioオブジェクトが等しくないか比較する
(クラステンプレート) [編集]
コンパイル時に2つのratioオブジェクトがより小さいか比較する
(クラステンプレート) [編集]
2つのratioオブジェクトをコンパイル時にless than or equal toで比較する
(クラス テンプレート) [編集]
コンパイル時に2つのratioオブジェクトがより大きいか比較する
(クラステンプレート) [編集]
コンパイル時に2つのratioオブジェクトが以上であるか比較する
(クラステンプレート) [編集]
型エイリアス
quecto (C++26) std::ratio<1, 1000000000000000000000000000000>, std::intmax_tが分母を表現できる場合
ronto (C++26) std::ratio<1, 1000000000000000000000000000>, std::intmax_tが分母を表現できる場合
yocto std::ratio<1, 1000000000000000000000000>, std::intmax_tが分母を表現できる場合
zepto std::ratio<1, 1000000000000000000000>, std::intmax_tが分母を表現できる場合
atto std::ratio<1, 1000000000000000000>
femto std::ratio<1, 1000000000000000>
pico std::ratio<1, 1000000000000>
nano std::ratio<1, 1000000000>
micro std::ratio<1, 1000000>
milli std::ratio<1, 1000>
centi std::ratio<1, 100>
deci std::ratio<1, 10>
deca std::ratio<10, 1>
hecto std::ratio<100, 1>
kilo std::ratio<1000, 1>
mega std::ratio<1000000, 1>
giga std::ratio<1000000000, 1>
tera std::ratio<1000000000000, 1>
peta std::ratio<1000000000000000, 1>
exa std::ratio<1000000000000000000, 1>
zetta std::ratio<1000000000000000000000, 1>, std::intmax_tが分子を表現できる場合
yotta std::ratio<1000000000000000000000000, 1>, std::intmax_tが分子を表現できる場合
ronna (C++26) std::ratio<1000000000000000000000000000, 1>, std::intmax_tが分子を表現できる場合
quetta (C++26) std::ratio<1000000000000000000000000000000, 1>, std::intmax_tが分子を表現できる場合

[編集] 概要

namespace std {
    // class template ratio
    template <intmax_t N, intmax_t D = 1>
    class ratio {
    public:
        typedef ratio<num, den> type;
        static constexpr intmax_t num;
        static constexpr intmax_t den;
    };
 
    // ratio arithmetic            
    template <class R1, class   R2> using   ratio_add      = /*ratio*/;
    template <class R1, class   R2> using   ratio_subtract = /*ratio*/;
    template <class R1, class   R2> using   ratio_multiply = /*ratio*/;
    template <class R1, class   R2> using   ratio_divide   = /*ratio*/;
 
    // ratio comparison            
    template <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;  
 
    // convenience SI typedefs
    typedef ratio<1, 1000000000000000000000000000000> quecto;
    typedef ratio<1,    1000000000000000000000000000> ronto;         
    typedef ratio<1,       1000000000000000000000000> yocto;
    typedef ratio<1,          1000000000000000000000> zepto;
    typedef ratio<1,             1000000000000000000> atto;   
    typedef ratio<1,                1000000000000000> femto;  
    typedef ratio<1,                   1000000000000> pico;   
    typedef ratio<1,                      1000000000> nano;   
    typedef ratio<1,                         1000000> micro;  
    typedef ratio<1,                            1000> milli;  
    typedef ratio<1,                             100> centi;  
    typedef ratio<1,                              10> deci;   
    typedef ratio<                             10, 1> deca;   
    typedef ratio<                            100, 1> hecto;  
    typedef ratio<                           1000, 1> kilo;   
    typedef ratio<                        1000000, 1> mega;   
    typedef ratio<                     1000000000, 1> giga;   
    typedef ratio<                  1000000000000, 1> tera;   
    typedef ratio<               1000000000000000, 1> peta;   
    typedef ratio<            1000000000000000000, 1> exa;    
    typedef ratio<         1000000000000000000000, 1> zetta;
    typedef ratio<      1000000000000000000000000, 1> yotta;
    typedef ratio<   1000000000000000000000000000, 1> ronna;
    typedef ratio<1000000000000000000000000000000, 1> quetta;
}
English 日本語 中文(简体) 中文(繁體)