operators (std::time_point)
运算符+,运算符-%28 std::time[医]点%29
| (1) | |
---|---|---|
template< class C, class D1, class R2, class P2 > time_point<C, typename std::common_type<D1, duration<R2,P2>>::type> operator+( const time_point<C,D1>& pt, const duration<R2,P2>& d | (since C++11) (until C++14) | |
template< class C, class D1, class R2, class P2 > constexpr time_point<C, typename std::common_type<D1, duration<R2,P2>>::type> operator+( const time_point<C,D1>& pt, const duration<R2,P2>& d | (since C++14) | |
| (2) | |
template< class R1, class P1, class C, class D2 > time_point<C, typename std::common_type<duration<R1,P1>,D2>::type> operator+( const duration<R1,P1>& d, const time_point<C,D2>& pt | (since C++11) (until C++14) | |
template< class R1, class P1, class C, class D2 > constexpr time_point<C, typename std::common_type<duration<R1,P1>,D2>::type> operator+( const duration<R1,P1>& d, const time_point<C,D2>& pt | (since C++14) | |
| (3) | |
template< class C, class D1, class R2, class P2 > time_point<C, typename std::common_type<D1, duration<R2,P2>>::type> operator-( const time_point<C,D1>& d, const duration<R2,P2>& pt | (since C++11) (until C++14) | |
template< class C, class D1, class R2, class P2 > constexpr time_point<C, typename std::common_type<D1, duration<R2,P2>>::type> operator-( const time_point<C,D1>& d, const duration<R2,P2>& pt | (since C++14) | |
| (4) | |
template< class C, class D1, class D2 > typename std::common_type<D1,D2>::type operator-( const time_point<C,D1>& pt_lhs, const time_point<C,D2>& pt_rhs | (since C++11) (until C++14) | |
template< class C, class D1, class D2 > constexpr typename std::common_type<D1,D2>::type operator-( const time_point<C,D1>& pt_lhs, const time_point<C,D2>& pt_rhs | (since C++14) |
执行涉及time_point
...
1-2%29适用偏移量d
到pt
.有效返回CT(pt.time_since_epoch() + d)
,在哪里CT
是返回类型。
3%29应用偏移量d
到pt
向负方向。有效回报CT(ot.time_since_epoch() - d)
,在哪里CT
是返回类型。
4%29计算pt_lhs
和pt_rhs
...
参数
pt | - | a time point to apply the offset to |
---|---|---|
d | - | a time offset |
pt_lhs, pt_rhs | - | time points to extract difference from |
返回值
1-3%29由于使用偏移量而产生的时间点。d
...
4%~29时间点之间的持续时间。
例外
%280%29
缺陷报告
以下行为更改缺陷报告追溯应用于先前发布的C++标准。
DR | Applied to | Behavior as published | Correct behavior |
---|---|---|---|
LWG 2739 | C++11 | pt - d behaved erratically for unsigned durations | behavior corrected |
另见
operator+=operator-= | modifies the time point by the given duration (public member function) |
---|
© cppreference.com
在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。