Files
2025-10-25 03:02:53 +03:00

3.1 KiB

[time.cal.wdlast]

30 Time library [time]

30.8 The civil calendar [time.cal]

30.8.8 Class weekday_last [time.cal.wdlast]

30.8.8.1 Overview [time.cal.wdlast.overview]

namespace std::chrono {class weekday_last { chrono::weekday wd_; // exposition onlypublic:constexpr explicit weekday_last(const chrono::weekday& wd) noexcept; constexpr chrono::weekday weekday() const noexcept; constexpr bool ok() const noexcept; };}

1

#

weekday_last represents the last weekday of a month.

2

#

[Note 1:

A weekday_last object can be constructed by indexing a weekday with last.

— end note]

[Example 1: constexpr auto wdl = Sunday[last]; // wdl is the last Sunday of an as yet unspecified monthstatic_assert(wdl.weekday() == Sunday); — end example]

3

#

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

30.8.8.2 Member functions [time.cal.wdlast.members]

🔗

constexpr explicit weekday_last(const chrono::weekday& wd) noexcept;

1

#

Effects: Initializes wd_ with wd.

🔗

constexpr chrono::weekday weekday() const noexcept;

2

#

Returns: wd_.

🔗

constexpr bool ok() const noexcept;

3

#

Returns: wd_.ok().

30.8.8.3 Non-member functions [time.cal.wdlast.nonmembers]

🔗

constexpr bool operator==(const weekday_last& x, const weekday_last& y) noexcept;

1

#

Returns: x.weekday() == y.weekday().

🔗

template<class charT, class traits> basic_ostream<charT, traits>& operator<<(basic_ostream<charT, traits>& os, const weekday_last& wdl);

2

#

Effects: Equivalent to:return os << format(os.getloc(), STATICALLY-WIDEN("{:L}[last]"), wdl.weekday());