• Class / Function / Type

      std::
    • Header file

      <>
    • Other / All

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

    履歴 編集

    function template
    <chrono>

    std::chrono::operator>

    namespace std {
    namespace chrono {
      template <class Rep1, class Period1, class Rep2, class Period2>
      constexpr bool operator>(const duration<Rep1, Period1>& lhs,
                               const duration<Rep2, Period2>& rhs);
    }}
    

    概要

    左辺が右辺より大きいかの判定を行う

    戻り値

    2つのdurationの単位を合わせた上で、count()の比較を行う。

    using ct = common_type<decltype(lhs), decltype(rhs)>::type;
    return ct(lhs).count() > ct(rhs).count();
    

    #include <cassert>
    #include <chrono>
    
    using namespace std::chrono;
    
    int main()
    {
      const bool result = seconds(3) > seconds(2);
      assert(result);
    }
    

    出力

    バージョン

    言語

    • C++11

    処理系

    参照