std::chrono::operator<<(std::chrono::weekday)

来自cppreference.com
< cpp‎ | chrono‎ | weekday
 
 
 
 
在标头 <chrono> 定义
template< class CharT, class Traits >

std::basic_ostream<CharT, Traits>&

    operator<<( std::basic_ostream<CharT, Traits>& os, const std::chrono::weekday& wd );
(C++20 起)

!wd.ok() 则插入 wd.c_encoding() 后随 " is not a valid weekday"os 中。否则构成用 std::basic_string<CharT> s,它由与 os 关联的本地环境确定,由 wd 所表示的星期之日的缩写星期之日名组成,并插入 sos 中。

等价于

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>("...")CharTchar 时为 "...",而当 CharTwchar_t 时为 L"..."

返回值

os

示例

缺陷报告

下列更改行为的缺陷报告追溯地应用于以前出版的 C++ 标准。

缺陷报告应用于出版时的行为正确行为
P2372R3C++20默认使用给定的本地环境需要 L 以使用本地环境

参阅

(C++20)
在新字符串中存储参数的格式化表示
(函数模板)
weekday 的格式化支持
(类模板特化)