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