From Jason Turner

[time.cal]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp4x0puzm4/{from.md → to.md} +2954 -0
tmp/tmp4x0puzm4/{from.md → to.md} RENAMED
@@ -0,0 +1,2954 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## The civil calendar <a id="time.cal">[[time.cal]]</a>
2
+
3
+ ### In general <a id="time.cal.general">[[time.cal.general]]</a>
4
+
5
+ The types in [[time.cal]] describe the civil (Gregorian) calendar and
6
+ its relationship to `sys_days` and `local_days`.
7
+
8
+ ### Class `last_spec` <a id="time.cal.last">[[time.cal.last]]</a>
9
+
10
+ ``` cpp
11
+ namespace std::chrono {
12
+ struct last_spec {
13
+ explicit last_spec() = default;
14
+ };
15
+ }
16
+ ```
17
+
18
+ The type `last_spec` is used in conjunction with other calendar types to
19
+ specify the last in a sequence. For example, depending on context, it
20
+ can represent the last day of a month, or the last day of the week of a
21
+ month.
22
+
23
+ ### Class `day` <a id="time.cal.day">[[time.cal.day]]</a>
24
+
25
+ #### Overview <a id="time.cal.day.overview">[[time.cal.day.overview]]</a>
26
+
27
+ ``` cpp
28
+ namespace std::chrono {
29
+ class day {
30
+ unsigned char d_; // exposition only
31
+ public:
32
+ day() = default;
33
+ constexpr explicit day(unsigned d) noexcept;
34
+
35
+ constexpr day& operator++() noexcept;
36
+ constexpr day operator++(int) noexcept;
37
+ constexpr day& operator--() noexcept;
38
+ constexpr day operator--(int) noexcept;
39
+
40
+ constexpr day& operator+=(const days& d) noexcept;
41
+ constexpr day& operator-=(const days& d) noexcept;
42
+
43
+ constexpr explicit operator unsigned() const noexcept;
44
+ constexpr bool ok() const noexcept;
45
+ };
46
+ }
47
+ ```
48
+
49
+ `day` represents a day of a month. It normally holds values in the range
50
+ 1 to 31, but may hold non-negative values outside this range. It can be
51
+ constructed with any `unsigned` value, which will be subsequently
52
+ truncated to fit into `day`’s unspecified internal storage. `day` meets
53
+ the *Cpp17EqualityComparable* ([[cpp17.equalitycomparable]]) and
54
+ *Cpp17LessThanComparable* ([[cpp17.lessthancomparable]]) requirements,
55
+ and participates in basic arithmetic with `days` objects, which
56
+ represent a difference between two `day` objects.
57
+
58
+ `day` is a trivially copyable and standard-layout class type.
59
+
60
+ #### Member functions <a id="time.cal.day.members">[[time.cal.day.members]]</a>
61
+
62
+ ``` cpp
63
+ constexpr explicit day(unsigned d) noexcept;
64
+ ```
65
+
66
+ *Effects:* Initializes `d_` with `d`. The value held is unspecified if
67
+ `d` is not in the range \[`0`, `255`\].
68
+
69
+ ``` cpp
70
+ constexpr day& operator++() noexcept;
71
+ ```
72
+
73
+ *Effects:* `++d_`.
74
+
75
+ *Returns:* `*this`.
76
+
77
+ ``` cpp
78
+ constexpr day operator++(int) noexcept;
79
+ ```
80
+
81
+ *Effects:* `++(*this)`.
82
+
83
+ *Returns:* A copy of `*this` as it existed on entry to this member
84
+ function.
85
+
86
+ ``` cpp
87
+ constexpr day& operator--() noexcept;
88
+ ```
89
+
90
+ *Effects:* Equivalent to: `–d_`.
91
+
92
+ *Returns:* `*this`.
93
+
94
+ ``` cpp
95
+ constexpr day operator--(int) noexcept;
96
+ ```
97
+
98
+ *Effects:* `–(*this)`.
99
+
100
+ *Returns:* A copy of `*this` as it existed on entry to this member
101
+ function.
102
+
103
+ ``` cpp
104
+ constexpr day& operator+=(const days& d) noexcept;
105
+ ```
106
+
107
+ *Effects:* `*this = *this + d`.
108
+
109
+ *Returns:* `*this`.
110
+
111
+ ``` cpp
112
+ constexpr day& operator-=(const days& d) noexcept;
113
+ ```
114
+
115
+ *Effects:* `*this = *this - d`.
116
+
117
+ *Returns:* `*this`.
118
+
119
+ ``` cpp
120
+ constexpr explicit operator unsigned() const noexcept;
121
+ ```
122
+
123
+ *Returns:* `d_`.
124
+
125
+ ``` cpp
126
+ constexpr bool ok() const noexcept;
127
+ ```
128
+
129
+ *Returns:* `1 <= d_ && d_ <= 31`.
130
+
131
+ #### Non-member functions <a id="time.cal.day.nonmembers">[[time.cal.day.nonmembers]]</a>
132
+
133
+ ``` cpp
134
+ constexpr bool operator==(const day& x, const day& y) noexcept;
135
+ ```
136
+
137
+ *Returns:* `unsigned{x} == unsigned{y}`.
138
+
139
+ ``` cpp
140
+ constexpr strong_ordering operator<=>(const day& x, const day& y) noexcept;
141
+ ```
142
+
143
+ *Returns:* `unsigned{x} <=> unsigned{y}`.
144
+
145
+ ``` cpp
146
+ constexpr day operator+(const day& x, const days& y) noexcept;
147
+ ```
148
+
149
+ *Returns:* `day(unsigned{x} + y.count())`.
150
+
151
+ ``` cpp
152
+ constexpr day operator+(const days& x, const day& y) noexcept;
153
+ ```
154
+
155
+ *Returns:* `y + x`.
156
+
157
+ ``` cpp
158
+ constexpr day operator-(const day& x, const days& y) noexcept;
159
+ ```
160
+
161
+ *Returns:* `x + -y`.
162
+
163
+ ``` cpp
164
+ constexpr days operator-(const day& x, const day& y) noexcept;
165
+ ```
166
+
167
+ *Returns:* `days{int(unsigned{x}) - int(unsigned{y})}`.
168
+
169
+ ``` cpp
170
+ template<class charT, class traits>
171
+ basic_ostream<charT, traits>&
172
+ operator<<(basic_ostream<charT, traits>& os, const day& d);
173
+ ```
174
+
175
+ *Effects:* Equivalent to:
176
+
177
+ ``` cpp
178
+ return os << (d.ok() ?
179
+ format(STATICALLY-WIDEN<charT>("{:%d}"), d) :
180
+ format(STATICALLY-WIDEN<charT>("{:%d} is not a valid day"), d));
181
+ ```
182
+
183
+ ``` cpp
184
+ template<class charT, class traits, class Alloc = allocator<charT>>
185
+ basic_istream<charT, traits>&
186
+ from_stream(basic_istream<charT, traits>& is, const charT* fmt,
187
+ day& d, basic_string<charT, traits, Alloc>* abbrev = nullptr,
188
+ minutes* offset = nullptr);
189
+ ```
190
+
191
+ *Effects:* Attempts to parse the input stream `is` into the `day` `d`
192
+ using the format flags given in the NTCTS `fmt` as specified in
193
+ [[time.parse]]. If the parse fails to decode a valid day,
194
+ `is.setstate(ios_base::failbit)` is called and `d` is not modified. If
195
+ `%Z` is used and successfully parsed, that value will be assigned to
196
+ `*abbrev` if `abbrev` is non-null. If `%z` (or a modified variant) is
197
+ used and successfully parsed, that value will be assigned to `*offset`
198
+ if `offset` is non-null.
199
+
200
+ *Returns:* `is`.
201
+
202
+ ``` cpp
203
+ constexpr chrono::day operator""d(unsigned long long d) noexcept;
204
+ ```
205
+
206
+ *Returns:* `day{static_cast<unsigned>(d)}`.
207
+
208
+ ### Class `month` <a id="time.cal.month">[[time.cal.month]]</a>
209
+
210
+ #### Overview <a id="time.cal.month.overview">[[time.cal.month.overview]]</a>
211
+
212
+ ``` cpp
213
+ namespace std::chrono {
214
+ class month {
215
+ unsigned char m_; // exposition only
216
+ public:
217
+ month() = default;
218
+ constexpr explicit month(unsigned m) noexcept;
219
+
220
+ constexpr month& operator++() noexcept;
221
+ constexpr month operator++(int) noexcept;
222
+ constexpr month& operator--() noexcept;
223
+ constexpr month operator--(int) noexcept;
224
+
225
+ constexpr month& operator+=(const months& m) noexcept;
226
+ constexpr month& operator-=(const months& m) noexcept;
227
+
228
+ constexpr explicit operator unsigned() const noexcept;
229
+ constexpr bool ok() const noexcept;
230
+ };
231
+ }
232
+ ```
233
+
234
+ `month` represents a month of a year. It normally holds values in the
235
+ range 1 to 12, but may hold non-negative values outside this range. It
236
+ can be constructed with any `unsigned` value, which will be subsequently
237
+ truncated to fit into `month`’s unspecified internal storage. `month`
238
+ meets the *Cpp17EqualityComparable* ([[cpp17.equalitycomparable]]) and
239
+ *Cpp17LessThanComparable* ([[cpp17.lessthancomparable]]) requirements,
240
+ and participates in basic arithmetic with `months` objects, which
241
+ represent a difference between two `month` objects.
242
+
243
+ `month` is a trivially copyable and standard-layout class type.
244
+
245
+ #### Member functions <a id="time.cal.month.members">[[time.cal.month.members]]</a>
246
+
247
+ ``` cpp
248
+ constexpr explicit month(unsigned m) noexcept;
249
+ ```
250
+
251
+ *Effects:* Initializes `m_` with `m`. The value held is unspecified if
252
+ `m` is not in the range \[`0`, `255`\].
253
+
254
+ ``` cpp
255
+ constexpr month& operator++() noexcept;
256
+ ```
257
+
258
+ *Effects:* `*this += months{1}`.
259
+
260
+ *Returns:* `*this`.
261
+
262
+ ``` cpp
263
+ constexpr month operator++(int) noexcept;
264
+ ```
265
+
266
+ *Effects:* `++(*this)`.
267
+
268
+ *Returns:* A copy of `*this` as it existed on entry to this member
269
+ function.
270
+
271
+ ``` cpp
272
+ constexpr month& operator--() noexcept;
273
+ ```
274
+
275
+ *Effects:* `*this -= months{1}`.
276
+
277
+ *Returns:* `*this`.
278
+
279
+ ``` cpp
280
+ constexpr month operator--(int) noexcept;
281
+ ```
282
+
283
+ *Effects:* `–(*this)`.
284
+
285
+ *Returns:* A copy of `*this` as it existed on entry to this member
286
+ function.
287
+
288
+ ``` cpp
289
+ constexpr month& operator+=(const months& m) noexcept;
290
+ ```
291
+
292
+ *Effects:* `*this = *this + m`.
293
+
294
+ *Returns:* `*this`.
295
+
296
+ ``` cpp
297
+ constexpr month& operator-=(const months& m) noexcept;
298
+ ```
299
+
300
+ *Effects:* `*this = *this - m`.
301
+
302
+ *Returns:* `*this`.
303
+
304
+ ``` cpp
305
+ constexpr explicit operator unsigned() const noexcept;
306
+ ```
307
+
308
+ *Returns:* `m_`.
309
+
310
+ ``` cpp
311
+ constexpr bool ok() const noexcept;
312
+ ```
313
+
314
+ *Returns:* `1 <= m_ && m_ <= 12`.
315
+
316
+ #### Non-member functions <a id="time.cal.month.nonmembers">[[time.cal.month.nonmembers]]</a>
317
+
318
+ ``` cpp
319
+ constexpr bool operator==(const month& x, const month& y) noexcept;
320
+ ```
321
+
322
+ *Returns:* `unsigned{x} == unsigned{y}`.
323
+
324
+ ``` cpp
325
+ constexpr strong_ordering operator<=>(const month& x, const month& y) noexcept;
326
+ ```
327
+
328
+ *Returns:* `unsigned{x} <=> unsigned{y}`.
329
+
330
+ ``` cpp
331
+ constexpr month operator+(const month& x, const months& y) noexcept;
332
+ ```
333
+
334
+ *Returns:*
335
+
336
+ ``` cpp
337
+ month{modulo(static_cast<long long>(unsigned{x}) + (y.count() - 1), 12) + 1}
338
+ ```
339
+
340
+ where `modulo(n, 12)` computes the remainder of `n` divided by 12 using
341
+ Euclidean division.
342
+
343
+ [*Note 1*: Given a divisor of 12, Euclidean division truncates towards
344
+ negative infinity and always produces a remainder in the range of \[`0`,
345
+ `11`\]. Assuming no overflow in the signed summation, this operation
346
+ results in a `month` holding a value in the range \[`1`, `12`\] even if
347
+ `!x.ok()`. — *end note*]
348
+
349
+ [*Example 1*: `February + months{11} == January`. — *end example*]
350
+
351
+ ``` cpp
352
+ constexpr month operator+(const months& x, const month& y) noexcept;
353
+ ```
354
+
355
+ *Returns:* `y + x`.
356
+
357
+ ``` cpp
358
+ constexpr month operator-(const month& x, const months& y) noexcept;
359
+ ```
360
+
361
+ *Returns:* `x + -y`.
362
+
363
+ ``` cpp
364
+ constexpr months operator-(const month& x, const month& y) noexcept;
365
+ ```
366
+
367
+ *Returns:* If `x.ok() == true` and `y.ok() == true`, returns a value `m`
368
+ in the range \[`months{0}`, `months{11}`\] satisfying `y + m == x`.
369
+ Otherwise the value returned is unspecified.
370
+
371
+ [*Example 2*: `January - February == months{11}`. — *end example*]
372
+
373
+ ``` cpp
374
+ template<class charT, class traits>
375
+ basic_ostream<charT, traits>&
376
+ operator<<(basic_ostream<charT, traits>& os, const month& m);
377
+ ```
378
+
379
+ *Effects:* Equivalent to:
380
+
381
+ ``` cpp
382
+ return os << (m.ok() ?
383
+ format(os.getloc(), STATICALLY-WIDEN<charT>("{:%b}"), m) :
384
+ format(os.getloc(), STATICALLY-WIDEN<charT>("{} is not a valid month"),
385
+ static_cast<unsigned>(m)));
386
+ ```
387
+
388
+ ``` cpp
389
+ template<class charT, class traits, class Alloc = allocator<charT>>
390
+ basic_istream<charT, traits>&
391
+ from_stream(basic_istream<charT, traits>& is, const charT* fmt,
392
+ month& m, basic_string<charT, traits, Alloc>* abbrev = nullptr,
393
+ minutes* offset = nullptr);
394
+ ```
395
+
396
+ *Effects:* Attempts to parse the input stream `is` into the `month` `m`
397
+ using the format flags given in the NTCTS `fmt` as specified in
398
+ [[time.parse]]. If the parse fails to decode a valid month,
399
+ `is.setstate(ios_base::failbit)` is called and `m` is not modified. If
400
+ `%Z` is used and successfully parsed, that value will be assigned to
401
+ `*abbrev` if `abbrev` is non-null. If `%z` (or a modified variant) is
402
+ used and successfully parsed, that value will be assigned to `*offset`
403
+ if `offset` is non-null.
404
+
405
+ *Returns:* `is`.
406
+
407
+ ### Class `year` <a id="time.cal.year">[[time.cal.year]]</a>
408
+
409
+ #### Overview <a id="time.cal.year.overview">[[time.cal.year.overview]]</a>
410
+
411
+ ``` cpp
412
+ namespace std::chrono {
413
+ class year {
414
+ short y_; // exposition only
415
+ public:
416
+ year() = default;
417
+ constexpr explicit year(int y) noexcept;
418
+
419
+ constexpr year& operator++() noexcept;
420
+ constexpr year operator++(int) noexcept;
421
+ constexpr year& operator--() noexcept;
422
+ constexpr year operator--(int) noexcept;
423
+
424
+ constexpr year& operator+=(const years& y) noexcept;
425
+ constexpr year& operator-=(const years& y) noexcept;
426
+
427
+ constexpr year operator+() const noexcept;
428
+ constexpr year operator-() const noexcept;
429
+
430
+ constexpr bool is_leap() const noexcept;
431
+
432
+ constexpr explicit operator int() const noexcept;
433
+ constexpr bool ok() const noexcept;
434
+
435
+ static constexpr year min() noexcept;
436
+ static constexpr year max() noexcept;
437
+ };
438
+ }
439
+ ```
440
+
441
+ `year` represents a year in the civil calendar. It can represent values
442
+ in the range \[`min()`, `max()`\]. It can be constructed with any `int`
443
+ value, which will be subsequently truncated to fit into `year`’s
444
+ unspecified internal storage. `year` meets the *Cpp17EqualityComparable*
445
+ ([[cpp17.equalitycomparable]]) and *Cpp17LessThanComparable* (
446
+ [[cpp17.lessthancomparable]]) requirements, and participates in basic
447
+ arithmetic with `years` objects, which represent a difference between
448
+ two `year` objects.
449
+
450
+ `year` is a trivially copyable and standard-layout class type.
451
+
452
+ #### Member functions <a id="time.cal.year.members">[[time.cal.year.members]]</a>
453
+
454
+ ``` cpp
455
+ constexpr explicit year(int y) noexcept;
456
+ ```
457
+
458
+ *Effects:* Initializes `y_` with `y`. The value held is unspecified if
459
+ `y` is not in the range \[`-32767`, `32767`\].
460
+
461
+ ``` cpp
462
+ constexpr year& operator++() noexcept;
463
+ ```
464
+
465
+ *Effects:* `++y_`.
466
+
467
+ *Returns:* `*this`.
468
+
469
+ ``` cpp
470
+ constexpr year operator++(int) noexcept;
471
+ ```
472
+
473
+ *Effects:* `++(*this)`.
474
+
475
+ *Returns:* A copy of `*this` as it existed on entry to this member
476
+ function.
477
+
478
+ ``` cpp
479
+ constexpr year& operator--() noexcept;
480
+ ```
481
+
482
+ *Effects:* `–y_`.
483
+
484
+ *Returns:* `*this`.
485
+
486
+ ``` cpp
487
+ constexpr year operator--(int) noexcept;
488
+ ```
489
+
490
+ *Effects:* `–(*this)`.
491
+
492
+ *Returns:* A copy of `*this` as it existed on entry to this member
493
+ function.
494
+
495
+ ``` cpp
496
+ constexpr year& operator+=(const years& y) noexcept;
497
+ ```
498
+
499
+ *Effects:* `*this = *this + y`.
500
+
501
+ *Returns:* `*this`.
502
+
503
+ ``` cpp
504
+ constexpr year& operator-=(const years& y) noexcept;
505
+ ```
506
+
507
+ *Effects:* `*this = *this - y`.
508
+
509
+ *Returns:* `*this`.
510
+
511
+ ``` cpp
512
+ constexpr year operator+() const noexcept;
513
+ ```
514
+
515
+ *Returns:* `*this`.
516
+
517
+ ``` cpp
518
+ constexpr year year::operator-() const noexcept;
519
+ ```
520
+
521
+ *Returns:* `year{-y_}`.
522
+
523
+ ``` cpp
524
+ constexpr bool is_leap() const noexcept;
525
+ ```
526
+
527
+ *Returns:* `y_ % 4 == 0 && (y_ % 100 != 0 || y_ % 400 == 0)`.
528
+
529
+ ``` cpp
530
+ constexpr explicit operator int() const noexcept;
531
+ ```
532
+
533
+ *Returns:* `y_`.
534
+
535
+ ``` cpp
536
+ constexpr bool ok() const noexcept;
537
+ ```
538
+
539
+ *Returns:* `min().y_ <= y_ && y_ <= max().y_`.
540
+
541
+ ``` cpp
542
+ static constexpr year min() noexcept;
543
+ ```
544
+
545
+ *Returns:* `year{-32767}`.
546
+
547
+ ``` cpp
548
+ static constexpr year max() noexcept;
549
+ ```
550
+
551
+ *Returns:* `year{32767}`.
552
+
553
+ #### Non-member functions <a id="time.cal.year.nonmembers">[[time.cal.year.nonmembers]]</a>
554
+
555
+ ``` cpp
556
+ constexpr bool operator==(const year& x, const year& y) noexcept;
557
+ ```
558
+
559
+ *Returns:* `int{x} == int{y}`.
560
+
561
+ ``` cpp
562
+ constexpr strong_ordering operator<=>(const year& x, const year& y) noexcept;
563
+ ```
564
+
565
+ *Returns:* `int{x} <=> int{y}`.
566
+
567
+ ``` cpp
568
+ constexpr year operator+(const year& x, const years& y) noexcept;
569
+ ```
570
+
571
+ *Returns:* `year{int{x} + y.count()}`.
572
+
573
+ ``` cpp
574
+ constexpr year operator+(const years& x, const year& y) noexcept;
575
+ ```
576
+
577
+ *Returns:* `y + x`.
578
+
579
+ ``` cpp
580
+ constexpr year operator-(const year& x, const years& y) noexcept;
581
+ ```
582
+
583
+ *Returns:* `x + -y`.
584
+
585
+ ``` cpp
586
+ constexpr years operator-(const year& x, const year& y) noexcept;
587
+ ```
588
+
589
+ *Returns:* `years{int{x} - int{y}}`.
590
+
591
+ ``` cpp
592
+ template<class charT, class traits>
593
+ basic_ostream<charT, traits>&
594
+ operator<<(basic_ostream<charT, traits>& os, const year& y);
595
+ ```
596
+
597
+ *Effects:* Equivalent to:
598
+
599
+ ``` cpp
600
+ return os << (y.ok() ?
601
+ format(STATICALLY-WIDEN<charT>("{:%Y}"), y) :
602
+ format(STATICALLY-WIDEN<charT>("{:%Y} is not a valid year"), y));
603
+ ```
604
+
605
+ ``` cpp
606
+ template<class charT, class traits, class Alloc = allocator<charT>>
607
+ basic_istream<charT, traits>&
608
+ from_stream(basic_istream<charT, traits>& is, const charT* fmt,
609
+ year& y, basic_string<charT, traits, Alloc>* abbrev = nullptr,
610
+ minutes* offset = nullptr);
611
+ ```
612
+
613
+ *Effects:* Attempts to parse the input stream `is` into the `year` `y`
614
+ using the format flags given in the NTCTS `fmt` as specified in
615
+ [[time.parse]]. If the parse fails to decode a valid year,
616
+ `is.setstate(ios_base::failbit)` is called and `y` is not modified. If
617
+ `%Z` is used and successfully parsed, that value will be assigned to
618
+ `*abbrev` if `abbrev` is non-null. If `%z` (or a modified variant) is
619
+ used and successfully parsed, that value will be assigned to `*offset`
620
+ if `offset` is non-null.
621
+
622
+ *Returns:* `is`.
623
+
624
+ ``` cpp
625
+ constexpr chrono::year operator""y(unsigned long long y) noexcept;
626
+ ```
627
+
628
+ *Returns:* `year{static_cast<int>(y)}`.
629
+
630
+ ### Class `weekday` <a id="time.cal.wd">[[time.cal.wd]]</a>
631
+
632
+ #### Overview <a id="time.cal.wd.overview">[[time.cal.wd.overview]]</a>
633
+
634
+ ``` cpp
635
+ namespace std::chrono {
636
+ class weekday {
637
+ unsigned char wd_; // exposition only
638
+ public:
639
+ weekday() = default;
640
+ constexpr explicit weekday(unsigned wd) noexcept;
641
+ constexpr weekday(const sys_days& dp) noexcept;
642
+ constexpr explicit weekday(const local_days& dp) noexcept;
643
+
644
+ constexpr weekday& operator++() noexcept;
645
+ constexpr weekday operator++(int) noexcept;
646
+ constexpr weekday& operator--() noexcept;
647
+ constexpr weekday operator--(int) noexcept;
648
+
649
+ constexpr weekday& operator+=(const days& d) noexcept;
650
+ constexpr weekday& operator-=(const days& d) noexcept;
651
+
652
+ constexpr unsigned c_encoding() const noexcept;
653
+ constexpr unsigned iso_encoding() const noexcept;
654
+ constexpr bool ok() const noexcept;
655
+
656
+ constexpr weekday_indexed operator[](unsigned index) const noexcept;
657
+ constexpr weekday_last operator[](last_spec) const noexcept;
658
+ };
659
+ }
660
+ ```
661
+
662
+ `weekday` represents a day of the week in the civil calendar. It
663
+ normally holds values in the range `0` to `6`, corresponding to Sunday
664
+ through Saturday, but it may hold non-negative values outside this
665
+ range. It can be constructed with any `unsigned` value, which will be
666
+ subsequently truncated to fit into `weekday`’s unspecified internal
667
+ storage. `weekday` meets the *Cpp17EqualityComparable* (
668
+ [[cpp17.equalitycomparable]]) requirements.
669
+
670
+ [*Note 1*: `weekday` is not *Cpp17LessThanComparable* because there is
671
+ no universal consensus on which day is the first day of the week.
672
+ `weekday`’s arithmetic operations treat the days of the week as a
673
+ circular range, with no beginning and no end. — *end note*]
674
+
675
+ `weekday` is a trivially copyable and standard-layout class type.
676
+
677
+ #### Member functions <a id="time.cal.wd.members">[[time.cal.wd.members]]</a>
678
+
679
+ ``` cpp
680
+ constexpr explicit weekday(unsigned wd) noexcept;
681
+ ```
682
+
683
+ *Effects:* Initializes `wd_` with `wd == 7 ? 0 : wd`. The value held is
684
+ unspecified if `wd` is not in the range \[`0`, `255`\].
685
+
686
+ ``` cpp
687
+ constexpr weekday(const sys_days& dp) noexcept;
688
+ ```
689
+
690
+ *Effects:* Computes what day of the week corresponds to the `sys_days`
691
+ `dp`, and initializes that day of the week in `wd_`.
692
+
693
+ [*Example 1*: If `dp` represents 1970-01-01, the constructed `weekday`
694
+ represents Thursday by storing `4` in `wd_`. — *end example*]
695
+
696
+ ``` cpp
697
+ constexpr explicit weekday(const local_days& dp) noexcept;
698
+ ```
699
+
700
+ *Effects:* Computes what day of the week corresponds to the `local_days`
701
+ `dp`, and initializes that day of the week in `wd_`.
702
+
703
+ *Ensures:* The value is identical to that constructed from
704
+ `sys_days{dp.time_since_epoch()}`.
705
+
706
+ ``` cpp
707
+ constexpr weekday& operator++() noexcept;
708
+ ```
709
+
710
+ *Effects:* `*this += days{1}`.
711
+
712
+ *Returns:* `*this`.
713
+
714
+ ``` cpp
715
+ constexpr weekday operator++(int) noexcept;
716
+ ```
717
+
718
+ *Effects:* `++(*this)`.
719
+
720
+ *Returns:* A copy of `*this` as it existed on entry to this member
721
+ function.
722
+
723
+ ``` cpp
724
+ constexpr weekday& operator--() noexcept;
725
+ ```
726
+
727
+ *Effects:* `*this -= days{1}`.
728
+
729
+ *Returns:* `*this`.
730
+
731
+ ``` cpp
732
+ constexpr weekday operator--(int) noexcept;
733
+ ```
734
+
735
+ *Effects:* `–(*this)`.
736
+
737
+ *Returns:* A copy of `*this` as it existed on entry to this member
738
+ function.
739
+
740
+ ``` cpp
741
+ constexpr weekday& operator+=(const days& d) noexcept;
742
+ ```
743
+
744
+ *Effects:* `*this = *this + d`.
745
+
746
+ *Returns:* `*this`.
747
+
748
+ ``` cpp
749
+ constexpr weekday& operator-=(const days& d) noexcept;
750
+ ```
751
+
752
+ *Effects:* `*this = *this - d`.
753
+
754
+ *Returns:* `*this`.
755
+
756
+ ``` cpp
757
+ constexpr unsigned c_encoding() const noexcept;
758
+ ```
759
+
760
+ *Returns:* `wd_`.
761
+
762
+ ``` cpp
763
+ constexpr unsigned iso_encoding() const noexcept;
764
+ ```
765
+
766
+ *Returns:* `wd_ == 0u ? 7u : wd_`.
767
+
768
+ ``` cpp
769
+ constexpr bool ok() const noexcept;
770
+ ```
771
+
772
+ *Returns:* `wd_ <= 6`.
773
+
774
+ ``` cpp
775
+ constexpr weekday_indexed operator[](unsigned index) const noexcept;
776
+ ```
777
+
778
+ *Returns:* `{*this, index}`.
779
+
780
+ ``` cpp
781
+ constexpr weekday_last operator[](last_spec) const noexcept;
782
+ ```
783
+
784
+ *Returns:* `weekday_last{*this}`.
785
+
786
+ #### Non-member functions <a id="time.cal.wd.nonmembers">[[time.cal.wd.nonmembers]]</a>
787
+
788
+ ``` cpp
789
+ constexpr bool operator==(const weekday& x, const weekday& y) noexcept;
790
+ ```
791
+
792
+ *Returns:* `x.wd_ == y.wd_`.
793
+
794
+ ``` cpp
795
+ constexpr weekday operator+(const weekday& x, const days& y) noexcept;
796
+ ```
797
+
798
+ *Returns:*
799
+
800
+ ``` cpp
801
+ weekday{modulo(static_cast<long long>(x.wd_) + y.count(), 7)}
802
+ ```
803
+
804
+ where `modulo(n, 7)` computes the remainder of `n` divided by 7 using
805
+ Euclidean division.
806
+
807
+ [*Note 1*: Given a divisor of 7, Euclidean division truncates towards
808
+ negative infinity and always produces a remainder in the range of \[`0`,
809
+ `6`\]. Assuming no overflow in the signed summation, this operation
810
+ results in a `weekday` holding a value in the range \[`0`, `6`\] even if
811
+ `!x.ok()`. — *end note*]
812
+
813
+ [*Example 1*: `Monday + days{6} == Sunday`. — *end example*]
814
+
815
+ ``` cpp
816
+ constexpr weekday operator+(const days& x, const weekday& y) noexcept;
817
+ ```
818
+
819
+ *Returns:* `y + x`.
820
+
821
+ ``` cpp
822
+ constexpr weekday operator-(const weekday& x, const days& y) noexcept;
823
+ ```
824
+
825
+ *Returns:* `x + -y`.
826
+
827
+ ``` cpp
828
+ constexpr days operator-(const weekday& x, const weekday& y) noexcept;
829
+ ```
830
+
831
+ *Returns:* If `x.ok() == true` and `y.ok() == true`, returns a value `d`
832
+ in the range \[`days{0}`, `days{6}`\] satisfying `y + d == x`. Otherwise
833
+ the value returned is unspecified.
834
+
835
+ [*Example 2*: `Sunday - Monday == days{6}`. — *end example*]
836
+
837
+ ``` cpp
838
+ template<class charT, class traits>
839
+ basic_ostream<charT, traits>&
840
+ operator<<(basic_ostream<charT, traits>& os, const weekday& wd);
841
+ ```
842
+
843
+ *Effects:* Equivalent to:
844
+
845
+ ``` cpp
846
+ return os << (wd.ok() ?
847
+ format(os.getloc(), STATICALLY-WIDEN<charT>("{:%a}"), wd) :
848
+ format(os.getloc(), STATICALLY-WIDEN<charT>("{} is not a valid weekday"),
849
+ static_cast<unsigned>(wd.wd_)));
850
+ ```
851
+
852
+ ``` cpp
853
+ template<class charT, class traits, class Alloc = allocator<charT>>
854
+ basic_istream<charT, traits>&
855
+ from_stream(basic_istream<charT, traits>& is, const charT* fmt,
856
+ weekday& wd, basic_string<charT, traits, Alloc>* abbrev = nullptr,
857
+ minutes* offset = nullptr);
858
+ ```
859
+
860
+ *Effects:* Attempts to parse the input stream `is` into the `weekday`
861
+ `wd` using the format flags given in the NTCTS `fmt` as specified in
862
+ [[time.parse]]. If the parse fails to decode a valid weekday,
863
+ `is.setstate(ios_base::failbit)` is called and `wd` is not modified. If
864
+ `%Z` is used and successfully parsed, that value will be assigned to
865
+ `*abbrev` if `abbrev` is non-null. If `%z` (or a modified variant) is
866
+ used and successfully parsed, that value will be assigned to `*offset`
867
+ if `offset` is non-null.
868
+
869
+ *Returns:* `is`.
870
+
871
+ ### Class `weekday_indexed` <a id="time.cal.wdidx">[[time.cal.wdidx]]</a>
872
+
873
+ #### Overview <a id="time.cal.wdidx.overview">[[time.cal.wdidx.overview]]</a>
874
+
875
+ ``` cpp
876
+ namespace std::chrono {
877
+ class weekday_indexed {
878
+ chrono::weekday wd_; // exposition only
879
+ unsigned char index_; // exposition only
880
+
881
+ public:
882
+ weekday_indexed() = default;
883
+ constexpr weekday_indexed(const chrono::weekday& wd, unsigned index) noexcept;
884
+
885
+ constexpr chrono::weekday weekday() const noexcept;
886
+ constexpr unsigned index() const noexcept;
887
+ constexpr bool ok() const noexcept;
888
+ };
889
+ }
890
+ ```
891
+
892
+ `weekday_indexed` represents a `weekday` and a small index in the range
893
+ 1 to 5. This class is used to represent the first, second, third,
894
+ fourth, or fifth weekday of a month.
895
+
896
+ [*Note 1*: A `weekday_indexed` object can be constructed by indexing a
897
+ `weekday` with an `unsigned`. — *end note*]
898
+
899
+ [*Example 1*:
900
+
901
+ ``` cpp
902
+ constexpr auto wdi = Sunday[2]; // wdi is the second Sunday of an as yet unspecified month
903
+ static_assert(wdi.weekday() == Sunday);
904
+ static_assert(wdi.index() == 2);
905
+ ```
906
+
907
+ — *end example*]
908
+
909
+ `weekday_indexed` is a trivially copyable and standard-layout class
910
+ type.
911
+
912
+ #### Member functions <a id="time.cal.wdidx.members">[[time.cal.wdidx.members]]</a>
913
+
914
+ ``` cpp
915
+ constexpr weekday_indexed(const chrono::weekday& wd, unsigned index) noexcept;
916
+ ```
917
+
918
+ *Effects:* Initializes `wd_` with `wd` and `index_` with `index`. The
919
+ values held are unspecified if `!wd.ok()` or `index` is not in the range
920
+ \[`0`, `7`\].
921
+
922
+ ``` cpp
923
+ constexpr chrono::weekday weekday() const noexcept;
924
+ ```
925
+
926
+ *Returns:* `wd_`.
927
+
928
+ ``` cpp
929
+ constexpr unsigned index() const noexcept;
930
+ ```
931
+
932
+ *Returns:* `index_`.
933
+
934
+ ``` cpp
935
+ constexpr bool ok() const noexcept;
936
+ ```
937
+
938
+ *Returns:* `wd_.ok() && 1 <= index_ && index_ <= 5`.
939
+
940
+ #### Non-member functions <a id="time.cal.wdidx.nonmembers">[[time.cal.wdidx.nonmembers]]</a>
941
+
942
+ ``` cpp
943
+ constexpr bool operator==(const weekday_indexed& x, const weekday_indexed& y) noexcept;
944
+ ```
945
+
946
+ *Returns:* `x.weekday() == y.weekday() && x.index() == y.index()`.
947
+
948
+ ``` cpp
949
+ template<class charT, class traits>
950
+ basic_ostream<charT, traits>&
951
+ operator<<(basic_ostream<charT, traits>& os, const weekday_indexed& wdi);
952
+ ```
953
+
954
+ *Effects:* Equivalent to:
955
+
956
+ ``` cpp
957
+ auto i = wdi.index();
958
+ return os << (i >= 1 && i <= 5 ?
959
+ format(os.getloc(), STATICALLY-WIDEN<charT>("{}[{}]"), wdi.weekday(), i) :
960
+ format(os.getloc(), STATICALLY-WIDEN<charT>("{}[{} is not a valid index]"),
961
+ wdi.weekday(), i));
962
+ ```
963
+
964
+ ### Class `weekday_last` <a id="time.cal.wdlast">[[time.cal.wdlast]]</a>
965
+
966
+ #### Overview <a id="time.cal.wdlast.overview">[[time.cal.wdlast.overview]]</a>
967
+
968
+ ``` cpp
969
+ namespace std::chrono {
970
+ class weekday_last {
971
+ chrono::weekday wd_; // exposition only
972
+
973
+ public:
974
+ constexpr explicit weekday_last(const chrono::weekday& wd) noexcept;
975
+
976
+ constexpr chrono::weekday weekday() const noexcept;
977
+ constexpr bool ok() const noexcept;
978
+ };
979
+ }
980
+ ```
981
+
982
+ `weekday_last` represents the last weekday of a month.
983
+
984
+ [*Note 1*: A `weekday_last` object can be constructed by indexing a
985
+ `weekday` with `last`. — *end note*]
986
+
987
+ [*Example 1*:
988
+
989
+ ``` cpp
990
+ constexpr auto wdl = Sunday[last]; // wdl is the last Sunday of an as yet unspecified month
991
+ static_assert(wdl.weekday() == Sunday);
992
+ ```
993
+
994
+ — *end example*]
995
+
996
+ `weekday_last` is a trivially copyable and standard-layout class type.
997
+
998
+ #### Member functions <a id="time.cal.wdlast.members">[[time.cal.wdlast.members]]</a>
999
+
1000
+ ``` cpp
1001
+ constexpr explicit weekday_last(const chrono::weekday& wd) noexcept;
1002
+ ```
1003
+
1004
+ *Effects:* Initializes `wd_` with `wd`.
1005
+
1006
+ ``` cpp
1007
+ constexpr chrono::weekday weekday() const noexcept;
1008
+ ```
1009
+
1010
+ *Returns:* `wd_`.
1011
+
1012
+ ``` cpp
1013
+ constexpr bool ok() const noexcept;
1014
+ ```
1015
+
1016
+ *Returns:* `wd_.ok()`.
1017
+
1018
+ #### Non-member functions <a id="time.cal.wdlast.nonmembers">[[time.cal.wdlast.nonmembers]]</a>
1019
+
1020
+ ``` cpp
1021
+ constexpr bool operator==(const weekday_last& x, const weekday_last& y) noexcept;
1022
+ ```
1023
+
1024
+ *Returns:* `x.weekday() == y.weekday()`.
1025
+
1026
+ ``` cpp
1027
+ template<class charT, class traits>
1028
+ basic_ostream<charT, traits>&
1029
+ operator<<(basic_ostream<charT, traits>& os, const weekday_last& wdl);
1030
+ ```
1031
+
1032
+ *Effects:* Equivalent to:
1033
+
1034
+ ``` cpp
1035
+ return os << format(os.getloc(), STATICALLY-WIDEN<charT>("{}[last]"), wdl.weekday());
1036
+ ```
1037
+
1038
+ ### Class `month_day` <a id="time.cal.md">[[time.cal.md]]</a>
1039
+
1040
+ #### Overview <a id="time.cal.md.overview">[[time.cal.md.overview]]</a>
1041
+
1042
+ ``` cpp
1043
+ namespace std::chrono {
1044
+ class month_day {
1045
+ chrono::month m_; // exposition only
1046
+ chrono::day d_; // exposition only
1047
+
1048
+ public:
1049
+ month_day() = default;
1050
+ constexpr month_day(const chrono::month& m, const chrono::day& d) noexcept;
1051
+
1052
+ constexpr chrono::month month() const noexcept;
1053
+ constexpr chrono::day day() const noexcept;
1054
+ constexpr bool ok() const noexcept;
1055
+ };
1056
+ }
1057
+ ```
1058
+
1059
+ `month_day` represents a specific day of a specific month, but with an
1060
+ unspecified year. `month_day` meets the *Cpp17EqualityComparable* (
1061
+ [[cpp17.equalitycomparable]]) and *Cpp17LessThanComparable* (
1062
+ [[cpp17.lessthancomparable]]) requirements.
1063
+
1064
+ `month_day` is a trivially copyable and standard-layout class type.
1065
+
1066
+ #### Member functions <a id="time.cal.md.members">[[time.cal.md.members]]</a>
1067
+
1068
+ ``` cpp
1069
+ constexpr month_day(const chrono::month& m, const chrono::day& d) noexcept;
1070
+ ```
1071
+
1072
+ *Effects:* Initializes `m_` with `m`, and `d_` with `d`.
1073
+
1074
+ ``` cpp
1075
+ constexpr chrono::month month() const noexcept;
1076
+ ```
1077
+
1078
+ *Returns:* `m_`.
1079
+
1080
+ ``` cpp
1081
+ constexpr chrono::day day() const noexcept;
1082
+ ```
1083
+
1084
+ *Returns:* `d_`.
1085
+
1086
+ ``` cpp
1087
+ constexpr bool ok() const noexcept;
1088
+ ```
1089
+
1090
+ *Returns:* `true` if `m_.ok()` is `true`, `1d <= d_`, and `d_` is less
1091
+ than or equal to the number of days in month `m_`; otherwise returns
1092
+ `false`. When `m_ == February`, the number of days is considered to be
1093
+ 29.
1094
+
1095
+ #### Non-member functions <a id="time.cal.md.nonmembers">[[time.cal.md.nonmembers]]</a>
1096
+
1097
+ ``` cpp
1098
+ constexpr bool operator==(const month_day& x, const month_day& y) noexcept;
1099
+ ```
1100
+
1101
+ *Returns:* `x.month() == y.month() && x.day() == y.day()`.
1102
+
1103
+ ``` cpp
1104
+ constexpr strong_ordering operator<=>(const month_day& x, const month_day& y) noexcept;
1105
+ ```
1106
+
1107
+ *Effects:* Equivalent to:
1108
+
1109
+ ``` cpp
1110
+ if (auto c = x.month() <=> y.month(); c != 0) return c;
1111
+ return x.day() <=> y.day();
1112
+ ```
1113
+
1114
+ ``` cpp
1115
+ template<class charT, class traits>
1116
+ basic_ostream<charT, traits>&
1117
+ operator<<(basic_ostream<charT, traits>& os, const month_day& md);
1118
+ ```
1119
+
1120
+ *Effects:* Equivalent to:
1121
+
1122
+ ``` cpp
1123
+ return os << format(os.getloc(), STATICALLY-WIDEN<charT>("{}/{}"),
1124
+ md.month(), md.day());
1125
+ ```
1126
+
1127
+ ``` cpp
1128
+ template<class charT, class traits, class Alloc = allocator<charT>>
1129
+ basic_istream<charT, traits>&
1130
+ from_stream(basic_istream<charT, traits>& is, const charT* fmt,
1131
+ month_day& md, basic_string<charT, traits, Alloc>* abbrev = nullptr,
1132
+ minutes* offset = nullptr);
1133
+ ```
1134
+
1135
+ *Effects:* Attempts to parse the input stream `is` into the `month_day`
1136
+ `md` using the format flags given in the NTCTS `fmt` as specified in
1137
+ [[time.parse]]. If the parse fails to decode a valid `month_day`,
1138
+ `is.setstate(ios_base::failbit)` is called and `md` is not modified. If
1139
+ `%Z` is used and successfully parsed, that value will be assigned to
1140
+ `*abbrev` if `abbrev` is non-null. If `%z` (or a modified variant) is
1141
+ used and successfully parsed, that value will be assigned to `*offset`
1142
+ if `offset` is non-null.
1143
+
1144
+ *Returns:* `is`.
1145
+
1146
+ ### Class `month_day_last` <a id="time.cal.mdlast">[[time.cal.mdlast]]</a>
1147
+
1148
+ ``` cpp
1149
+ namespace std::chrono {
1150
+ class month_day_last {
1151
+ chrono::month m_; // exposition only
1152
+
1153
+ public:
1154
+ constexpr explicit month_day_last(const chrono::month& m) noexcept;
1155
+
1156
+ constexpr chrono::month month() const noexcept;
1157
+ constexpr bool ok() const noexcept;
1158
+ };
1159
+ }
1160
+ ```
1161
+
1162
+ `month_day_last` represents the last day of a month.
1163
+
1164
+ [*Note 1*: A `month_day_last` object can be constructed using the
1165
+ expression `m/last` or `last/m`, where `m` is an expression of type
1166
+ `month`. — *end note*]
1167
+
1168
+ [*Example 1*:
1169
+
1170
+ ``` cpp
1171
+ constexpr auto mdl = February/last; // mdl is the last day of February of an as yet unspecified year
1172
+ static_assert(mdl.month() == February);
1173
+ ```
1174
+
1175
+ — *end example*]
1176
+
1177
+ `month_day_last` is a trivially copyable and standard-layout class type.
1178
+
1179
+ ``` cpp
1180
+ constexpr explicit month_day_last(const chrono::month& m) noexcept;
1181
+ ```
1182
+
1183
+ *Effects:* Initializes `m_` with `m`.
1184
+
1185
+ ``` cpp
1186
+ constexpr month month() const noexcept;
1187
+ ```
1188
+
1189
+ *Returns:* `m_`.
1190
+
1191
+ ``` cpp
1192
+ constexpr bool ok() const noexcept;
1193
+ ```
1194
+
1195
+ *Returns:* `m_.ok()`.
1196
+
1197
+ ``` cpp
1198
+ constexpr bool operator==(const month_day_last& x, const month_day_last& y) noexcept;
1199
+ ```
1200
+
1201
+ *Returns:* `x.month() == y.month()`.
1202
+
1203
+ ``` cpp
1204
+ constexpr strong_ordering operator<=>(const month_day_last& x, const month_day_last& y) noexcept;
1205
+ ```
1206
+
1207
+ *Returns:* `x.month() <=> y.month()`.
1208
+
1209
+ ``` cpp
1210
+ template<class charT, class traits>
1211
+ basic_ostream<charT, traits>&
1212
+ operator<<(basic_ostream<charT, traits>& os, const month_day_last& mdl);
1213
+ ```
1214
+
1215
+ *Effects:* Equivalent to:
1216
+
1217
+ ``` cpp
1218
+ return os << format(os.getloc(), STATICALLY-WIDEN<charT>("{}/last"), mdl.month());
1219
+ ```
1220
+
1221
+ ### Class `month_weekday` <a id="time.cal.mwd">[[time.cal.mwd]]</a>
1222
+
1223
+ #### Overview <a id="time.cal.mwd.overview">[[time.cal.mwd.overview]]</a>
1224
+
1225
+ ``` cpp
1226
+ namespace std::chrono {
1227
+ class month_weekday {
1228
+ chrono::month m_; // exposition only
1229
+ chrono::weekday_indexed wdi_; // exposition only
1230
+ public:
1231
+ constexpr month_weekday(const chrono::month& m, const chrono::weekday_indexed& wdi) noexcept;
1232
+
1233
+ constexpr chrono::month month() const noexcept;
1234
+ constexpr chrono::weekday_indexed weekday_indexed() const noexcept;
1235
+ constexpr bool ok() const noexcept;
1236
+ };
1237
+ }
1238
+ ```
1239
+
1240
+ `month_weekday` represents the nᵗʰ weekday of a month, of an as yet
1241
+ unspecified year. To do this the `month_weekday` stores a `month` and a
1242
+ `weekday_indexed`.
1243
+
1244
+ [*Example 1*:
1245
+
1246
+ ``` cpp
1247
+ constexpr auto mwd
1248
+ = February/Tuesday[3]; // mwd is the third Tuesday of February of an as yet unspecified year
1249
+ static_assert(mwd.month() == February);
1250
+ static_assert(mwd.weekday_indexed() == Tuesday[3]);
1251
+ ```
1252
+
1253
+ — *end example*]
1254
+
1255
+ `month_weekday` is a trivially copyable and standard-layout class type.
1256
+
1257
+ #### Member functions <a id="time.cal.mwd.members">[[time.cal.mwd.members]]</a>
1258
+
1259
+ ``` cpp
1260
+ constexpr month_weekday(const chrono::month& m, const chrono::weekday_indexed& wdi) noexcept;
1261
+ ```
1262
+
1263
+ *Effects:* Initializes `m_` with `m`, and `wdi_` with `wdi`.
1264
+
1265
+ ``` cpp
1266
+ constexpr chrono::month month() const noexcept;
1267
+ ```
1268
+
1269
+ *Returns:* `m_`.
1270
+
1271
+ ``` cpp
1272
+ constexpr chrono::weekday_indexed weekday_indexed() const noexcept;
1273
+ ```
1274
+
1275
+ *Returns:* `wdi_`.
1276
+
1277
+ ``` cpp
1278
+ constexpr bool ok() const noexcept;
1279
+ ```
1280
+
1281
+ *Returns:* `m_.ok() && wdi_.ok()`.
1282
+
1283
+ #### Non-member functions <a id="time.cal.mwd.nonmembers">[[time.cal.mwd.nonmembers]]</a>
1284
+
1285
+ ``` cpp
1286
+ constexpr bool operator==(const month_weekday& x, const month_weekday& y) noexcept;
1287
+ ```
1288
+
1289
+ *Returns:*
1290
+ `x.month() == y.month() && x.weekday_indexed() == y.weekday_indexed()`.
1291
+
1292
+ ``` cpp
1293
+ template<class charT, class traits>
1294
+ basic_ostream<charT, traits>&
1295
+ operator<<(basic_ostream<charT, traits>& os, const month_weekday& mwd);
1296
+ ```
1297
+
1298
+ *Effects:* Equivalent to:
1299
+
1300
+ ``` cpp
1301
+ return os << format(os.getloc(), STATICALLY-WIDEN<charT>("{}/{}"),
1302
+ mwd.month(), mwd.weekday_indexed());
1303
+ ```
1304
+
1305
+ ### Class `month_weekday_last` <a id="time.cal.mwdlast">[[time.cal.mwdlast]]</a>
1306
+
1307
+ #### Overview <a id="time.cal.mwdlast.overview">[[time.cal.mwdlast.overview]]</a>
1308
+
1309
+ ``` cpp
1310
+ namespace std::chrono {
1311
+ class month_weekday_last {
1312
+ chrono::month m_; // exposition only
1313
+ chrono::weekday_last wdl_; // exposition only
1314
+ public:
1315
+ constexpr month_weekday_last(const chrono::month& m,
1316
+ const chrono::weekday_last& wdl) noexcept;
1317
+
1318
+ constexpr chrono::month month() const noexcept;
1319
+ constexpr chrono::weekday_last weekday_last() const noexcept;
1320
+ constexpr bool ok() const noexcept;
1321
+ };
1322
+ }
1323
+ ```
1324
+
1325
+ `month_weekday_last` represents the last weekday of a month, of an as
1326
+ yet unspecified year. To do this the `month_weekday_last` stores a
1327
+ `month` and a `weekday_last`.
1328
+
1329
+ [*Example 1*:
1330
+
1331
+ ``` cpp
1332
+ constexpr auto mwd
1333
+ = February/Tuesday[last]; // mwd is the last Tuesday of February of an as yet unspecified year
1334
+ static_assert(mwd.month() == February);
1335
+ static_assert(mwd.weekday_last() == Tuesday[last]);
1336
+ ```
1337
+
1338
+ — *end example*]
1339
+
1340
+ `month_weekday_last` is a trivially copyable and standard-layout class
1341
+ type.
1342
+
1343
+ #### Member functions <a id="time.cal.mwdlast.members">[[time.cal.mwdlast.members]]</a>
1344
+
1345
+ ``` cpp
1346
+ constexpr month_weekday_last(const chrono::month& m,
1347
+ const chrono::weekday_last& wdl) noexcept;
1348
+ ```
1349
+
1350
+ *Effects:* Initializes `m_` with `m`, and `wdl_` with `wdl`.
1351
+
1352
+ ``` cpp
1353
+ constexpr chrono::month month() const noexcept;
1354
+ ```
1355
+
1356
+ *Returns:* `m_`.
1357
+
1358
+ ``` cpp
1359
+ constexpr chrono::weekday_last weekday_last() const noexcept;
1360
+ ```
1361
+
1362
+ *Returns:* `wdl_`.
1363
+
1364
+ ``` cpp
1365
+ constexpr bool ok() const noexcept;
1366
+ ```
1367
+
1368
+ *Returns:* `m_.ok() && wdl_.ok()`.
1369
+
1370
+ #### Non-member functions <a id="time.cal.mwdlast.nonmembers">[[time.cal.mwdlast.nonmembers]]</a>
1371
+
1372
+ ``` cpp
1373
+ constexpr bool operator==(const month_weekday_last& x, const month_weekday_last& y) noexcept;
1374
+ ```
1375
+
1376
+ *Returns:*
1377
+ `x.month() == y.month() && x.weekday_last() == y.weekday_last()`.
1378
+
1379
+ ``` cpp
1380
+ template<class charT, class traits>
1381
+ basic_ostream<charT, traits>&
1382
+ operator<<(basic_ostream<charT, traits>& os, const month_weekday_last& mwdl);
1383
+ ```
1384
+
1385
+ *Effects:* Equivalent to:
1386
+
1387
+ ``` cpp
1388
+ return os << format(os.getloc(), STATICALLY-WIDEN<charT>("{}/{}"),
1389
+ mwdl.month(), mwdl.weekday_last());
1390
+ ```
1391
+
1392
+ ### Class `year_month` <a id="time.cal.ym">[[time.cal.ym]]</a>
1393
+
1394
+ #### Overview <a id="time.cal.ym.overview">[[time.cal.ym.overview]]</a>
1395
+
1396
+ ``` cpp
1397
+ namespace std::chrono {
1398
+ class year_month {
1399
+ chrono::year y_; // exposition only
1400
+ chrono::month m_; // exposition only
1401
+
1402
+ public:
1403
+ year_month() = default;
1404
+ constexpr year_month(const chrono::year& y, const chrono::month& m) noexcept;
1405
+
1406
+ constexpr chrono::year year() const noexcept;
1407
+ constexpr chrono::month month() const noexcept;
1408
+
1409
+ constexpr year_month& operator+=(const months& dm) noexcept;
1410
+ constexpr year_month& operator-=(const months& dm) noexcept;
1411
+ constexpr year_month& operator+=(const years& dy) noexcept;
1412
+ constexpr year_month& operator-=(const years& dy) noexcept;
1413
+
1414
+ constexpr bool ok() const noexcept;
1415
+ };
1416
+ }
1417
+ ```
1418
+
1419
+ `year_month` represents a specific month of a specific year, but with an
1420
+ unspecified day. `year_month` is a field-based time point with a
1421
+ resolution of `months`. `year_month` meets the *Cpp17EqualityComparable*
1422
+ ([[cpp17.equalitycomparable]]) and *Cpp17LessThanComparable* (
1423
+ [[cpp17.lessthancomparable]]) requirements.
1424
+
1425
+ `year_month` is a trivially copyable and standard-layout class type.
1426
+
1427
+ #### Member functions <a id="time.cal.ym.members">[[time.cal.ym.members]]</a>
1428
+
1429
+ ``` cpp
1430
+ constexpr year_month(const chrono::year& y, const chrono::month& m) noexcept;
1431
+ ```
1432
+
1433
+ *Effects:* Initializes `y_` with `y`, and `m_` with `m`.
1434
+
1435
+ ``` cpp
1436
+ constexpr chrono::year year() const noexcept;
1437
+ ```
1438
+
1439
+ *Returns:* `y_`.
1440
+
1441
+ ``` cpp
1442
+ constexpr chrono::month month() const noexcept;
1443
+ ```
1444
+
1445
+ *Returns:* `m_`.
1446
+
1447
+ ``` cpp
1448
+ constexpr year_month& operator+=(const months& dm) noexcept;
1449
+ ```
1450
+
1451
+ *Constraints:* If the argument supplied by the caller for the `months`
1452
+ parameter is convertible to `years`, its implicit conversion sequence to
1453
+ `years` is worse than its implicit conversion sequence to `months`
1454
+ [[over.ics.rank]].
1455
+
1456
+ *Effects:* `*this = *this + dm`.
1457
+
1458
+ *Returns:* `*this`.
1459
+
1460
+ ``` cpp
1461
+ constexpr year_month& operator-=(const months& dm) noexcept;
1462
+ ```
1463
+
1464
+ *Constraints:* If the argument supplied by the caller for the `months`
1465
+ parameter is convertible to `years`, its implicit conversion sequence to
1466
+ `years` is worse than its implicit conversion sequence to `months`
1467
+ [[over.ics.rank]].
1468
+
1469
+ *Effects:* `*this = *this - dm`.
1470
+
1471
+ *Returns:* `*this`.
1472
+
1473
+ ``` cpp
1474
+ constexpr year_month& operator+=(const years& dy) noexcept;
1475
+ ```
1476
+
1477
+ *Effects:* `*this = *this + dy`.
1478
+
1479
+ *Returns:* `*this`.
1480
+
1481
+ ``` cpp
1482
+ constexpr year_month& operator-=(const years& dy) noexcept;
1483
+ ```
1484
+
1485
+ *Effects:* `*this = *this - dy`.
1486
+
1487
+ *Returns:* `*this`.
1488
+
1489
+ ``` cpp
1490
+ constexpr bool ok() const noexcept;
1491
+ ```
1492
+
1493
+ *Returns:* `y_.ok() && m_.ok()`.
1494
+
1495
+ #### Non-member functions <a id="time.cal.ym.nonmembers">[[time.cal.ym.nonmembers]]</a>
1496
+
1497
+ ``` cpp
1498
+ constexpr bool operator==(const year_month& x, const year_month& y) noexcept;
1499
+ ```
1500
+
1501
+ *Returns:* `x.year() == y.year() && x.month() == y.month()`.
1502
+
1503
+ ``` cpp
1504
+ constexpr strong_ordering operator<=>(const year_month& x, const year_month& y) noexcept;
1505
+ ```
1506
+
1507
+ *Effects:* Equivalent to:
1508
+
1509
+ ``` cpp
1510
+ if (auto c = x.year() <=> y.year(); c != 0) return c;
1511
+ return x.month() <=> y.month();
1512
+ ```
1513
+
1514
+ ``` cpp
1515
+ constexpr year_month operator+(const year_month& ym, const months& dm) noexcept;
1516
+ ```
1517
+
1518
+ *Constraints:* If the argument supplied by the caller for the `months`
1519
+ parameter is convertible to `years`, its implicit conversion sequence to
1520
+ `years` is worse than its implicit conversion sequence to `months`
1521
+ [[over.ics.rank]].
1522
+
1523
+ *Returns:* A `year_month` value `z` such that `z.ok() && z - ym == dm`
1524
+ is `true`.
1525
+
1526
+ *Complexity:* 𝑂(1) with respect to the value of `dm`.
1527
+
1528
+ ``` cpp
1529
+ constexpr year_month operator+(const months& dm, const year_month& ym) noexcept;
1530
+ ```
1531
+
1532
+ *Constraints:* If the argument supplied by the caller for the `months`
1533
+ parameter is convertible to `years`, its implicit conversion sequence to
1534
+ `years` is worse than its implicit conversion sequence to `months`
1535
+ [[over.ics.rank]].
1536
+
1537
+ *Returns:* `ym + dm`.
1538
+
1539
+ ``` cpp
1540
+ constexpr year_month operator-(const year_month& ym, const months& dm) noexcept;
1541
+ ```
1542
+
1543
+ *Constraints:* If the argument supplied by the caller for the `months`
1544
+ parameter is convertible to `years`, its implicit conversion sequence to
1545
+ `years` is worse than its implicit conversion sequence to `months`
1546
+ [[over.ics.rank]].
1547
+
1548
+ *Returns:* `ym + -dm`.
1549
+
1550
+ ``` cpp
1551
+ constexpr months operator-(const year_month& x, const year_month& y) noexcept;
1552
+ ```
1553
+
1554
+ *Returns:*
1555
+
1556
+ ``` cpp
1557
+ x.year() - y.year() + months{static_cast<int>(unsigned{x.month()}) -
1558
+ static_cast<int>(unsigned{y.month()})}
1559
+ ```
1560
+
1561
+ ``` cpp
1562
+ constexpr year_month operator+(const year_month& ym, const years& dy) noexcept;
1563
+ ```
1564
+
1565
+ *Returns:* `(ym.year() + dy) / ym.month()`.
1566
+
1567
+ ``` cpp
1568
+ constexpr year_month operator+(const years& dy, const year_month& ym) noexcept;
1569
+ ```
1570
+
1571
+ *Returns:* `ym + dy`.
1572
+
1573
+ ``` cpp
1574
+ constexpr year_month operator-(const year_month& ym, const years& dy) noexcept;
1575
+ ```
1576
+
1577
+ *Returns:* `ym + -dy`.
1578
+
1579
+ ``` cpp
1580
+ template<class charT, class traits>
1581
+ basic_ostream<charT, traits>&
1582
+ operator<<(basic_ostream<charT, traits>& os, const year_month& ym);
1583
+ ```
1584
+
1585
+ *Effects:* Equivalent to:
1586
+
1587
+ ``` cpp
1588
+ return os << format(os.getloc(), STATICALLY-WIDEN<charT>("{}/{}"),
1589
+ ym.year(), ym.month());
1590
+ ```
1591
+
1592
+ ``` cpp
1593
+ template<class charT, class traits, class Alloc = allocator<charT>>
1594
+ basic_istream<charT, traits>&
1595
+ from_stream(basic_istream<charT, traits>& is, const charT* fmt,
1596
+ year_month& ym, basic_string<charT, traits, Alloc>* abbrev = nullptr,
1597
+ minutes* offset = nullptr);
1598
+ ```
1599
+
1600
+ *Effects:* Attempts to parse the input stream `is` into the `year_month`
1601
+ `ym` using the format flags given in the NTCTS `fmt` as specified in
1602
+ [[time.parse]]. If the parse fails to decode a valid `year_month`,
1603
+ `is.setstate(ios_base::failbit)` is called and `ym` is not modified. If
1604
+ `%Z` is used and successfully parsed, that value will be assigned to
1605
+ `*abbrev` if `abbrev` is non-null. If `%z` (or a modified variant) is
1606
+ used and successfully parsed, that value will be assigned to `*offset`
1607
+ if `offset` is non-null.
1608
+
1609
+ *Returns:* `is`.
1610
+
1611
+ ### Class `year_month_day` <a id="time.cal.ymd">[[time.cal.ymd]]</a>
1612
+
1613
+ #### Overview <a id="time.cal.ymd.overview">[[time.cal.ymd.overview]]</a>
1614
+
1615
+ ``` cpp
1616
+ namespace std::chrono {
1617
+ class year_month_day {
1618
+ chrono::year y_; // exposition only
1619
+ chrono::month m_; // exposition only
1620
+ chrono::day d_; // exposition only
1621
+
1622
+ public:
1623
+ year_month_day() = default;
1624
+ constexpr year_month_day(const chrono::year& y, const chrono::month& m,
1625
+ const chrono::day& d) noexcept;
1626
+ constexpr year_month_day(const year_month_day_last& ymdl) noexcept;
1627
+ constexpr year_month_day(const sys_days& dp) noexcept;
1628
+ constexpr explicit year_month_day(const local_days& dp) noexcept;
1629
+
1630
+ constexpr year_month_day& operator+=(const months& m) noexcept;
1631
+ constexpr year_month_day& operator-=(const months& m) noexcept;
1632
+ constexpr year_month_day& operator+=(const years& y) noexcept;
1633
+ constexpr year_month_day& operator-=(const years& y) noexcept;
1634
+
1635
+ constexpr chrono::year year() const noexcept;
1636
+ constexpr chrono::month month() const noexcept;
1637
+ constexpr chrono::day day() const noexcept;
1638
+
1639
+ constexpr operator sys_days() const noexcept;
1640
+ constexpr explicit operator local_days() const noexcept;
1641
+ constexpr bool ok() const noexcept;
1642
+ };
1643
+ }
1644
+ ```
1645
+
1646
+ `year_month_day` represents a specific year, month, and day.
1647
+ `year_month_day` is a field-based time point with a resolution of
1648
+ `days`.
1649
+
1650
+ [*Note 1*: `year_month_day` supports `years`- and `months`-oriented
1651
+ arithmetic, but not `days`-oriented arithmetic. For the latter, there is
1652
+ a conversion to `sys_days`, which efficiently supports `days`-oriented
1653
+ arithmetic. — *end note*]
1654
+
1655
+ `year_month_day` meets the *Cpp17EqualityComparable* (
1656
+ [[cpp17.equalitycomparable]]) and *Cpp17LessThanComparable* (
1657
+ [[cpp17.lessthancomparable]]) requirements.
1658
+
1659
+ `year_month_day` is a trivially copyable and standard-layout class type.
1660
+
1661
+ #### Member functions <a id="time.cal.ymd.members">[[time.cal.ymd.members]]</a>
1662
+
1663
+ ``` cpp
1664
+ constexpr year_month_day(const chrono::year& y, const chrono::month& m,
1665
+ const chrono::day& d) noexcept;
1666
+ ```
1667
+
1668
+ *Effects:* Initializes `y_` with `y`, `m_` with `m`, and `d_` with `d`.
1669
+
1670
+ ``` cpp
1671
+ constexpr year_month_day(const year_month_day_last& ymdl) noexcept;
1672
+ ```
1673
+
1674
+ *Effects:* Initializes `y_` with `ymdl.year()`, `m_` with
1675
+ `ymdl.month()`, and `d_` with `ymdl.day()`.
1676
+
1677
+ [*Note 1*: This conversion from `year_month_day_last` to
1678
+ `year_month_day` may be more efficient than converting a
1679
+ `year_month_day_last` to a `sys_days`, and then converting that
1680
+ `sys_days` to a `year_month_day`. — *end note*]
1681
+
1682
+ ``` cpp
1683
+ constexpr year_month_day(const sys_days& dp) noexcept;
1684
+ ```
1685
+
1686
+ *Effects:* Constructs an object of type `year_month_day` that
1687
+ corresponds to the date represented by `dp`.
1688
+
1689
+ *Remarks:* For any value `ymd` of type `year_month_day` for which
1690
+ `ymd.ok()` is `true`, `ymd == year_month_day{sys_days{ymd}}` is `true`.
1691
+
1692
+ ``` cpp
1693
+ constexpr explicit year_month_day(const local_days& dp) noexcept;
1694
+ ```
1695
+
1696
+ *Effects:* Equivalent to constructing with
1697
+ `sys_days{dp.time_since_epoch()}`.
1698
+
1699
+ ``` cpp
1700
+ constexpr year_month_day& operator+=(const months& m) noexcept;
1701
+ ```
1702
+
1703
+ *Constraints:* If the argument supplied by the caller for the `months`
1704
+ parameter is convertible to `years`, its implicit conversion sequence to
1705
+ `years` is worse than its implicit conversion sequence to `months`
1706
+ [[over.ics.rank]].
1707
+
1708
+ *Effects:* `*this = *this + m`.
1709
+
1710
+ *Returns:* `*this`.
1711
+
1712
+ ``` cpp
1713
+ constexpr year_month_day& operator-=(const months& m) noexcept;
1714
+ ```
1715
+
1716
+ *Constraints:* If the argument supplied by the caller for the `months`
1717
+ parameter is convertible to `years`, its implicit conversion sequence to
1718
+ `years` is worse than its implicit conversion sequence to `months`
1719
+ [[over.ics.rank]].
1720
+
1721
+ *Effects:* `*this = *this - m`.
1722
+
1723
+ *Returns:* `*this`.
1724
+
1725
+ ``` cpp
1726
+ constexpr year_month_day& year_month_day::operator+=(const years& y) noexcept;
1727
+ ```
1728
+
1729
+ *Effects:* `*this = *this + y`.
1730
+
1731
+ *Returns:* `*this`.
1732
+
1733
+ ``` cpp
1734
+ constexpr year_month_day& year_month_day::operator-=(const years& y) noexcept;
1735
+ ```
1736
+
1737
+ *Effects:* `*this = *this - y`.
1738
+
1739
+ *Returns:* `*this`.
1740
+
1741
+ ``` cpp
1742
+ constexpr chrono::year year() const noexcept;
1743
+ ```
1744
+
1745
+ *Returns:* `y_`.
1746
+
1747
+ ``` cpp
1748
+ constexpr chrono::month month() const noexcept;
1749
+ ```
1750
+
1751
+ *Returns:* `m_`.
1752
+
1753
+ ``` cpp
1754
+ constexpr chrono::day day() const noexcept;
1755
+ ```
1756
+
1757
+ *Returns:* `d_`.
1758
+
1759
+ ``` cpp
1760
+ constexpr operator sys_days() const noexcept;
1761
+ ```
1762
+
1763
+ *Returns:* If `ok()`, returns a `sys_days` holding a count of days from
1764
+ the `sys_days` epoch to `*this` (a negative value if `*this` represents
1765
+ a date prior to the `sys_days` epoch). Otherwise, if
1766
+ `y_.ok() && m_.ok()` is `true`, returns
1767
+ `sys_days{y_/m_/1d} + (d_ - 1d)`. Otherwise the value returned is
1768
+ unspecified.
1769
+
1770
+ *Remarks:* A `sys_days` in the range \[`days{-12687428}`,
1771
+ `days{11248737}`\] which is converted to a `year_month_day` has the same
1772
+ value when converted back to a `sys_days`.
1773
+
1774
+ [*Example 1*:
1775
+
1776
+ ``` cpp
1777
+ static_assert(year_month_day{sys_days{2017y/January/0}} == 2016y/December/31);
1778
+ static_assert(year_month_day{sys_days{2017y/January/31}} == 2017y/January/31);
1779
+ static_assert(year_month_day{sys_days{2017y/January/32}} == 2017y/February/1);
1780
+ ```
1781
+
1782
+ — *end example*]
1783
+
1784
+ ``` cpp
1785
+ constexpr explicit operator local_days() const noexcept;
1786
+ ```
1787
+
1788
+ *Returns:* `local_days{sys_days{*this}.time_since_epoch()}`.
1789
+
1790
+ ``` cpp
1791
+ constexpr bool ok() const noexcept;
1792
+ ```
1793
+
1794
+ *Returns:* If `y_.ok()` is `true`, and `m_.ok()` is `true`, and `d_` is
1795
+ in the range \[`1d`, `(y_/m_/last).day()`\], then returns `true`;
1796
+ otherwise returns `false`.
1797
+
1798
+ #### Non-member functions <a id="time.cal.ymd.nonmembers">[[time.cal.ymd.nonmembers]]</a>
1799
+
1800
+ ``` cpp
1801
+ constexpr bool operator==(const year_month_day& x, const year_month_day& y) noexcept;
1802
+ ```
1803
+
1804
+ *Returns:*
1805
+ `x.year() == y.year() && x.month() == y.month() && x.day() == y.day()`.
1806
+
1807
+ ``` cpp
1808
+ constexpr strong_ordering operator<=>(const year_month_day& x, const year_month_day& y) noexcept;
1809
+ ```
1810
+
1811
+ *Effects:* Equivalent to:
1812
+
1813
+ ``` cpp
1814
+ if (auto c = x.year() <=> y.year(); c != 0) return c;
1815
+ if (auto c = x.month() <=> y.month(); c != 0) return c;
1816
+ return x.day() <=> y.day();
1817
+ ```
1818
+
1819
+ ``` cpp
1820
+ constexpr year_month_day operator+(const year_month_day& ymd, const months& dm) noexcept;
1821
+ ```
1822
+
1823
+ *Constraints:* If the argument supplied by the caller for the `months`
1824
+ parameter is convertible to `years`, its implicit conversion sequence to
1825
+ `years` is worse than its implicit conversion sequence to `months`
1826
+ [[over.ics.rank]].
1827
+
1828
+ *Returns:* `(ymd.year() / ymd.month() + dm) / ymd.day()`.
1829
+
1830
+ [*Note 1*: If `ymd.day()` is in the range \[`1d`, `28d`\], `ok()` will
1831
+ return `true` for the resultant `year_month_day`. — *end note*]
1832
+
1833
+ ``` cpp
1834
+ constexpr year_month_day operator+(const months& dm, const year_month_day& ymd) noexcept;
1835
+ ```
1836
+
1837
+ *Constraints:* If the argument supplied by the caller for the `months`
1838
+ parameter is convertible to `years`, its implicit conversion sequence to
1839
+ `years` is worse than its implicit conversion sequence to `months`
1840
+ [[over.ics.rank]].
1841
+
1842
+ *Returns:* `ymd + dm`.
1843
+
1844
+ ``` cpp
1845
+ constexpr year_month_day operator-(const year_month_day& ymd, const months& dm) noexcept;
1846
+ ```
1847
+
1848
+ *Constraints:* If the argument supplied by the caller for the `months`
1849
+ parameter is convertible to `years`, its implicit conversion sequence to
1850
+ `years` is worse than its implicit conversion sequence to `months`
1851
+ [[over.ics.rank]].
1852
+
1853
+ *Returns:* `ymd + (-dm)`.
1854
+
1855
+ ``` cpp
1856
+ constexpr year_month_day operator+(const year_month_day& ymd, const years& dy) noexcept;
1857
+ ```
1858
+
1859
+ *Returns:* `(ymd.year() + dy) / ymd.month() / ymd.day()`.
1860
+
1861
+ [*Note 2*: If `ymd.month()` is February and `ymd.day()` is not in the
1862
+ range \[`1d`, `28d`\], `ok()` may return `false` for the resultant
1863
+ `year_month_day`. — *end note*]
1864
+
1865
+ ``` cpp
1866
+ constexpr year_month_day operator+(const years& dy, const year_month_day& ymd) noexcept;
1867
+ ```
1868
+
1869
+ *Returns:* `ymd + dy`.
1870
+
1871
+ ``` cpp
1872
+ constexpr year_month_day operator-(const year_month_day& ymd, const years& dy) noexcept;
1873
+ ```
1874
+
1875
+ *Returns:* `ymd + (-dy)`.
1876
+
1877
+ ``` cpp
1878
+ template<class charT, class traits>
1879
+ basic_ostream<charT, traits>&
1880
+ operator<<(basic_ostream<charT, traits>& os, const year_month_day& ymd);
1881
+ ```
1882
+
1883
+ *Effects:* Equivalent to:
1884
+
1885
+ ``` cpp
1886
+ return os << (ymd.ok() ?
1887
+ format(STATICALLY-WIDEN<charT>("{:%F}"), ymd) :
1888
+ format(STATICALLY-WIDEN<charT>("{:%F} is not a valid date"), ymd));
1889
+ ```
1890
+
1891
+ ``` cpp
1892
+ template<class charT, class traits, class Alloc = allocator<charT>>
1893
+ basic_istream<charT, traits>&
1894
+ from_stream(basic_istream<charT, traits>& is, const charT* fmt,
1895
+ year_month_day& ymd, basic_string<charT, traits, Alloc>* abbrev = nullptr,
1896
+ minutes* offset = nullptr);
1897
+ ```
1898
+
1899
+ *Effects:* Attempts to parse the input stream `is` into the
1900
+ `year_month_day` `ymd` using the format flags given in the NTCTS `fmt`
1901
+ as specified in [[time.parse]]. If the parse fails to decode a valid
1902
+ `year_month_day`, `is.setstate(ios_base::failbit)` is called and `ymd`
1903
+ is not modified. If `%Z` is used and successfully parsed, that value
1904
+ will be assigned to `*abbrev` if `abbrev` is non-null. If `%z` (or a
1905
+ modified variant) is used and successfully parsed, that value will be
1906
+ assigned to `*offset` if `offset` is non-null.
1907
+
1908
+ *Returns:* `is`.
1909
+
1910
+ ### Class `year_month_day_last` <a id="time.cal.ymdlast">[[time.cal.ymdlast]]</a>
1911
+
1912
+ #### Overview <a id="time.cal.ymdlast.overview">[[time.cal.ymdlast.overview]]</a>
1913
+
1914
+ ``` cpp
1915
+ namespace std::chrono {
1916
+ class year_month_day_last {
1917
+ chrono::year y_; // exposition only
1918
+ chrono::month_day_last mdl_; // exposition only
1919
+
1920
+ public:
1921
+ constexpr year_month_day_last(const chrono::year& y,
1922
+ const chrono::month_day_last& mdl) noexcept;
1923
+
1924
+ constexpr year_month_day_last& operator+=(const months& m) noexcept;
1925
+ constexpr year_month_day_last& operator-=(const months& m) noexcept;
1926
+ constexpr year_month_day_last& operator+=(const years& y) noexcept;
1927
+ constexpr year_month_day_last& operator-=(const years& y) noexcept;
1928
+
1929
+ constexpr chrono::year year() const noexcept;
1930
+ constexpr chrono::month month() const noexcept;
1931
+ constexpr chrono::month_day_last month_day_last() const noexcept;
1932
+ constexpr chrono::day day() const noexcept;
1933
+
1934
+ constexpr operator sys_days() const noexcept;
1935
+ constexpr explicit operator local_days() const noexcept;
1936
+ constexpr bool ok() const noexcept;
1937
+ };
1938
+ }
1939
+ ```
1940
+
1941
+ `year_month_day_last` represents the last day of a specific year and
1942
+ month. `year_month_day_last` is a field-based time point with a
1943
+ resolution of `days`, except that it is restricted to pointing to the
1944
+ last day of a year and month.
1945
+
1946
+ [*Note 1*: `year_month_day_last` supports `years`- and
1947
+ `months`-oriented arithmetic, but not `days`-oriented arithmetic. For
1948
+ the latter, there is a conversion to `sys_days`, which efficiently
1949
+ supports `days`-oriented arithmetic. — *end note*]
1950
+
1951
+ `year_month_day_last` meets the *Cpp17EqualityComparable* (
1952
+ [[cpp17.equalitycomparable]]) and *Cpp17LessThanComparable* (
1953
+ [[cpp17.lessthancomparable]]) requirements.
1954
+
1955
+ `year_month_day_last` is a trivially copyable and standard-layout class
1956
+ type.
1957
+
1958
+ #### Member functions <a id="time.cal.ymdlast.members">[[time.cal.ymdlast.members]]</a>
1959
+
1960
+ ``` cpp
1961
+ constexpr year_month_day_last(const chrono::year& y,
1962
+ const chrono::month_day_last& mdl) noexcept;
1963
+ ```
1964
+
1965
+ *Effects:* Initializes `y_` with `y` and `mdl_` with `mdl`.
1966
+
1967
+ ``` cpp
1968
+ constexpr year_month_day_last& operator+=(const months& m) noexcept;
1969
+ ```
1970
+
1971
+ *Constraints:* If the argument supplied by the caller for the `months`
1972
+ parameter is convertible to `years`, its implicit conversion sequence to
1973
+ `years` is worse than its implicit conversion sequence to `months`
1974
+ [[over.ics.rank]].
1975
+
1976
+ *Effects:* `*this = *this + m`.
1977
+
1978
+ *Returns:* `*this`.
1979
+
1980
+ ``` cpp
1981
+ constexpr year_month_day_last& operator-=(const months& m) noexcept;
1982
+ ```
1983
+
1984
+ *Constraints:* If the argument supplied by the caller for the `months`
1985
+ parameter is convertible to `years`, its implicit conversion sequence to
1986
+ `years` is worse than its implicit conversion sequence to `months`
1987
+ [[over.ics.rank]].
1988
+
1989
+ *Effects:* `*this = *this - m`.
1990
+
1991
+ *Returns:* `*this`.
1992
+
1993
+ ``` cpp
1994
+ constexpr year_month_day_last& operator+=(const years& y) noexcept;
1995
+ ```
1996
+
1997
+ *Effects:* `*this = *this + y`.
1998
+
1999
+ *Returns:* `*this`.
2000
+
2001
+ ``` cpp
2002
+ constexpr year_month_day_last& operator-=(const years& y) noexcept;
2003
+ ```
2004
+
2005
+ *Effects:* `*this = *this - y`.
2006
+
2007
+ *Returns:* `*this`.
2008
+
2009
+ ``` cpp
2010
+ constexpr chrono::year year() const noexcept;
2011
+ ```
2012
+
2013
+ *Returns:* `y_`.
2014
+
2015
+ ``` cpp
2016
+ constexpr chrono::month month() const noexcept;
2017
+ ```
2018
+
2019
+ *Returns:* `mdl_.month()`.
2020
+
2021
+ ``` cpp
2022
+ constexpr chrono::month_day_last month_day_last() const noexcept;
2023
+ ```
2024
+
2025
+ *Returns:* `mdl_`.
2026
+
2027
+ ``` cpp
2028
+ constexpr chrono::day day() const noexcept;
2029
+ ```
2030
+
2031
+ *Returns:* If `ok()` is `true`, returns a `day` representing the last
2032
+ day of the (`year`, `month`) pair represented by `*this`. Otherwise, the
2033
+ returned value is unspecified.
2034
+
2035
+ [*Note 1*: This value may be computed on demand. — *end note*]
2036
+
2037
+ ``` cpp
2038
+ constexpr operator sys_days() const noexcept;
2039
+ ```
2040
+
2041
+ *Returns:* `sys_days{year()/month()/day()}`.
2042
+
2043
+ ``` cpp
2044
+ constexpr explicit operator local_days() const noexcept;
2045
+ ```
2046
+
2047
+ *Returns:* `local_days{sys_days{*this}.time_since_epoch()}`.
2048
+
2049
+ ``` cpp
2050
+ constexpr bool ok() const noexcept;
2051
+ ```
2052
+
2053
+ *Returns:* `y_.ok() && mdl_.ok()`.
2054
+
2055
+ #### Non-member functions <a id="time.cal.ymdlast.nonmembers">[[time.cal.ymdlast.nonmembers]]</a>
2056
+
2057
+ ``` cpp
2058
+ constexpr bool operator==(const year_month_day_last& x, const year_month_day_last& y) noexcept;
2059
+ ```
2060
+
2061
+ *Returns:*
2062
+ `x.year() == y.year() && x.month_day_last() == y.month_day_last()`.
2063
+
2064
+ ``` cpp
2065
+ constexpr strong_ordering operator<=>(const year_month_day_last& x,
2066
+ const year_month_day_last& y) noexcept;
2067
+ ```
2068
+
2069
+ *Effects:* Equivalent to:
2070
+
2071
+ ``` cpp
2072
+ if (auto c = x.year() <=> y.year(); c != 0) return c;
2073
+ return x.month_day_last() <=> y.month_day_last();
2074
+ ```
2075
+
2076
+ ``` cpp
2077
+ constexpr year_month_day_last
2078
+ operator+(const year_month_day_last& ymdl, const months& dm) noexcept;
2079
+ ```
2080
+
2081
+ *Constraints:* If the argument supplied by the caller for the `months`
2082
+ parameter is convertible to `years`, its implicit conversion sequence to
2083
+ `years` is worse than its implicit conversion sequence to `months`
2084
+ [[over.ics.rank]].
2085
+
2086
+ *Returns:* `(ymdl.year() / ymdl.month() + dm) / last`.
2087
+
2088
+ ``` cpp
2089
+ constexpr year_month_day_last
2090
+ operator+(const months& dm, const year_month_day_last& ymdl) noexcept;
2091
+ ```
2092
+
2093
+ *Constraints:* If the argument supplied by the caller for the `months`
2094
+ parameter is convertible to `years`, its implicit conversion sequence to
2095
+ `years` is worse than its implicit conversion sequence to `months`
2096
+ [[over.ics.rank]].
2097
+
2098
+ *Returns:* `ymdl + dm`.
2099
+
2100
+ ``` cpp
2101
+ constexpr year_month_day_last
2102
+ operator-(const year_month_day_last& ymdl, const months& dm) noexcept;
2103
+ ```
2104
+
2105
+ *Constraints:* If the argument supplied by the caller for the `months`
2106
+ parameter is convertible to `years`, its implicit conversion sequence to
2107
+ `years` is worse than its implicit conversion sequence to `months`
2108
+ [[over.ics.rank]].
2109
+
2110
+ *Returns:* `ymdl + (-dm)`.
2111
+
2112
+ ``` cpp
2113
+ constexpr year_month_day_last
2114
+ operator+(const year_month_day_last& ymdl, const years& dy) noexcept;
2115
+ ```
2116
+
2117
+ *Returns:* `{ymdl.year()+dy, ymdl.month_day_last()}`.
2118
+
2119
+ ``` cpp
2120
+ constexpr year_month_day_last
2121
+ operator+(const years& dy, const year_month_day_last& ymdl) noexcept;
2122
+ ```
2123
+
2124
+ *Returns:* `ymdl + dy`.
2125
+
2126
+ ``` cpp
2127
+ constexpr year_month_day_last
2128
+ operator-(const year_month_day_last& ymdl, const years& dy) noexcept;
2129
+ ```
2130
+
2131
+ *Returns:* `ymdl + (-dy)`.
2132
+
2133
+ ``` cpp
2134
+ template<class charT, class traits>
2135
+ basic_ostream<charT, traits>&
2136
+ operator<<(basic_ostream<charT, traits>& os, const year_month_day_last& ymdl);
2137
+ ```
2138
+
2139
+ *Effects:* Equivalent to:
2140
+
2141
+ ``` cpp
2142
+ return os << format(os.getloc(), STATICALLY-WIDEN<charT>("{}/{}"),
2143
+ ymdl.year(), ymdl.month_day_last());
2144
+ ```
2145
+
2146
+ ### Class `year_month_weekday` <a id="time.cal.ymwd">[[time.cal.ymwd]]</a>
2147
+
2148
+ #### Overview <a id="time.cal.ymwd.overview">[[time.cal.ymwd.overview]]</a>
2149
+
2150
+ ``` cpp
2151
+ namespace std::chrono {
2152
+ class year_month_weekday {
2153
+ chrono::year y_; // exposition only
2154
+ chrono::month m_; // exposition only
2155
+ chrono::weekday_indexed wdi_; // exposition only
2156
+
2157
+ public:
2158
+ year_month_weekday() = default;
2159
+ constexpr year_month_weekday(const chrono::year& y, const chrono::month& m,
2160
+ const chrono::weekday_indexed& wdi) noexcept;
2161
+ constexpr year_month_weekday(const sys_days& dp) noexcept;
2162
+ constexpr explicit year_month_weekday(const local_days& dp) noexcept;
2163
+
2164
+ constexpr year_month_weekday& operator+=(const months& m) noexcept;
2165
+ constexpr year_month_weekday& operator-=(const months& m) noexcept;
2166
+ constexpr year_month_weekday& operator+=(const years& y) noexcept;
2167
+ constexpr year_month_weekday& operator-=(const years& y) noexcept;
2168
+
2169
+ constexpr chrono::year year() const noexcept;
2170
+ constexpr chrono::month month() const noexcept;
2171
+ constexpr chrono::weekday weekday() const noexcept;
2172
+ constexpr unsigned index() const noexcept;
2173
+ constexpr chrono::weekday_indexed weekday_indexed() const noexcept;
2174
+
2175
+ constexpr operator sys_days() const noexcept;
2176
+ constexpr explicit operator local_days() const noexcept;
2177
+ constexpr bool ok() const noexcept;
2178
+ };
2179
+ }
2180
+ ```
2181
+
2182
+ `year_month_weekday` represents a specific year, month, and nᵗʰ weekday
2183
+ of the month. `year_month_weekday` is a field-based time point with a
2184
+ resolution of `days`.
2185
+
2186
+ [*Note 1*: `year_month_weekday` supports `years`- and `months`-oriented
2187
+ arithmetic, but not `days`-oriented arithmetic. For the latter, there is
2188
+ a conversion to `sys_days`, which efficiently supports `days`-oriented
2189
+ arithmetic. — *end note*]
2190
+
2191
+ `year_month_weekday` meets the *Cpp17EqualityComparable* (
2192
+ [[cpp17.equalitycomparable]]) requirements.
2193
+
2194
+ `year_month_weekday` is a trivially copyable and standard-layout class
2195
+ type.
2196
+
2197
+ #### Member functions <a id="time.cal.ymwd.members">[[time.cal.ymwd.members]]</a>
2198
+
2199
+ ``` cpp
2200
+ constexpr year_month_weekday(const chrono::year& y, const chrono::month& m,
2201
+ const chrono::weekday_indexed& wdi) noexcept;
2202
+ ```
2203
+
2204
+ *Effects:* Initializes `y_` with `y`, `m_` with `m`, and `wdi_` with
2205
+ `wdi`.
2206
+
2207
+ ``` cpp
2208
+ constexpr year_month_weekday(const sys_days& dp) noexcept;
2209
+ ```
2210
+
2211
+ *Effects:* Constructs an object of type `year_month_weekday` which
2212
+ corresponds to the date represented by `dp`.
2213
+
2214
+ *Remarks:* For any value `ymdl` of type `year_month_weekday` for which
2215
+ `ymdl.ok()` is `true`, `ymdl == year_month_weekday{sys_days{ymdl}}` is
2216
+ `true`.
2217
+
2218
+ ``` cpp
2219
+ constexpr explicit year_month_weekday(const local_days& dp) noexcept;
2220
+ ```
2221
+
2222
+ *Effects:* Equivalent to constructing with
2223
+ `sys_days{dp.time_since_epoch()}`.
2224
+
2225
+ ``` cpp
2226
+ constexpr year_month_weekday& operator+=(const months& m) noexcept;
2227
+ ```
2228
+
2229
+ *Constraints:* If the argument supplied by the caller for the `months`
2230
+ parameter is convertible to `years`, its implicit conversion sequence to
2231
+ `years` is worse than its implicit conversion sequence to `months`
2232
+ [[over.ics.rank]].
2233
+
2234
+ *Effects:* `*this = *this + m`.
2235
+
2236
+ *Returns:* `*this`.
2237
+
2238
+ ``` cpp
2239
+ constexpr year_month_weekday& operator-=(const months& m) noexcept;
2240
+ ```
2241
+
2242
+ *Constraints:* If the argument supplied by the caller for the `months`
2243
+ parameter is convertible to `years`, its implicit conversion sequence to
2244
+ `years` is worse than its implicit conversion sequence to `months`
2245
+ [[over.ics.rank]].
2246
+
2247
+ *Effects:* `*this = *this - m`.
2248
+
2249
+ *Returns:* `*this`.
2250
+
2251
+ ``` cpp
2252
+ constexpr year_month_weekday& operator+=(const years& y) noexcept;
2253
+ ```
2254
+
2255
+ *Effects:* `*this = *this + y`.
2256
+
2257
+ *Returns:* `*this`.
2258
+
2259
+ ``` cpp
2260
+ constexpr year_month_weekday& operator-=(const years& y) noexcept;
2261
+ ```
2262
+
2263
+ *Effects:* `*this = *this - y`.
2264
+
2265
+ *Returns:* `*this`.
2266
+
2267
+ ``` cpp
2268
+ constexpr chrono::year year() const noexcept;
2269
+ ```
2270
+
2271
+ *Returns:* `y_`.
2272
+
2273
+ ``` cpp
2274
+ constexpr chrono::month month() const noexcept;
2275
+ ```
2276
+
2277
+ *Returns:* `m_`.
2278
+
2279
+ ``` cpp
2280
+ constexpr chrono::weekday weekday() const noexcept;
2281
+ ```
2282
+
2283
+ *Returns:* `wdi_.weekday()`.
2284
+
2285
+ ``` cpp
2286
+ constexpr unsigned index() const noexcept;
2287
+ ```
2288
+
2289
+ *Returns:* `wdi_.index()`.
2290
+
2291
+ ``` cpp
2292
+ constexpr chrono::weekday_indexed weekday_indexed() const noexcept;
2293
+ ```
2294
+
2295
+ *Returns:* `wdi_`.
2296
+
2297
+ ``` cpp
2298
+ constexpr operator sys_days() const noexcept;
2299
+ ```
2300
+
2301
+ *Returns:* If `y_.ok() && m_.ok() && wdi_.weekday().ok()`, returns a
2302
+ `sys_days` that represents the date `(index() - 1) * 7` days after the
2303
+ first `weekday()` of `year()/month()`. If `index()` is 0 the returned
2304
+ `sys_days` represents the date 7 days prior to the first `weekday()` of
2305
+ `year()/month()`. Otherwise the returned value is unspecified.
2306
+
2307
+ ``` cpp
2308
+ constexpr explicit operator local_days() const noexcept;
2309
+ ```
2310
+
2311
+ *Returns:* `local_days{sys_days{*this}.time_since_epoch()}`.
2312
+
2313
+ ``` cpp
2314
+ constexpr bool ok() const noexcept;
2315
+ ```
2316
+
2317
+ *Returns:* If any of `y_.ok()`, `m_.ok()`, or `wdi_.ok()` is `false`,
2318
+ returns `false`. Otherwise, if `*this` represents a valid date, returns
2319
+ `true`. Otherwise, returns `false`.
2320
+
2321
+ #### Non-member functions <a id="time.cal.ymwd.nonmembers">[[time.cal.ymwd.nonmembers]]</a>
2322
+
2323
+ ``` cpp
2324
+ constexpr bool operator==(const year_month_weekday& x, const year_month_weekday& y) noexcept;
2325
+ ```
2326
+
2327
+ *Returns:*
2328
+
2329
+ ``` cpp
2330
+ x.year() == y.year() && x.month() == y.month() && x.weekday_indexed() == y.weekday_indexed()
2331
+ ```
2332
+
2333
+ ``` cpp
2334
+ constexpr year_month_weekday operator+(const year_month_weekday& ymwd, const months& dm) noexcept;
2335
+ ```
2336
+
2337
+ *Constraints:* If the argument supplied by the caller for the `months`
2338
+ parameter is convertible to `years`, its implicit conversion sequence to
2339
+ `years` is worse than its implicit conversion sequence to `months`
2340
+ [[over.ics.rank]].
2341
+
2342
+ *Returns:* `(ymwd.year() / ymwd.month() + dm) / ymwd.weekday_indexed()`.
2343
+
2344
+ ``` cpp
2345
+ constexpr year_month_weekday operator+(const months& dm, const year_month_weekday& ymwd) noexcept;
2346
+ ```
2347
+
2348
+ *Constraints:* If the argument supplied by the caller for the `months`
2349
+ parameter is convertible to `years`, its implicit conversion sequence to
2350
+ `years` is worse than its implicit conversion sequence to `months`
2351
+ [[over.ics.rank]].
2352
+
2353
+ *Returns:* `ymwd + dm`.
2354
+
2355
+ ``` cpp
2356
+ constexpr year_month_weekday operator-(const year_month_weekday& ymwd, const months& dm) noexcept;
2357
+ ```
2358
+
2359
+ *Constraints:* If the argument supplied by the caller for the `months`
2360
+ parameter is convertible to `years`, its implicit conversion sequence to
2361
+ `years` is worse than its implicit conversion sequence to `months`
2362
+ [[over.ics.rank]].
2363
+
2364
+ *Returns:* `ymwd + (-dm)`.
2365
+
2366
+ ``` cpp
2367
+ constexpr year_month_weekday operator+(const year_month_weekday& ymwd, const years& dy) noexcept;
2368
+ ```
2369
+
2370
+ *Returns:* `{ymwd.year()+dy, ymwd.month(), ymwd.weekday_indexed()}`.
2371
+
2372
+ ``` cpp
2373
+ constexpr year_month_weekday operator+(const years& dy, const year_month_weekday& ymwd) noexcept;
2374
+ ```
2375
+
2376
+ *Returns:* `ymwd + dy`.
2377
+
2378
+ ``` cpp
2379
+ constexpr year_month_weekday operator-(const year_month_weekday& ymwd, const years& dy) noexcept;
2380
+ ```
2381
+
2382
+ *Returns:* `ymwd + (-dy)`.
2383
+
2384
+ ``` cpp
2385
+ template<class charT, class traits>
2386
+ basic_ostream<charT, traits>&
2387
+ operator<<(basic_ostream<charT, traits>& os, const year_month_weekday& ymwd);
2388
+ ```
2389
+
2390
+ *Effects:* Equivalent to:
2391
+
2392
+ ``` cpp
2393
+ return os << format(os.getloc(), STATICALLY-WIDEN<charT>("{}/{}/{}"),
2394
+ ymwd.year(), ymwd.month(), ymwd.weekday_indexed());
2395
+ ```
2396
+
2397
+ ### Class `year_month_weekday_last` <a id="time.cal.ymwdlast">[[time.cal.ymwdlast]]</a>
2398
+
2399
+ #### Overview <a id="time.cal.ymwdlast.overview">[[time.cal.ymwdlast.overview]]</a>
2400
+
2401
+ ``` cpp
2402
+ namespace std::chrono {
2403
+ class year_month_weekday_last {
2404
+ chrono::year y_; // exposition only
2405
+ chrono::month m_; // exposition only
2406
+ chrono::weekday_last wdl_; // exposition only
2407
+
2408
+ public:
2409
+ constexpr year_month_weekday_last(const chrono::year& y, const chrono::month& m,
2410
+ const chrono::weekday_last& wdl) noexcept;
2411
+
2412
+ constexpr year_month_weekday_last& operator+=(const months& m) noexcept;
2413
+ constexpr year_month_weekday_last& operator-=(const months& m) noexcept;
2414
+ constexpr year_month_weekday_last& operator+=(const years& y) noexcept;
2415
+ constexpr year_month_weekday_last& operator-=(const years& y) noexcept;
2416
+
2417
+ constexpr chrono::year year() const noexcept;
2418
+ constexpr chrono::month month() const noexcept;
2419
+ constexpr chrono::weekday weekday() const noexcept;
2420
+ constexpr chrono::weekday_last weekday_last() const noexcept;
2421
+
2422
+ constexpr operator sys_days() const noexcept;
2423
+ constexpr explicit operator local_days() const noexcept;
2424
+ constexpr bool ok() const noexcept;
2425
+ };
2426
+ }
2427
+ ```
2428
+
2429
+ `year_month_weekday_last` represents a specific year, month, and last
2430
+ weekday of the month. `year_month_weekday_last` is a field-based time
2431
+ point with a resolution of `days`, except that it is restricted to
2432
+ pointing to the last weekday of a year and month.
2433
+
2434
+ [*Note 1*: `year_month_weekday_last` supports `years`- and
2435
+ `months`-oriented arithmetic, but not `days`-oriented arithmetic. For
2436
+ the latter, there is a conversion to `sys_days`, which efficiently
2437
+ supports `days`-oriented arithmetic. — *end note*]
2438
+
2439
+ `year_month_weekday_last` meets the *Cpp17EqualityComparable* (
2440
+ [[cpp17.equalitycomparable]]) requirements.
2441
+
2442
+ `year_month_weekday_last` is a trivially copyable and standard-layout
2443
+ class type.
2444
+
2445
+ #### Member functions <a id="time.cal.ymwdlast.members">[[time.cal.ymwdlast.members]]</a>
2446
+
2447
+ ``` cpp
2448
+ constexpr year_month_weekday_last(const chrono::year& y, const chrono::month& m,
2449
+ const chrono::weekday_last& wdl) noexcept;
2450
+ ```
2451
+
2452
+ *Effects:* Initializes `y_` with `y`, `m_` with `m`, and `wdl_` with
2453
+ `wdl`.
2454
+
2455
+ ``` cpp
2456
+ constexpr year_month_weekday_last& operator+=(const months& m) noexcept;
2457
+ ```
2458
+
2459
+ *Constraints:* If the argument supplied by the caller for the `months`
2460
+ parameter is convertible to `years`, its implicit conversion sequence to
2461
+ `years` is worse than its implicit conversion sequence to `months`
2462
+ [[over.ics.rank]].
2463
+
2464
+ *Effects:* `*this = *this + m`.
2465
+
2466
+ *Returns:* `*this`.
2467
+
2468
+ ``` cpp
2469
+ constexpr year_month_weekday_last& operator-=(const months& m) noexcept;
2470
+ ```
2471
+
2472
+ *Constraints:* If the argument supplied by the caller for the `months`
2473
+ parameter is convertible to `years`, its implicit conversion sequence to
2474
+ `years` is worse than its implicit conversion sequence to `months`
2475
+ [[over.ics.rank]].
2476
+
2477
+ *Effects:* `*this = *this - m`.
2478
+
2479
+ *Returns:* `*this`.
2480
+
2481
+ ``` cpp
2482
+ constexpr year_month_weekday_last& operator+=(const years& y) noexcept;
2483
+ ```
2484
+
2485
+ *Effects:* `*this = *this + y`.
2486
+
2487
+ *Returns:* `*this`.
2488
+
2489
+ ``` cpp
2490
+ constexpr year_month_weekday_last& operator-=(const years& y) noexcept;
2491
+ ```
2492
+
2493
+ *Effects:* `*this = *this - y`.
2494
+
2495
+ *Returns:* `*this`.
2496
+
2497
+ ``` cpp
2498
+ constexpr chrono::year year() const noexcept;
2499
+ ```
2500
+
2501
+ *Returns:* `y_`.
2502
+
2503
+ ``` cpp
2504
+ constexpr chrono::month month() const noexcept;
2505
+ ```
2506
+
2507
+ *Returns:* `m_`.
2508
+
2509
+ ``` cpp
2510
+ constexpr chrono::weekday weekday() const noexcept;
2511
+ ```
2512
+
2513
+ *Returns:* `wdl_.weekday()`.
2514
+
2515
+ ``` cpp
2516
+ constexpr chrono::weekday_last weekday_last() const noexcept;
2517
+ ```
2518
+
2519
+ *Returns:* `wdl_`.
2520
+
2521
+ ``` cpp
2522
+ constexpr operator sys_days() const noexcept;
2523
+ ```
2524
+
2525
+ *Returns:* If `ok() == true`, returns a `sys_days` that represents the
2526
+ last `weekday()` of `year()/month()`. Otherwise the returned value is
2527
+ unspecified.
2528
+
2529
+ ``` cpp
2530
+ constexpr explicit operator local_days() const noexcept;
2531
+ ```
2532
+
2533
+ *Returns:* `local_days{sys_days{*this}.time_since_epoch()}`.
2534
+
2535
+ ``` cpp
2536
+ constexpr bool ok() const noexcept;
2537
+ ```
2538
+
2539
+ *Returns:* `y_.ok() && m_.ok() && wdl_.ok()`.
2540
+
2541
+ #### Non-member functions <a id="time.cal.ymwdlast.nonmembers">[[time.cal.ymwdlast.nonmembers]]</a>
2542
+
2543
+ ``` cpp
2544
+ constexpr bool operator==(const year_month_weekday_last& x,
2545
+ const year_month_weekday_last& y) noexcept;
2546
+ ```
2547
+
2548
+ *Returns:*
2549
+
2550
+ ``` cpp
2551
+ x.year() == y.year() && x.month() == y.month() && x.weekday_last() == y.weekday_last()
2552
+ ```
2553
+
2554
+ ``` cpp
2555
+ constexpr year_month_weekday_last
2556
+ operator+(const year_month_weekday_last& ymwdl, const months& dm) noexcept;
2557
+ ```
2558
+
2559
+ *Constraints:* If the argument supplied by the caller for the `months`
2560
+ parameter is convertible to `years`, its implicit conversion sequence to
2561
+ `years` is worse than its implicit conversion sequence to `months`
2562
+ [[over.ics.rank]].
2563
+
2564
+ *Returns:* `(ymwdl.year() / ymwdl.month() + dm) / ymwdl.weekday_last()`.
2565
+
2566
+ ``` cpp
2567
+ constexpr year_month_weekday_last
2568
+ operator+(const months& dm, const year_month_weekday_last& ymwdl) noexcept;
2569
+ ```
2570
+
2571
+ *Constraints:* If the argument supplied by the caller for the `months`
2572
+ parameter is convertible to `years`, its implicit conversion sequence to
2573
+ `years` is worse than its implicit conversion sequence to `months`
2574
+ [[over.ics.rank]].
2575
+
2576
+ *Returns:* `ymwdl + dm`.
2577
+
2578
+ ``` cpp
2579
+ constexpr year_month_weekday_last
2580
+ operator-(const year_month_weekday_last& ymwdl, const months& dm) noexcept;
2581
+ ```
2582
+
2583
+ *Constraints:* If the argument supplied by the caller for the `months`
2584
+ parameter is convertible to `years`, its implicit conversion sequence to
2585
+ `years` is worse than its implicit conversion sequence to `months`
2586
+ [[over.ics.rank]].
2587
+
2588
+ *Returns:* `ymwdl + (-dm)`.
2589
+
2590
+ ``` cpp
2591
+ constexpr year_month_weekday_last
2592
+ operator+(const year_month_weekday_last& ymwdl, const years& dy) noexcept;
2593
+ ```
2594
+
2595
+ *Returns:* `{ymwdl.year()+dy, ymwdl.month(), ymwdl.weekday_last()}`.
2596
+
2597
+ ``` cpp
2598
+ constexpr year_month_weekday_last
2599
+ operator+(const years& dy, const year_month_weekday_last& ymwdl) noexcept;
2600
+ ```
2601
+
2602
+ *Returns:* `ymwdl + dy`.
2603
+
2604
+ ``` cpp
2605
+ constexpr year_month_weekday_last
2606
+ operator-(const year_month_weekday_last& ymwdl, const years& dy) noexcept;
2607
+ ```
2608
+
2609
+ *Returns:* `ymwdl + (-dy)`.
2610
+
2611
+ ``` cpp
2612
+ template<class charT, class traits>
2613
+ basic_ostream<charT, traits>&
2614
+ operator<<(basic_ostream<charT, traits>& os, const year_month_weekday_last& ymwdl);
2615
+ ```
2616
+
2617
+ *Effects:* Equivalent to:
2618
+
2619
+ ``` cpp
2620
+ return os << format(os.getloc(), STATICALLY-WIDEN<charT>("{}/{}/{}"),
2621
+ ymwdl.year(), ymwdl.month(), ymwdl.weekday_last());
2622
+ ```
2623
+
2624
+ ### Conventional syntax operators <a id="time.cal.operators">[[time.cal.operators]]</a>
2625
+
2626
+ A set of overloaded `operator/` functions provides a conventional syntax
2627
+ for the creation of civil calendar dates.
2628
+
2629
+ [*Note 1*:
2630
+
2631
+ The year, month, and day are accepted in any of the following 3 orders:
2632
+
2633
+ ``` cpp
2634
+ year/month/day
2635
+ month/day/year
2636
+ day/month/year
2637
+ ```
2638
+
2639
+ Anywhere a `day` is required, any of the following can also be
2640
+ specified:
2641
+
2642
+ ``` cpp
2643
+ last
2644
+ weekday[i]
2645
+ weekday[last]
2646
+ ```
2647
+
2648
+ — *end note*]
2649
+
2650
+ [*Note 2*:
2651
+
2652
+ Partial-date types such as `year_month` and `month_day` can be created
2653
+ by not applying the second division operator for any of the three
2654
+ orders. For example:
2655
+
2656
+ ``` cpp
2657
+ year_month ym = 2015y/April;
2658
+ month_day md1 = April/4;
2659
+ month_day md2 = 4d/April;
2660
+ ```
2661
+
2662
+ — *end note*]
2663
+
2664
+ [*Example 1*:
2665
+
2666
+ ``` cpp
2667
+ auto a = 2015/4/4; // a == int(125)
2668
+ auto b = 2015y/4/4; // b == year_month_day{year(2015), month(4), day(4)}
2669
+ auto c = 2015y/4d/April; // error: no viable operator/ for first /
2670
+ auto d = 2015/April/4; // error: no viable operator/ for first /
2671
+ ```
2672
+
2673
+ — *end example*]
2674
+
2675
+ ``` cpp
2676
+ constexpr year_month
2677
+ operator/(const year& y, const month& m) noexcept;
2678
+ ```
2679
+
2680
+ *Returns:* `{y, m}`.
2681
+
2682
+ ``` cpp
2683
+ constexpr year_month
2684
+ operator/(const year& y, int m) noexcept;
2685
+ ```
2686
+
2687
+ *Returns:* `y / month(m)`.
2688
+
2689
+ ``` cpp
2690
+ constexpr month_day
2691
+ operator/(const month& m, const day& d) noexcept;
2692
+ ```
2693
+
2694
+ *Returns:* `{m, d}`.
2695
+
2696
+ ``` cpp
2697
+ constexpr month_day
2698
+ operator/(const month& m, int d) noexcept;
2699
+ ```
2700
+
2701
+ *Returns:* `m / day(d)`.
2702
+
2703
+ ``` cpp
2704
+ constexpr month_day
2705
+ operator/(int m, const day& d) noexcept;
2706
+ ```
2707
+
2708
+ *Returns:* `month(m) / d`.
2709
+
2710
+ ``` cpp
2711
+ constexpr month_day
2712
+ operator/(const day& d, const month& m) noexcept;
2713
+ ```
2714
+
2715
+ *Returns:* `m / d`.
2716
+
2717
+ ``` cpp
2718
+ constexpr month_day
2719
+ operator/(const day& d, int m) noexcept;
2720
+ ```
2721
+
2722
+ *Returns:* `month(m) / d`.
2723
+
2724
+ ``` cpp
2725
+ constexpr month_day_last
2726
+ operator/(const month& m, last_spec) noexcept;
2727
+ ```
2728
+
2729
+ *Returns:* `month_day_last{m}`.
2730
+
2731
+ ``` cpp
2732
+ constexpr month_day_last
2733
+ operator/(int m, last_spec) noexcept;
2734
+ ```
2735
+
2736
+ *Returns:* `month(m) / last`.
2737
+
2738
+ ``` cpp
2739
+ constexpr month_day_last
2740
+ operator/(last_spec, const month& m) noexcept;
2741
+ ```
2742
+
2743
+ *Returns:* `m / last`.
2744
+
2745
+ ``` cpp
2746
+ constexpr month_day_last
2747
+ operator/(last_spec, int m) noexcept;
2748
+ ```
2749
+
2750
+ *Returns:* `month(m) / last`.
2751
+
2752
+ ``` cpp
2753
+ constexpr month_weekday
2754
+ operator/(const month& m, const weekday_indexed& wdi) noexcept;
2755
+ ```
2756
+
2757
+ *Returns:* `{m, wdi}`.
2758
+
2759
+ ``` cpp
2760
+ constexpr month_weekday
2761
+ operator/(int m, const weekday_indexed& wdi) noexcept;
2762
+ ```
2763
+
2764
+ *Returns:* `month(m) / wdi`.
2765
+
2766
+ ``` cpp
2767
+ constexpr month_weekday
2768
+ operator/(const weekday_indexed& wdi, const month& m) noexcept;
2769
+ ```
2770
+
2771
+ *Returns:* `m / wdi`.
2772
+
2773
+ ``` cpp
2774
+ constexpr month_weekday
2775
+ operator/(const weekday_indexed& wdi, int m) noexcept;
2776
+ ```
2777
+
2778
+ *Returns:* `month(m) / wdi`.
2779
+
2780
+ ``` cpp
2781
+ constexpr month_weekday_last
2782
+ operator/(const month& m, const weekday_last& wdl) noexcept;
2783
+ ```
2784
+
2785
+ *Returns:* `{m, wdl}`.
2786
+
2787
+ ``` cpp
2788
+ constexpr month_weekday_last
2789
+ operator/(int m, const weekday_last& wdl) noexcept;
2790
+ ```
2791
+
2792
+ *Returns:* `month(m) / wdl`.
2793
+
2794
+ ``` cpp
2795
+ constexpr month_weekday_last
2796
+ operator/(const weekday_last& wdl, const month& m) noexcept;
2797
+ ```
2798
+
2799
+ *Returns:* `m / wdl`.
2800
+
2801
+ ``` cpp
2802
+ constexpr month_weekday_last
2803
+ operator/(const weekday_last& wdl, int m) noexcept;
2804
+ ```
2805
+
2806
+ *Returns:* `month(m) / wdl`.
2807
+
2808
+ ``` cpp
2809
+ constexpr year_month_day
2810
+ operator/(const year_month& ym, const day& d) noexcept;
2811
+ ```
2812
+
2813
+ *Returns:* `{ym.year(), ym.month(), d}`.
2814
+
2815
+ ``` cpp
2816
+ constexpr year_month_day
2817
+ operator/(const year_month& ym, int d) noexcept;
2818
+ ```
2819
+
2820
+ *Returns:* `ym / day(d)`.
2821
+
2822
+ ``` cpp
2823
+ constexpr year_month_day
2824
+ operator/(const year& y, const month_day& md) noexcept;
2825
+ ```
2826
+
2827
+ *Returns:* `y / md.month() / md.day()`.
2828
+
2829
+ ``` cpp
2830
+ constexpr year_month_day
2831
+ operator/(int y, const month_day& md) noexcept;
2832
+ ```
2833
+
2834
+ *Returns:* `year(y) / md`.
2835
+
2836
+ ``` cpp
2837
+ constexpr year_month_day
2838
+ operator/(const month_day& md, const year& y) noexcept;
2839
+ ```
2840
+
2841
+ *Returns:* `y / md`.
2842
+
2843
+ ``` cpp
2844
+ constexpr year_month_day
2845
+ operator/(const month_day& md, int y) noexcept;
2846
+ ```
2847
+
2848
+ *Returns:* `year(y) / md`.
2849
+
2850
+ ``` cpp
2851
+ constexpr year_month_day_last
2852
+ operator/(const year_month& ym, last_spec) noexcept;
2853
+ ```
2854
+
2855
+ *Returns:* `{ym.year(), month_day_last{ym.month()}}`.
2856
+
2857
+ ``` cpp
2858
+ constexpr year_month_day_last
2859
+ operator/(const year& y, const month_day_last& mdl) noexcept;
2860
+ ```
2861
+
2862
+ *Returns:* `{y, mdl}`.
2863
+
2864
+ ``` cpp
2865
+ constexpr year_month_day_last
2866
+ operator/(int y, const month_day_last& mdl) noexcept;
2867
+ ```
2868
+
2869
+ *Returns:* `year(y) / mdl`.
2870
+
2871
+ ``` cpp
2872
+ constexpr year_month_day_last
2873
+ operator/(const month_day_last& mdl, const year& y) noexcept;
2874
+ ```
2875
+
2876
+ *Returns:* `y / mdl`.
2877
+
2878
+ ``` cpp
2879
+ constexpr year_month_day_last
2880
+ operator/(const month_day_last& mdl, int y) noexcept;
2881
+ ```
2882
+
2883
+ *Returns:* `year(y) / mdl`.
2884
+
2885
+ ``` cpp
2886
+ constexpr year_month_weekday
2887
+ operator/(const year_month& ym, const weekday_indexed& wdi) noexcept;
2888
+ ```
2889
+
2890
+ *Returns:* `{ym.year(), ym.month(), wdi}`.
2891
+
2892
+ ``` cpp
2893
+ constexpr year_month_weekday
2894
+ operator/(const year& y, const month_weekday& mwd) noexcept;
2895
+ ```
2896
+
2897
+ *Returns:* `{y, mwd.month(), mwd.weekday_indexed()}`.
2898
+
2899
+ ``` cpp
2900
+ constexpr year_month_weekday
2901
+ operator/(int y, const month_weekday& mwd) noexcept;
2902
+ ```
2903
+
2904
+ *Returns:* `year(y) / mwd`.
2905
+
2906
+ ``` cpp
2907
+ constexpr year_month_weekday
2908
+ operator/(const month_weekday& mwd, const year& y) noexcept;
2909
+ ```
2910
+
2911
+ *Returns:* `y / mwd`.
2912
+
2913
+ ``` cpp
2914
+ constexpr year_month_weekday
2915
+ operator/(const month_weekday& mwd, int y) noexcept;
2916
+ ```
2917
+
2918
+ *Returns:* `year(y) / mwd`.
2919
+
2920
+ ``` cpp
2921
+ constexpr year_month_weekday_last
2922
+ operator/(const year_month& ym, const weekday_last& wdl) noexcept;
2923
+ ```
2924
+
2925
+ *Returns:* `{ym.year(), ym.month(), wdl}`.
2926
+
2927
+ ``` cpp
2928
+ constexpr year_month_weekday_last
2929
+ operator/(const year& y, const month_weekday_last& mwdl) noexcept;
2930
+ ```
2931
+
2932
+ *Returns:* `{y, mwdl.month(), mwdl.weekday_last()}`.
2933
+
2934
+ ``` cpp
2935
+ constexpr year_month_weekday_last
2936
+ operator/(int y, const month_weekday_last& mwdl) noexcept;
2937
+ ```
2938
+
2939
+ *Returns:* `year(y) / mwdl`.
2940
+
2941
+ ``` cpp
2942
+ constexpr year_month_weekday_last
2943
+ operator/(const month_weekday_last& mwdl, const year& y) noexcept;
2944
+ ```
2945
+
2946
+ *Returns:* `y / mwdl`.
2947
+
2948
+ ``` cpp
2949
+ constexpr year_month_weekday_last
2950
+ operator/(const month_weekday_last& mwdl, int y) noexcept;
2951
+ ```
2952
+
2953
+ *Returns:* `year(y) / mwdl`.
2954
+