chrono_weekday_indexed

chrono_weekday_indexed (인덱스된 요일 타입)

std::chrono::weekday_indexed는 월에서 N번째로 나타나는 요일을 나타내는 타입이에요. 예: "두 번째 월요일".

출처: cppreference

본문

std::chrono::weekday_indexed<chrono> 헤더에 정의된 클래스예요. C++20부터 사용 가능해요.

class weekday_indexed;

월에서 특정 순번(N번째)의 요일을 나타내요. weekday와 1~5 사이의 인덱스를 저장해요. 예를 들어 Monday[2]는 "두 번째 월요일"이에요.

멤버 함수

  • weekday() — 요일을 반환
  • index() — 인덱스를 반환
  • ok() — 유효한지 확인 (인덱스 1~5)

예제 (Example)

#include <chrono>
#include <iostream>

int main()
{
    using namespace std::chrono;
    weekday_indexed wi = Monday[2];
    std::cout << unsigned(wi.weekday().c_encoding()) << '/' << wi.index() << '\n';
    // 1/2
}

더 알아보기 (Learn more)

cppreference