[time.cal.wdidx.overview] (original) (raw)

30 Time library [time]

30.8 The civil calendar [time.cal]

30.8.7 Class weekday_indexed [time.cal.wdidx]

30.8.7.1 Overview [time.cal.wdidx.overview]

namespace std::chrono { class weekday_indexed { chrono::weekday wd_; unsigned char index_; public: weekday_indexed() = default;constexpr weekday_indexed(const chrono::weekday& wd, unsigned index) noexcept;constexpr chrono::weekday weekday() const noexcept;constexpr unsigned index() const noexcept;constexpr bool ok() const noexcept;};}

weekday_indexed represents a weekdayand a small index in the range 1 to 5.

This class is used to represent the first, second, third, fourth, or fifth weekday of a month.

[Note 1:

A weekday_indexed object can be constructed by indexing a weekdaywith an unsigned.

— _end note_]

[Example 1: constexpr auto wdi = Sunday[2]; static_assert(wdi.weekday() == Sunday);static_assert(wdi.index() == 2); — _end example_]

weekday_indexed is a trivially copyable and standard-layout class type.