Namespaces
Variants

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

From cppreference.net
定义于头文件 <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 ( ) ,则向 os 插入 wd. c_encoding ( ) 后接 " is not a valid weekday" 。否则,构造一个由 wd 所表示星期几的缩写名称组成的 std:: basic_string < CharT > s (使用与 os 关联的区域设置确定),并将 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 默认使用给定的locale 需要使用 L 前缀来使用给定的locale

参见

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