year_operator_ltlt

year_operator_ltlt (year 출력)

std::chrono::year에 대한 operator<<는 연도를 스트림에 출력해요.

출처: cppreference

본문

std::chrono::year의 스트림 출력 연산자는 <chrono> 헤더에 정의되어 있어요. C++20부터 사용 가능해요.

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

y의 연도를 10진수로 스트림에 출력해요. 유효하지 않은 값이면 " is not a valid year"를 붙여요.

예제 (Example)

#include <chrono>
#include <iostream>

int main()
{
    std::cout << std::chrono::year{2020} << '\n'; // 2020
    std::cout << std::chrono::year{-1} << '\n';   // -1 is not a valid year
}

더 알아보기 (Learn more)

cppreference