std::chrono::weekday_indexed
From cppreference.com
C++
Feature test macros (C++20)
Concepts library (C++20)
Metaprogramming library (C++11)
Ranges library (C++20)
Filesystem library (C++17)
Concurrency support library (C++11)
Execution control library (C++26)
Date and time library
(C++11)
(C++20)
(C++20)
(C++11)
(C++11)
(C++11)
(C++20)
(C++20)
(C++20)
(C++11)
(C++20)
(C++20)
(C++20)
(C++20)(C++20)
(C++20)(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
weekday_indexed
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)(C++20)
(C++20)
(C++20)
(C++20)
(C++20)(C++20)(C++20)(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
std::chrono::weekday_indexed
Member functions
Nonmember functions
Helper classes
Defined in header
<chrono>
class weekday_indexed;
(since C++20)
The class weekday_indexed
combines a weekday, representing a day of the week in the proleptic Gregorian calendar, with a small index n
in the range [
1,
5]
. It represents the first, second, third, fourth, or fifth weekday of some month.
weekday_indexed
is a TriviallyCopyable StandardLayoutType.
[edit] Member functions
[edit] Nonmember functions
[edit] Helper classes
hash support for std::chrono::weekday_indexed
(class template specialization)
(class template specialization)
[edit] Example
Run this code
#include <chrono> #include <iostream> int main() { using namespace std::chrono; constexpr weekday_indexed wi = Friday[2]; // Indexed weekday can be used at any place where chrono::day can be used: constexpr year_month_weekday ymwd = 2021y / August / wi; static_assert(ymwd == August / wi / 2021y && ymwd == wi / August / 2021y); std::cout << ymwd << '\n'; constexpr year_month_day ymd{ymwd}; // a conversion static_assert(ymd == 2021y / 8 / 13); std::cout << ymd << '\n'; }
Possible output:
2021/Aug/Fri[2] 2021年08月13日