名稱空間
變體
操作

std::chrono::operator<<(std::chrono::sys_time)

來自 cppreference.com
< cpp‎ | chrono‎ | system_clock
 
 
 
 
定義於標頭檔案 <chrono>
template< class CharT, class Traits, class Duration >

std::basic_ostream<CharT, Traits>&
    operator<<( std::basic_ostream<CharT, Traits>& os,

                const std::chrono::sys_time<Duration>& tp );
(1) (C++20 起)
template< class CharT, class Traits, class Duration >

std::basic_ostream<CharT, Traits>&
    operator<<( std::basic_ostream<CharT, Traits>& os,

                const std::chrono::sys_days& tp );
(2) (C++20 起)

tp 輸出到流 os

1) 等價於
return os << std::format(os.getloc(), STATICALLY-WIDEN<CharT>("{:L%F %T}"), tp);

其中 STATICALLY_WIDEN<CharT>("{:L%F %T}")"{:L%F %T}"(如果 CharTchar),如果 CharTwchar_t,則為 L"{:L%F %T}"

此過載僅在 std::chrono::treat_as_floating_point_v<typename Duration::rep>falseDuration(1) < std::chrono::days(1) 時參與過載決議。
2) 等價於 os << std::chrono::year_month_day(tp);

[編輯] 返回值

os

[編輯] 缺陷報告

下列更改行為的缺陷報告追溯地應用於以前出版的 C++ 標準。

缺陷報告 應用於 釋出時的行為 正確的行為
P2372R3 C++20 預設使用給定區域設定 需要 L 才能使用給定區域設定

[編輯] 參閱

sys_time 的格式化支援
(類模板特化) [編輯]
(C++20)
將引數的格式化表示儲存在新字串中
(函式模板) [編輯]
year_month_day 輸出到流中
(函式模板) [編輯]