From Jason Turner

[time.cal.ymdlast]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp1xg5fxt_/{from.md → to.md} +236 -0
tmp/tmp1xg5fxt_/{from.md → to.md} RENAMED
@@ -0,0 +1,236 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### Class `year_month_day_last` <a id="time.cal.ymdlast">[[time.cal.ymdlast]]</a>
2
+
3
+ #### Overview <a id="time.cal.ymdlast.overview">[[time.cal.ymdlast.overview]]</a>
4
+
5
+ ``` cpp
6
+ namespace std::chrono {
7
+ class year_month_day_last {
8
+ chrono::year y_; // exposition only
9
+ chrono::month_day_last mdl_; // exposition only
10
+
11
+ public:
12
+ constexpr year_month_day_last(const chrono::year& y,
13
+ const chrono::month_day_last& mdl) noexcept;
14
+
15
+ constexpr year_month_day_last& operator+=(const months& m) noexcept;
16
+ constexpr year_month_day_last& operator-=(const months& m) noexcept;
17
+ constexpr year_month_day_last& operator+=(const years& y) noexcept;
18
+ constexpr year_month_day_last& operator-=(const years& y) noexcept;
19
+
20
+ constexpr chrono::year year() const noexcept;
21
+ constexpr chrono::month month() const noexcept;
22
+ constexpr chrono::month_day_last month_day_last() const noexcept;
23
+ constexpr chrono::day day() const noexcept;
24
+
25
+ constexpr operator sys_days() const noexcept;
26
+ constexpr explicit operator local_days() const noexcept;
27
+ constexpr bool ok() const noexcept;
28
+ };
29
+ }
30
+ ```
31
+
32
+ `year_month_day_last` represents the last day of a specific year and
33
+ month. `year_month_day_last` is a field-based time point with a
34
+ resolution of `days`, except that it is restricted to pointing to the
35
+ last day of a year and month.
36
+
37
+ [*Note 1*: `year_month_day_last` supports `years`- and
38
+ `months`-oriented arithmetic, but not `days`-oriented arithmetic. For
39
+ the latter, there is a conversion to `sys_days`, which efficiently
40
+ supports `days`-oriented arithmetic. — *end note*]
41
+
42
+ `year_month_day_last` meets the *Cpp17EqualityComparable* (
43
+ [[cpp17.equalitycomparable]]) and *Cpp17LessThanComparable* (
44
+ [[cpp17.lessthancomparable]]) requirements.
45
+
46
+ `year_month_day_last` is a trivially copyable and standard-layout class
47
+ type.
48
+
49
+ #### Member functions <a id="time.cal.ymdlast.members">[[time.cal.ymdlast.members]]</a>
50
+
51
+ ``` cpp
52
+ constexpr year_month_day_last(const chrono::year& y,
53
+ const chrono::month_day_last& mdl) noexcept;
54
+ ```
55
+
56
+ *Effects:* Initializes `y_` with `y` and `mdl_` with `mdl`.
57
+
58
+ ``` cpp
59
+ constexpr year_month_day_last& operator+=(const months& m) noexcept;
60
+ ```
61
+
62
+ *Constraints:* If the argument supplied by the caller for the `months`
63
+ parameter is convertible to `years`, its implicit conversion sequence to
64
+ `years` is worse than its implicit conversion sequence to `months`
65
+ [[over.ics.rank]].
66
+
67
+ *Effects:* `*this = *this + m`.
68
+
69
+ *Returns:* `*this`.
70
+
71
+ ``` cpp
72
+ constexpr year_month_day_last& operator-=(const months& m) noexcept;
73
+ ```
74
+
75
+ *Constraints:* If the argument supplied by the caller for the `months`
76
+ parameter is convertible to `years`, its implicit conversion sequence to
77
+ `years` is worse than its implicit conversion sequence to `months`
78
+ [[over.ics.rank]].
79
+
80
+ *Effects:* `*this = *this - m`.
81
+
82
+ *Returns:* `*this`.
83
+
84
+ ``` cpp
85
+ constexpr year_month_day_last& operator+=(const years& y) noexcept;
86
+ ```
87
+
88
+ *Effects:* `*this = *this + y`.
89
+
90
+ *Returns:* `*this`.
91
+
92
+ ``` cpp
93
+ constexpr year_month_day_last& operator-=(const years& y) noexcept;
94
+ ```
95
+
96
+ *Effects:* `*this = *this - y`.
97
+
98
+ *Returns:* `*this`.
99
+
100
+ ``` cpp
101
+ constexpr chrono::year year() const noexcept;
102
+ ```
103
+
104
+ *Returns:* `y_`.
105
+
106
+ ``` cpp
107
+ constexpr chrono::month month() const noexcept;
108
+ ```
109
+
110
+ *Returns:* `mdl_.month()`.
111
+
112
+ ``` cpp
113
+ constexpr chrono::month_day_last month_day_last() const noexcept;
114
+ ```
115
+
116
+ *Returns:* `mdl_`.
117
+
118
+ ``` cpp
119
+ constexpr chrono::day day() const noexcept;
120
+ ```
121
+
122
+ *Returns:* If `ok()` is `true`, returns a `day` representing the last
123
+ day of the (`year`, `month`) pair represented by `*this`. Otherwise, the
124
+ returned value is unspecified.
125
+
126
+ [*Note 1*: This value may be computed on demand. — *end note*]
127
+
128
+ ``` cpp
129
+ constexpr operator sys_days() const noexcept;
130
+ ```
131
+
132
+ *Returns:* `sys_days{year()/month()/day()}`.
133
+
134
+ ``` cpp
135
+ constexpr explicit operator local_days() const noexcept;
136
+ ```
137
+
138
+ *Returns:* `local_days{sys_days{*this}.time_since_epoch()}`.
139
+
140
+ ``` cpp
141
+ constexpr bool ok() const noexcept;
142
+ ```
143
+
144
+ *Returns:* `y_.ok() && mdl_.ok()`.
145
+
146
+ #### Non-member functions <a id="time.cal.ymdlast.nonmembers">[[time.cal.ymdlast.nonmembers]]</a>
147
+
148
+ ``` cpp
149
+ constexpr bool operator==(const year_month_day_last& x, const year_month_day_last& y) noexcept;
150
+ ```
151
+
152
+ *Returns:*
153
+ `x.year() == y.year() && x.month_day_last() == y.month_day_last()`.
154
+
155
+ ``` cpp
156
+ constexpr strong_ordering operator<=>(const year_month_day_last& x,
157
+ const year_month_day_last& y) noexcept;
158
+ ```
159
+
160
+ *Effects:* Equivalent to:
161
+
162
+ ``` cpp
163
+ if (auto c = x.year() <=> y.year(); c != 0) return c;
164
+ return x.month_day_last() <=> y.month_day_last();
165
+ ```
166
+
167
+ ``` cpp
168
+ constexpr year_month_day_last
169
+ operator+(const year_month_day_last& ymdl, const months& dm) noexcept;
170
+ ```
171
+
172
+ *Constraints:* If the argument supplied by the caller for the `months`
173
+ parameter is convertible to `years`, its implicit conversion sequence to
174
+ `years` is worse than its implicit conversion sequence to `months`
175
+ [[over.ics.rank]].
176
+
177
+ *Returns:* `(ymdl.year() / ymdl.month() + dm) / last`.
178
+
179
+ ``` cpp
180
+ constexpr year_month_day_last
181
+ operator+(const months& dm, const year_month_day_last& ymdl) noexcept;
182
+ ```
183
+
184
+ *Constraints:* If the argument supplied by the caller for the `months`
185
+ parameter is convertible to `years`, its implicit conversion sequence to
186
+ `years` is worse than its implicit conversion sequence to `months`
187
+ [[over.ics.rank]].
188
+
189
+ *Returns:* `ymdl + dm`.
190
+
191
+ ``` cpp
192
+ constexpr year_month_day_last
193
+ operator-(const year_month_day_last& ymdl, const months& dm) noexcept;
194
+ ```
195
+
196
+ *Constraints:* If the argument supplied by the caller for the `months`
197
+ parameter is convertible to `years`, its implicit conversion sequence to
198
+ `years` is worse than its implicit conversion sequence to `months`
199
+ [[over.ics.rank]].
200
+
201
+ *Returns:* `ymdl + (-dm)`.
202
+
203
+ ``` cpp
204
+ constexpr year_month_day_last
205
+ operator+(const year_month_day_last& ymdl, const years& dy) noexcept;
206
+ ```
207
+
208
+ *Returns:* `{ymdl.year()+dy, ymdl.month_day_last()}`.
209
+
210
+ ``` cpp
211
+ constexpr year_month_day_last
212
+ operator+(const years& dy, const year_month_day_last& ymdl) noexcept;
213
+ ```
214
+
215
+ *Returns:* `ymdl + dy`.
216
+
217
+ ``` cpp
218
+ constexpr year_month_day_last
219
+ operator-(const year_month_day_last& ymdl, const years& dy) noexcept;
220
+ ```
221
+
222
+ *Returns:* `ymdl + (-dy)`.
223
+
224
+ ``` cpp
225
+ template<class charT, class traits>
226
+ basic_ostream<charT, traits>&
227
+ operator<<(basic_ostream<charT, traits>& os, const year_month_day_last& ymdl);
228
+ ```
229
+
230
+ *Effects:* Equivalent to:
231
+
232
+ ``` cpp
233
+ return os << format(os.getloc(), STATICALLY-WIDEN<charT>("{}/{}"),
234
+ ymdl.year(), ymdl.month_day_last());
235
+ ```
236
+