std::chrono::time_point<Clock,Duration>:: operator+=, operator-=
From cppreference.net
<
cpp
|
chrono
|
time point
C++
Date and time library
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
std::chrono::time_point
| Member functions | ||||
|
time_point::operator+=
time_point::operator-=
|
||||
|
(C++20)
(C++20)
|
||||
| Non-member functions | ||||
|
(until C++20)
(C++20)
|
||||
|
(C++17)
|
||||
|
(C++17)
|
||||
|
(C++17)
|
||||
| Helper classes | ||||
|
(C++26)
|
|
time_point
&
operator
+
=
(
const
duration
&
d
)
;
|
(1) |
(C++11 起)
(C++17 起为 constexpr) |
|
time_point
&
operator
-
=
(
const
duration
&
d
)
;
|
(2) |
(C++11 起)
(C++17 起为 constexpr) |
按照给定时长修改时间点。
1)
将偏移量
d
应用于
pt
。实际上,
d
会被添加到内部存储的持续时间
d_
中,即
d_
+
=
d
。
2)
将偏移量
d
以负方向应用于
pt
。实际上,
d
会从内部存储的持续时间
d_
中减去,即
d_
-
=
d
。
目录 |
参数
| d | - | 要应用的时间偏移量 |
返回值
* this
异常
可能抛出实现定义的异常。
示例
|
本节内容不完整
原因:缺少示例 |
参见
|
(C++11)
|
对时间点执行加减运算
(函数模板) |