From Jason Turner

[time.cal.operators]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp8xq1gw95/{from.md → to.md} +331 -0
tmp/tmp8xq1gw95/{from.md → to.md} RENAMED
@@ -0,0 +1,331 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### Conventional syntax operators <a id="time.cal.operators">[[time.cal.operators]]</a>
2
+
3
+ A set of overloaded `operator/` functions provides a conventional syntax
4
+ for the creation of civil calendar dates.
5
+
6
+ [*Note 1*:
7
+
8
+ The year, month, and day are accepted in any of the following 3 orders:
9
+
10
+ ``` cpp
11
+ year/month/day
12
+ month/day/year
13
+ day/month/year
14
+ ```
15
+
16
+ Anywhere a `day` is required, any of the following can also be
17
+ specified:
18
+
19
+ ``` cpp
20
+ last
21
+ weekday[i]
22
+ weekday[last]
23
+ ```
24
+
25
+ — *end note*]
26
+
27
+ [*Note 2*:
28
+
29
+ Partial-date types such as `year_month` and `month_day` can be created
30
+ by not applying the second division operator for any of the three
31
+ orders. For example:
32
+
33
+ ``` cpp
34
+ year_month ym = 2015y/April;
35
+ month_day md1 = April/4;
36
+ month_day md2 = 4d/April;
37
+ ```
38
+
39
+ — *end note*]
40
+
41
+ [*Example 1*:
42
+
43
+ ``` cpp
44
+ auto a = 2015/4/4; // a == int(125)
45
+ auto b = 2015y/4/4; // b == year_month_day{year(2015), month(4), day(4)}
46
+ auto c = 2015y/4d/April; // error: no viable operator/ for first /
47
+ auto d = 2015/April/4; // error: no viable operator/ for first /
48
+ ```
49
+
50
+ — *end example*]
51
+
52
+ ``` cpp
53
+ constexpr year_month
54
+ operator/(const year& y, const month& m) noexcept;
55
+ ```
56
+
57
+ *Returns:* `{y, m}`.
58
+
59
+ ``` cpp
60
+ constexpr year_month
61
+ operator/(const year& y, int m) noexcept;
62
+ ```
63
+
64
+ *Returns:* `y / month(m)`.
65
+
66
+ ``` cpp
67
+ constexpr month_day
68
+ operator/(const month& m, const day& d) noexcept;
69
+ ```
70
+
71
+ *Returns:* `{m, d}`.
72
+
73
+ ``` cpp
74
+ constexpr month_day
75
+ operator/(const month& m, int d) noexcept;
76
+ ```
77
+
78
+ *Returns:* `m / day(d)`.
79
+
80
+ ``` cpp
81
+ constexpr month_day
82
+ operator/(int m, const day& d) noexcept;
83
+ ```
84
+
85
+ *Returns:* `month(m) / d`.
86
+
87
+ ``` cpp
88
+ constexpr month_day
89
+ operator/(const day& d, const month& m) noexcept;
90
+ ```
91
+
92
+ *Returns:* `m / d`.
93
+
94
+ ``` cpp
95
+ constexpr month_day
96
+ operator/(const day& d, int m) noexcept;
97
+ ```
98
+
99
+ *Returns:* `month(m) / d`.
100
+
101
+ ``` cpp
102
+ constexpr month_day_last
103
+ operator/(const month& m, last_spec) noexcept;
104
+ ```
105
+
106
+ *Returns:* `month_day_last{m}`.
107
+
108
+ ``` cpp
109
+ constexpr month_day_last
110
+ operator/(int m, last_spec) noexcept;
111
+ ```
112
+
113
+ *Returns:* `month(m) / last`.
114
+
115
+ ``` cpp
116
+ constexpr month_day_last
117
+ operator/(last_spec, const month& m) noexcept;
118
+ ```
119
+
120
+ *Returns:* `m / last`.
121
+
122
+ ``` cpp
123
+ constexpr month_day_last
124
+ operator/(last_spec, int m) noexcept;
125
+ ```
126
+
127
+ *Returns:* `month(m) / last`.
128
+
129
+ ``` cpp
130
+ constexpr month_weekday
131
+ operator/(const month& m, const weekday_indexed& wdi) noexcept;
132
+ ```
133
+
134
+ *Returns:* `{m, wdi}`.
135
+
136
+ ``` cpp
137
+ constexpr month_weekday
138
+ operator/(int m, const weekday_indexed& wdi) noexcept;
139
+ ```
140
+
141
+ *Returns:* `month(m) / wdi`.
142
+
143
+ ``` cpp
144
+ constexpr month_weekday
145
+ operator/(const weekday_indexed& wdi, const month& m) noexcept;
146
+ ```
147
+
148
+ *Returns:* `m / wdi`.
149
+
150
+ ``` cpp
151
+ constexpr month_weekday
152
+ operator/(const weekday_indexed& wdi, int m) noexcept;
153
+ ```
154
+
155
+ *Returns:* `month(m) / wdi`.
156
+
157
+ ``` cpp
158
+ constexpr month_weekday_last
159
+ operator/(const month& m, const weekday_last& wdl) noexcept;
160
+ ```
161
+
162
+ *Returns:* `{m, wdl}`.
163
+
164
+ ``` cpp
165
+ constexpr month_weekday_last
166
+ operator/(int m, const weekday_last& wdl) noexcept;
167
+ ```
168
+
169
+ *Returns:* `month(m) / wdl`.
170
+
171
+ ``` cpp
172
+ constexpr month_weekday_last
173
+ operator/(const weekday_last& wdl, const month& m) noexcept;
174
+ ```
175
+
176
+ *Returns:* `m / wdl`.
177
+
178
+ ``` cpp
179
+ constexpr month_weekday_last
180
+ operator/(const weekday_last& wdl, int m) noexcept;
181
+ ```
182
+
183
+ *Returns:* `month(m) / wdl`.
184
+
185
+ ``` cpp
186
+ constexpr year_month_day
187
+ operator/(const year_month& ym, const day& d) noexcept;
188
+ ```
189
+
190
+ *Returns:* `{ym.year(), ym.month(), d}`.
191
+
192
+ ``` cpp
193
+ constexpr year_month_day
194
+ operator/(const year_month& ym, int d) noexcept;
195
+ ```
196
+
197
+ *Returns:* `ym / day(d)`.
198
+
199
+ ``` cpp
200
+ constexpr year_month_day
201
+ operator/(const year& y, const month_day& md) noexcept;
202
+ ```
203
+
204
+ *Returns:* `y / md.month() / md.day()`.
205
+
206
+ ``` cpp
207
+ constexpr year_month_day
208
+ operator/(int y, const month_day& md) noexcept;
209
+ ```
210
+
211
+ *Returns:* `year(y) / md`.
212
+
213
+ ``` cpp
214
+ constexpr year_month_day
215
+ operator/(const month_day& md, const year& y) noexcept;
216
+ ```
217
+
218
+ *Returns:* `y / md`.
219
+
220
+ ``` cpp
221
+ constexpr year_month_day
222
+ operator/(const month_day& md, int y) noexcept;
223
+ ```
224
+
225
+ *Returns:* `year(y) / md`.
226
+
227
+ ``` cpp
228
+ constexpr year_month_day_last
229
+ operator/(const year_month& ym, last_spec) noexcept;
230
+ ```
231
+
232
+ *Returns:* `{ym.year(), month_day_last{ym.month()}}`.
233
+
234
+ ``` cpp
235
+ constexpr year_month_day_last
236
+ operator/(const year& y, const month_day_last& mdl) noexcept;
237
+ ```
238
+
239
+ *Returns:* `{y, mdl}`.
240
+
241
+ ``` cpp
242
+ constexpr year_month_day_last
243
+ operator/(int y, const month_day_last& mdl) noexcept;
244
+ ```
245
+
246
+ *Returns:* `year(y) / mdl`.
247
+
248
+ ``` cpp
249
+ constexpr year_month_day_last
250
+ operator/(const month_day_last& mdl, const year& y) noexcept;
251
+ ```
252
+
253
+ *Returns:* `y / mdl`.
254
+
255
+ ``` cpp
256
+ constexpr year_month_day_last
257
+ operator/(const month_day_last& mdl, int y) noexcept;
258
+ ```
259
+
260
+ *Returns:* `year(y) / mdl`.
261
+
262
+ ``` cpp
263
+ constexpr year_month_weekday
264
+ operator/(const year_month& ym, const weekday_indexed& wdi) noexcept;
265
+ ```
266
+
267
+ *Returns:* `{ym.year(), ym.month(), wdi}`.
268
+
269
+ ``` cpp
270
+ constexpr year_month_weekday
271
+ operator/(const year& y, const month_weekday& mwd) noexcept;
272
+ ```
273
+
274
+ *Returns:* `{y, mwd.month(), mwd.weekday_indexed()}`.
275
+
276
+ ``` cpp
277
+ constexpr year_month_weekday
278
+ operator/(int y, const month_weekday& mwd) noexcept;
279
+ ```
280
+
281
+ *Returns:* `year(y) / mwd`.
282
+
283
+ ``` cpp
284
+ constexpr year_month_weekday
285
+ operator/(const month_weekday& mwd, const year& y) noexcept;
286
+ ```
287
+
288
+ *Returns:* `y / mwd`.
289
+
290
+ ``` cpp
291
+ constexpr year_month_weekday
292
+ operator/(const month_weekday& mwd, int y) noexcept;
293
+ ```
294
+
295
+ *Returns:* `year(y) / mwd`.
296
+
297
+ ``` cpp
298
+ constexpr year_month_weekday_last
299
+ operator/(const year_month& ym, const weekday_last& wdl) noexcept;
300
+ ```
301
+
302
+ *Returns:* `{ym.year(), ym.month(), wdl}`.
303
+
304
+ ``` cpp
305
+ constexpr year_month_weekday_last
306
+ operator/(const year& y, const month_weekday_last& mwdl) noexcept;
307
+ ```
308
+
309
+ *Returns:* `{y, mwdl.month(), mwdl.weekday_last()}`.
310
+
311
+ ``` cpp
312
+ constexpr year_month_weekday_last
313
+ operator/(int y, const month_weekday_last& mwdl) noexcept;
314
+ ```
315
+
316
+ *Returns:* `year(y) / mwdl`.
317
+
318
+ ``` cpp
319
+ constexpr year_month_weekday_last
320
+ operator/(const month_weekday_last& mwdl, const year& y) noexcept;
321
+ ```
322
+
323
+ *Returns:* `y / mwdl`.
324
+
325
+ ``` cpp
326
+ constexpr year_month_weekday_last
327
+ operator/(const month_weekday_last& mwdl, int y) noexcept;
328
+ ```
329
+
330
+ *Returns:* `year(y) / mwdl`.
331
+