std::chrono::year::operator+=, std::chrono::year::operator-=
来自cppreference.com
日期和时间工具
| 时间点 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 时长 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 时钟 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 当天时刻 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 日历 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 时区 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
chrono
I/O
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
(C++20)
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| C 风格日期和时间 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
std::chrono::year
| 成员函数 | ||||
|
year::operator+=year::operator-=
|
||||
| 非成员函数 | ||||
| 辅助类 | ||||
|
(C++26)
|
|
constexpr
std::chrono::year&
operator+=(const
std::chrono::years&
y)
noexcept;
|
(1) | (C++20 起) |
|
constexpr
std::chrono::year&
operator-=(const
std::chrono::years&
y)
noexcept;
|
(2) | (C++20 起) |
从年份值加或减 y.count() 年。
1) 等价于 *this = *this + y;
2) 等价于 *this = *this - y;
返回值
到修改后的此 year 的引用。
注意
若结果会在范围 [-32767, 32767] 外,则实际存储值未指定。
示例
| 本节未完成 原因:暂无示例 |
参阅
自增或自减 year (公开成员函数) |
|
|
(C++20)
|
进行 year 上的算术 (函数) |