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

3.6 KiB

[time.cal.mwd]

30 Time library [time]

30.8 The civil calendar [time.cal]

30.8.11 Class month_weekday [time.cal.mwd]

30.8.11.1 Overview [time.cal.mwd.overview]

namespace std::chrono {class month_weekday { chrono::month m_; // exposition only chrono::weekday_indexed wdi_; // exposition onlypublic:constexpr month_weekday(const chrono::month& m, const chrono::weekday_indexed& wdi) noexcept; constexpr chrono::month month() const noexcept; constexpr chrono::weekday_indexed weekday_indexed() const noexcept; constexpr bool ok() const noexcept; };}

1

#

month_weekday represents the nth weekday of a month, of an as yet unspecified year.

To do this the month_weekday stores a month and a weekday_indexed.

2

#

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

3

#

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

30.8.11.2 Member functions [time.cal.mwd.members]

🔗

constexpr month_weekday(const chrono::month& m, const chrono::weekday_indexed& wdi) noexcept;

1

#

Effects: Initializes m_ with m, and wdi_ with wdi.

🔗

constexpr chrono::month month() const noexcept;

2

#

Returns: m_.

🔗

constexpr chrono::weekday_indexed weekday_indexed() const noexcept;

3

#

Returns: wdi_.

🔗

constexpr bool ok() const noexcept;

4

#

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

30.8.11.3 Non-member functions [time.cal.mwd.nonmembers]

🔗

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

1

#

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

🔗

template<class charT, class traits> basic_ostream<charT, traits>& operator<<(basic_ostream<charT, traits>& os, const month_weekday& mwd);

2

#

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