- chrono[meta header]
- std::chrono[meta namespace]
- function template[meta id-type]
- cpp11[meta cpp]
namespace std {
namespace chrono {
template <class Clock, class Duration1, class Duration2>
bool operator==(const time_point<Clock, Duration1>& lhs,
const time_point<Clock, Duration2>& rhs); // (1) C++11
template <class Clock, class Duration1, class Duration2>
constexpr bool operator==(const time_point<Clock, Duration1>& lhs,
const time_point<Clock, Duration2>& rhs); // (1) C++14
}}- time_point[link /reference/chrono/time_point.md]
等値比較を行う
return lhs.time_since_epoch() == rhs.time_since_poch();- time_since_epoch[link /reference/chrono/time_point/time_since_epoch.md]
- この演算子により、以下の演算子が使用可能になる (C++20):
operator!=
#include <cassert>
#include <chrono>
using namespace std::chrono;
int main()
{
seconds s(3);
time_point<system_clock> p1(s);
time_point<system_clock> p2(s);
const bool result = p1 == p2;
assert(result);
}- p1 == p2[color ff0000]
- system_clock[link /reference/chrono/system_clock.md]
- C++11
- GCC: 4.6.1
- Visual C++: 2012, 2013, 2015
- N3469 Constexpr Library Additions: chrono, v3
- P1614R2 The Mothership has Landed
- C++20での三方比較演算子の追加と、関連する演算子の自動導出