• Class / Function / Type

      std::
    • Header file

      <>
    • Other / All

    最終更新日時(UTC):
    が更新

    履歴 編集

    function
    <chrono>

    std::chrono::duration::max

    static constexpr duration max();          // C++11
    static constexpr duration max() noexcept; // C++20
    

    概要

    repの最大値から成るdurationを取得する

    戻り値

    duration(duration_values<rep>::max())

    #include <iostream>
    #include <chrono>
    
    using std::chrono::duration;
    using std::micro;
    
    int main()
    {
      using microseconds = duration<int, micro>;
    
      microseconds m = microseconds::max();
      std::cout << m.count() << std::endl;
    }
    

    出力例

    2147483647
    

    バージョン

    言語

    • C++11

    処理系

    • GCC: 4.5.1 , 4.6.1
    • Visual C++: 2012 , 2013 , 2015

    参照