std::chrono::year_month_day_last::operator+=, std::chrono::year_month_day_last::operator-=
来自cppreference.com
< cpp | chrono | year month day
last
工具库
日期和时间工具
| 时间点 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 时长 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 时钟 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 当天时刻 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 日历 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 时区 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
chrono
I/O
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
(C++20)
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| C 风格日期和时间 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
std::chrono::year_month_day_last
| 成员函数 | ||||
|
year_month_day_last::operator+=year_month_day_last::operator-=
|
||||
| 非成员函数 | ||||
| 辅助类 | ||||
|
constexpr
std::chrono::year_month_day_last&
operator+=(const
std::chrono::years&
dy)
const
noexcept;
|
(1) | (C++20 起) |
|
constexpr
std::chrono::year_month_day_last&
operator+=(const
std::chrono::months&
dm)
const
noexcept;
|
(2) | (C++20 起) |
|
constexpr
std::chrono::year_month_day_last&
operator-=(const
std::chrono::years&
dy)
const
noexcept;
|
(3) | (C++20 起) |
|
constexpr
std::chrono::year_month_day_last&
operator-=(const
std::chrono::months&
dm)
const
noexcept;
|
(4) | (C++20 起) |
以时长 dy 或 dm 为程度修改时间点 *this 。
1) 等价于 *this = *this + dy;
2) 等价于 *this = *this + dm;
3) 等价于 *this = *this - dy;
4) 等价于 *this = *this - dm;
对于能转换到 std::chrono::years 与 std::chrono::months 两者的时长,若调用有歧义,则偏好
years 重载 (1,3) 。
参阅
|
(C++20)
|
将 year_month_day_last 和一定数量的
years 或 months 相加或相减 (函数) |