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

3.7 KiB

[time.cal.mwdlast]

30 Time library [time]

30.8 The civil calendar [time.cal]

30.8.12 Class month_weekday_last [time.cal.mwdlast]

30.8.12.1 Overview [time.cal.mwdlast.overview]

namespace std::chrono {class month_weekday_last { chrono::month m_; // exposition only chrono::weekday_last wdl_; // exposition onlypublic:constexpr month_weekday_last(const chrono::month& m, const chrono::weekday_last& wdl) noexcept; constexpr chrono::month month() const noexcept; constexpr chrono::weekday_last weekday_last() const noexcept; constexpr bool ok() const noexcept; };}

1

#

month_weekday_last represents the last weekday of a month, of an as yet unspecified year.

To do this the month_weekday_last stores a month and a weekday_last.

2

#

[Example 1: constexpr auto mwd = February/Tuesday[last]; // mwd is the last Tuesday of February of an as yet unspecified yearstatic_assert(mwd.month() == February);static_assert(mwd.weekday_last() == Tuesday[last]); — end example]

3

#

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

30.8.12.2 Member functions [time.cal.mwdlast.members]

🔗

constexpr month_weekday_last(const chrono::month& m, const chrono::weekday_last& wdl) noexcept;

1

#

Effects: Initializes m_ with m, and wdl_ with wdl.

🔗

constexpr chrono::month month() const noexcept;

2

#

Returns: m_.

🔗

constexpr chrono::weekday_last weekday_last() const noexcept;

3

#

Returns: wdl_.

🔗

constexpr bool ok() const noexcept;

4

#

Returns: m_.ok() && wdl_.ok().

30.8.12.3 Non-member functions [time.cal.mwdlast.nonmembers]

🔗

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

1

#

Returns: x.month() == y.month() && x.weekday_last() == y.weekday_last().

🔗

template<class charT, class traits> basic_ostream<charT, traits>& operator<<(basic_ostream<charT, traits>& os, const month_weekday_last& mwdl);

2

#

Effects: Equivalent to:return os << format(os.getloc(), STATICALLY-WIDEN("{:L}/{:L}"), mwdl.month(), mwdl.weekday_last());