Skip to content

Latest commit

 

History

History
59 lines (46 loc) · 1.3 KB

File metadata and controls

59 lines (46 loc) · 1.3 KB

operator>=

  • chrono[meta header]
  • std::chrono[meta namespace]
  • function template[meta id-type]
  • cpp11[meta cpp]
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();
  • common_type[link /reference/type_traits/common_type.md]
  • count[link /reference/chrono/duration/count.md]

#include <cassert>
#include <chrono>

using namespace std::chrono;

int main()
{
  const bool result = seconds(3) >= seconds(3);
  assert(result);
}
  • seconds(3) >= seconds(3)[color ff0000]

出力

バージョン

言語

  • C++11

処理系

参照