stdchronoweekday_indexedweekday_indexed(3)
std::chrono::weekday_indexed::weekday_indexed - std::chrono::weekday_indexed::weekday_indexed
Synopsis
weekday_indexed() = default;
(since C++ 20)
constexpr weekday_indexed(const std::chrono::weekday &wd, unsigned index) noexcept;
(since C++ 20)Constructs a weekday_indexed.
- Default constructor leaves both the std::chrono::weekday and the index value uninitialized.
- Constructs a weekday_indexed storing the weekday wd and the index index. The values held are unspecified if !wd.ok() || index == 0 || index > 5.
Notes
A more convenient way to construct a weekday_indexed is with weekday’s operator[], i.e., wd[index].
Example
// Run this code
#include <chrono>
#include <iostream>
using namespace std::chrono;
int main()
{
auto wdi = Tuesday[2]; // wdi is weekday_indexed representing the 2nd tuesday
std::cout << year_month_day{wdi / October / 2019y};
}
Output:
See also