std::chrono::operator<<(std::chrono::weekday)
时间点 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
时长 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
时钟 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
当天时刻 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
日历 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
时区 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
chrono
I/O
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
(C++20)
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
C 风格日期和时间 |
成员函数 | ||||
非成员函数 | ||||
operator<<
|
||||
辅助类 | ||||
(C++26)
|
在标头
<chrono>
定义
|
||
template<
class
CharT, class
Traits >
std::basic_ostream<CharT,
Traits>& |
(C++20 起) | |
若 !wd.ok() 则插入 wd.c_encoding() 后随 " is not a valid
weekday" 到 os
中。否则构成用与 os
关联的本地环境确定,由 wd
所表示的星期之日的缩写星期之日名组成的
std::basic_string<CharT>
s
,并插入
s
到 os
中。
等价于
return os << (wd.ok()
?
std::format(os.getloc(),
STATICALLY_WIDEN<CharT>("{:L%a}"), wd) :
std::format(os.getloc(),
STATICALLY_WIDEN<CharT>("{} is not
a valid weekday"),
wd.c_encoding()));
其中 STATICALLY_WIDEN<CharT>("...") 若
CharT
为 char 则为 "..." ,而若
CharT
为 wchar_t 则为
L"..." 。
返回值
os
。
缺陷报告
下列更改行为的缺陷报告追溯地应用于以前出版的 C++ 标准。
缺陷报告 | 应用于 | 出版时的行为 | 正确行为 |
---|---|---|---|
P2372R3 | C++20 | 默认使用给定的本地环境 | 需要 L 以使用本地环境
|
参阅
(C++20)
|
在新 string 中存储参数的格式化表示 (函数模板) |
std::formatter 的特化,按照提供的格式格式化
weekday (类模板特化) |