std::chrono::year_month_weekday operator<<

std::chrono::year_month_weekday operator<< (스트림 출력)

std::chrono::year_month_weekday 값을 출력 스트림에 쓰는 연산자예요. 연·월·n번째 요일 형태로 출력해요. C++20부터 있어요.

출처: cppreference

본문

<chrono> 헤더에 정의돼 있고, year_month_weekday용 출력 연산자예요.

template< class CharT, class Traits >
std::basic_ostream<CharT, Traits>&
    operator<<( std::basic_ostream<CharT, Traits>& os,
                const std::chrono::year_month_weekday& ymwd );

year_month_weekday 값을 스트림 os에 써요. 연·월·요일과 그 인덱스를 함께 표시해요. 예를 들어 2023/Sep/Fri[2]처럼 월 이름(영문 약어)과 요일 약어, 그리고 n번째 인덱스를 [n] 형태로 출력해요.

#include <chrono>
#include <iostream>

int main()
{
    using namespace std::chrono;
    year_month_weekday ymwd{2023y/September/Friday[2]};
    std::cout << ymwd << '\n'; // 2023/Sep/Fri[2]
}

더 알아보기 (Learn more)

cppreference