From Jason Turner

[time.cal.ymwdlast]

Diff to HTML by rtfpessoa

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