Namespaces
Variants

std::chrono::weekday_indexed:: index

From cppreference.net
constexpr unsigned index ( ) const noexcept ;
(C++20 이후)

* this 에 저장된 인덱스에 접근합니다.

반환값

* this 에 저장된 인덱스입니다.

예제

#include <chrono>
#include <iostream>
int main()
{
    std::cout << std::boolalpha;
    std::chrono::weekday_indexed wdi {std::chrono::Tuesday[2]}; // 한 달의 두 번째 화요일
    std::cout << (std::chrono::year_month_day{wdi/10/2019} == 
                  std::chrono::year_month_day{std::chrono::October/8/2019}) << ' ';
    wdi = {wdi.weekday()[wdi.index() + 2]}; // 두 번째 화요일 => 네 번째 화요일
    std::cout << (std::chrono::year_month_day{wdi/10/2019} == 
                  std::chrono::year_month_day{std::chrono::October/22/2019}) << '\n';
}

출력:

true true