Namespaces
Variants

std::chrono::weekday:: operator[]

From cppreference.net
constexpr std:: chrono :: weekday_indexed
operator [ ] ( unsigned index ) const noexcept ;
(1) (C++20부터)
constexpr std:: chrono :: weekday_last
operator [ ] ( std:: chrono :: last_spec ) const noexcept ;
(2) (C++20부터)
1) weekday_indexed * this index 로부터 생성합니다. 결과는 아직 지정되지 않은 특정 월의 index 번째 요일을 나타냅니다. index 가 범위 [ 0 , 7 ] 내에 있지 않거나 ! ok ( ) 인 경우, 결과에 보관된 값(기본 요일과 인덱스)은 지정되지 않습니다.
2) weekday_last * this 로부터 생성합니다. 결과는 아직 지정되지 않은 어떤 월의 마지막 평일을 나타냅니다.

반환값

예제

#include <chrono>
#include <iostream>
using namespace std::chrono;
int main()
{
    constexpr auto second_tuesday_in_October_2019 =
        year_month_day{Tuesday[2] / October / 2019y};
    constexpr auto last_tuesday_in_October_2019 =
        year_month_day{Tuesday[last] / October / 2019y};
    std::cout << second_tuesday_in_October_2019 << '\n'
              << last_tuesday_in_October_2019 << '\n'; 
}

가능한 출력:

2019-10-08
2019-10-29