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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
### Class `weekday` <a id="time.cal.wd">[[time.cal.wd]]</a>
|
| 2 |
+
|
| 3 |
+
#### Overview <a id="time.cal.wd.overview">[[time.cal.wd.overview]]</a>
|
| 4 |
+
|
| 5 |
+
``` cpp
|
| 6 |
+
namespace std::chrono {
|
| 7 |
+
class weekday {
|
| 8 |
+
unsigned char wd_; // exposition only
|
| 9 |
+
public:
|
| 10 |
+
weekday() = default;
|
| 11 |
+
constexpr explicit weekday(unsigned wd) noexcept;
|
| 12 |
+
constexpr weekday(const sys_days& dp) noexcept;
|
| 13 |
+
constexpr explicit weekday(const local_days& dp) noexcept;
|
| 14 |
+
|
| 15 |
+
constexpr weekday& operator++() noexcept;
|
| 16 |
+
constexpr weekday operator++(int) noexcept;
|
| 17 |
+
constexpr weekday& operator--() noexcept;
|
| 18 |
+
constexpr weekday operator--(int) noexcept;
|
| 19 |
+
|
| 20 |
+
constexpr weekday& operator+=(const days& d) noexcept;
|
| 21 |
+
constexpr weekday& operator-=(const days& d) noexcept;
|
| 22 |
+
|
| 23 |
+
constexpr unsigned c_encoding() const noexcept;
|
| 24 |
+
constexpr unsigned iso_encoding() const noexcept;
|
| 25 |
+
constexpr bool ok() const noexcept;
|
| 26 |
+
|
| 27 |
+
constexpr weekday_indexed operator[](unsigned index) const noexcept;
|
| 28 |
+
constexpr weekday_last operator[](last_spec) const noexcept;
|
| 29 |
+
};
|
| 30 |
+
}
|
| 31 |
+
```
|
| 32 |
+
|
| 33 |
+
`weekday` represents a day of the week in the civil calendar. It
|
| 34 |
+
normally holds values in the range `0` to `6`, corresponding to Sunday
|
| 35 |
+
through Saturday, but it may hold non-negative values outside this
|
| 36 |
+
range. It can be constructed with any `unsigned` value, which will be
|
| 37 |
+
subsequently truncated to fit into `weekday`’s unspecified internal
|
| 38 |
+
storage. `weekday` meets the *Cpp17EqualityComparable* (
|
| 39 |
+
[[cpp17.equalitycomparable]]) requirements.
|
| 40 |
+
|
| 41 |
+
[*Note 1*: `weekday` is not *Cpp17LessThanComparable* because there is
|
| 42 |
+
no universal consensus on which day is the first day of the week.
|
| 43 |
+
`weekday`’s arithmetic operations treat the days of the week as a
|
| 44 |
+
circular range, with no beginning and no end. — *end note*]
|
| 45 |
+
|
| 46 |
+
`weekday` is a trivially copyable and standard-layout class type.
|
| 47 |
+
|
| 48 |
+
#### Member functions <a id="time.cal.wd.members">[[time.cal.wd.members]]</a>
|
| 49 |
+
|
| 50 |
+
``` cpp
|
| 51 |
+
constexpr explicit weekday(unsigned wd) noexcept;
|
| 52 |
+
```
|
| 53 |
+
|
| 54 |
+
*Effects:* Initializes `wd_` with `wd == 7 ? 0 : wd`. The value held is
|
| 55 |
+
unspecified if `wd` is not in the range \[`0`, `255`\].
|
| 56 |
+
|
| 57 |
+
``` cpp
|
| 58 |
+
constexpr weekday(const sys_days& dp) noexcept;
|
| 59 |
+
```
|
| 60 |
+
|
| 61 |
+
*Effects:* Computes what day of the week corresponds to the `sys_days`
|
| 62 |
+
`dp`, and initializes that day of the week in `wd_`.
|
| 63 |
+
|
| 64 |
+
[*Example 1*: If `dp` represents 1970-01-01, the constructed `weekday`
|
| 65 |
+
represents Thursday by storing `4` in `wd_`. — *end example*]
|
| 66 |
+
|
| 67 |
+
``` cpp
|
| 68 |
+
constexpr explicit weekday(const local_days& dp) noexcept;
|
| 69 |
+
```
|
| 70 |
+
|
| 71 |
+
*Effects:* Computes what day of the week corresponds to the `local_days`
|
| 72 |
+
`dp`, and initializes that day of the week in `wd_`.
|
| 73 |
+
|
| 74 |
+
*Ensures:* The value is identical to that constructed from
|
| 75 |
+
`sys_days{dp.time_since_epoch()}`.
|
| 76 |
+
|
| 77 |
+
``` cpp
|
| 78 |
+
constexpr weekday& operator++() noexcept;
|
| 79 |
+
```
|
| 80 |
+
|
| 81 |
+
*Effects:* `*this += days{1}`.
|
| 82 |
+
|
| 83 |
+
*Returns:* `*this`.
|
| 84 |
+
|
| 85 |
+
``` cpp
|
| 86 |
+
constexpr weekday operator++(int) noexcept;
|
| 87 |
+
```
|
| 88 |
+
|
| 89 |
+
*Effects:* `++(*this)`.
|
| 90 |
+
|
| 91 |
+
*Returns:* A copy of `*this` as it existed on entry to this member
|
| 92 |
+
function.
|
| 93 |
+
|
| 94 |
+
``` cpp
|
| 95 |
+
constexpr weekday& operator--() noexcept;
|
| 96 |
+
```
|
| 97 |
+
|
| 98 |
+
*Effects:* `*this -= days{1}`.
|
| 99 |
+
|
| 100 |
+
*Returns:* `*this`.
|
| 101 |
+
|
| 102 |
+
``` cpp
|
| 103 |
+
constexpr weekday operator--(int) noexcept;
|
| 104 |
+
```
|
| 105 |
+
|
| 106 |
+
*Effects:* `–(*this)`.
|
| 107 |
+
|
| 108 |
+
*Returns:* A copy of `*this` as it existed on entry to this member
|
| 109 |
+
function.
|
| 110 |
+
|
| 111 |
+
``` cpp
|
| 112 |
+
constexpr weekday& operator+=(const days& d) noexcept;
|
| 113 |
+
```
|
| 114 |
+
|
| 115 |
+
*Effects:* `*this = *this + d`.
|
| 116 |
+
|
| 117 |
+
*Returns:* `*this`.
|
| 118 |
+
|
| 119 |
+
``` cpp
|
| 120 |
+
constexpr weekday& operator-=(const days& d) noexcept;
|
| 121 |
+
```
|
| 122 |
+
|
| 123 |
+
*Effects:* `*this = *this - d`.
|
| 124 |
+
|
| 125 |
+
*Returns:* `*this`.
|
| 126 |
+
|
| 127 |
+
``` cpp
|
| 128 |
+
constexpr unsigned c_encoding() const noexcept;
|
| 129 |
+
```
|
| 130 |
+
|
| 131 |
+
*Returns:* `wd_`.
|
| 132 |
+
|
| 133 |
+
``` cpp
|
| 134 |
+
constexpr unsigned iso_encoding() const noexcept;
|
| 135 |
+
```
|
| 136 |
+
|
| 137 |
+
*Returns:* `wd_ == 0u ? 7u : wd_`.
|
| 138 |
+
|
| 139 |
+
``` cpp
|
| 140 |
+
constexpr bool ok() const noexcept;
|
| 141 |
+
```
|
| 142 |
+
|
| 143 |
+
*Returns:* `wd_ <= 6`.
|
| 144 |
+
|
| 145 |
+
``` cpp
|
| 146 |
+
constexpr weekday_indexed operator[](unsigned index) const noexcept;
|
| 147 |
+
```
|
| 148 |
+
|
| 149 |
+
*Returns:* `{*this, index}`.
|
| 150 |
+
|
| 151 |
+
``` cpp
|
| 152 |
+
constexpr weekday_last operator[](last_spec) const noexcept;
|
| 153 |
+
```
|
| 154 |
+
|
| 155 |
+
*Returns:* `weekday_last{*this}`.
|
| 156 |
+
|
| 157 |
+
#### Non-member functions <a id="time.cal.wd.nonmembers">[[time.cal.wd.nonmembers]]</a>
|
| 158 |
+
|
| 159 |
+
``` cpp
|
| 160 |
+
constexpr bool operator==(const weekday& x, const weekday& y) noexcept;
|
| 161 |
+
```
|
| 162 |
+
|
| 163 |
+
*Returns:* `x.wd_ == y.wd_`.
|
| 164 |
+
|
| 165 |
+
``` cpp
|
| 166 |
+
constexpr weekday operator+(const weekday& x, const days& y) noexcept;
|
| 167 |
+
```
|
| 168 |
+
|
| 169 |
+
*Returns:*
|
| 170 |
+
|
| 171 |
+
``` cpp
|
| 172 |
+
weekday{modulo(static_cast<long long>(x.wd_) + y.count(), 7)}
|
| 173 |
+
```
|
| 174 |
+
|
| 175 |
+
where `modulo(n, 7)` computes the remainder of `n` divided by 7 using
|
| 176 |
+
Euclidean division.
|
| 177 |
+
|
| 178 |
+
[*Note 1*: Given a divisor of 7, Euclidean division truncates towards
|
| 179 |
+
negative infinity and always produces a remainder in the range of \[`0`,
|
| 180 |
+
`6`\]. Assuming no overflow in the signed summation, this operation
|
| 181 |
+
results in a `weekday` holding a value in the range \[`0`, `6`\] even if
|
| 182 |
+
`!x.ok()`. — *end note*]
|
| 183 |
+
|
| 184 |
+
[*Example 1*: `Monday + days{6} == Sunday`. — *end example*]
|
| 185 |
+
|
| 186 |
+
``` cpp
|
| 187 |
+
constexpr weekday operator+(const days& x, const weekday& y) noexcept;
|
| 188 |
+
```
|
| 189 |
+
|
| 190 |
+
*Returns:* `y + x`.
|
| 191 |
+
|
| 192 |
+
``` cpp
|
| 193 |
+
constexpr weekday operator-(const weekday& x, const days& y) noexcept;
|
| 194 |
+
```
|
| 195 |
+
|
| 196 |
+
*Returns:* `x + -y`.
|
| 197 |
+
|
| 198 |
+
``` cpp
|
| 199 |
+
constexpr days operator-(const weekday& x, const weekday& y) noexcept;
|
| 200 |
+
```
|
| 201 |
+
|
| 202 |
+
*Returns:* If `x.ok() == true` and `y.ok() == true`, returns a value `d`
|
| 203 |
+
in the range \[`days{0}`, `days{6}`\] satisfying `y + d == x`. Otherwise
|
| 204 |
+
the value returned is unspecified.
|
| 205 |
+
|
| 206 |
+
[*Example 2*: `Sunday - Monday == days{6}`. — *end example*]
|
| 207 |
+
|
| 208 |
+
``` cpp
|
| 209 |
+
template<class charT, class traits>
|
| 210 |
+
basic_ostream<charT, traits>&
|
| 211 |
+
operator<<(basic_ostream<charT, traits>& os, const weekday& wd);
|
| 212 |
+
```
|
| 213 |
+
|
| 214 |
+
*Effects:* Equivalent to:
|
| 215 |
+
|
| 216 |
+
``` cpp
|
| 217 |
+
return os << (wd.ok() ?
|
| 218 |
+
format(os.getloc(), STATICALLY-WIDEN<charT>("{:%a}"), wd) :
|
| 219 |
+
format(os.getloc(), STATICALLY-WIDEN<charT>("{} is not a valid weekday"),
|
| 220 |
+
static_cast<unsigned>(wd.wd_)));
|
| 221 |
+
```
|
| 222 |
+
|
| 223 |
+
``` cpp
|
| 224 |
+
template<class charT, class traits, class Alloc = allocator<charT>>
|
| 225 |
+
basic_istream<charT, traits>&
|
| 226 |
+
from_stream(basic_istream<charT, traits>& is, const charT* fmt,
|
| 227 |
+
weekday& wd, basic_string<charT, traits, Alloc>* abbrev = nullptr,
|
| 228 |
+
minutes* offset = nullptr);
|
| 229 |
+
```
|
| 230 |
+
|
| 231 |
+
*Effects:* Attempts to parse the input stream `is` into the `weekday`
|
| 232 |
+
`wd` using the format flags given in the NTCTS `fmt` as specified in
|
| 233 |
+
[[time.parse]]. If the parse fails to decode a valid weekday,
|
| 234 |
+
`is.setstate(ios_base::failbit)` is called and `wd` is not modified. If
|
| 235 |
+
`%Z` is used and successfully parsed, that value will be assigned to
|
| 236 |
+
`*abbrev` if `abbrev` is non-null. If `%z` (or a modified variant) is
|
| 237 |
+
used and successfully parsed, that value will be assigned to `*offset`
|
| 238 |
+
if `offset` is non-null.
|
| 239 |
+
|
| 240 |
+
*Returns:* `is`.
|
| 241 |
+
|