From Jason Turner

[time.cal.day]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpw83pixr4/{from.md → to.md} +185 -0
tmp/tmpw83pixr4/{from.md → to.md} RENAMED
@@ -0,0 +1,185 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### Class `day` <a id="time.cal.day">[[time.cal.day]]</a>
2
+
3
+ #### Overview <a id="time.cal.day.overview">[[time.cal.day.overview]]</a>
4
+
5
+ ``` cpp
6
+ namespace std::chrono {
7
+ class day {
8
+ unsigned char d_; // exposition only
9
+ public:
10
+ day() = default;
11
+ constexpr explicit day(unsigned d) noexcept;
12
+
13
+ constexpr day& operator++() noexcept;
14
+ constexpr day operator++(int) noexcept;
15
+ constexpr day& operator--() noexcept;
16
+ constexpr day operator--(int) noexcept;
17
+
18
+ constexpr day& operator+=(const days& d) noexcept;
19
+ constexpr day& operator-=(const days& d) noexcept;
20
+
21
+ constexpr explicit operator unsigned() const noexcept;
22
+ constexpr bool ok() const noexcept;
23
+ };
24
+ }
25
+ ```
26
+
27
+ `day` represents a day of a month. It normally holds values in the range
28
+ 1 to 31, but may hold non-negative values outside this range. It can be
29
+ constructed with any `unsigned` value, which will be subsequently
30
+ truncated to fit into `day`’s unspecified internal storage. `day` meets
31
+ the *Cpp17EqualityComparable* ([[cpp17.equalitycomparable]]) and
32
+ *Cpp17LessThanComparable* ([[cpp17.lessthancomparable]]) requirements,
33
+ and participates in basic arithmetic with `days` objects, which
34
+ represent a difference between two `day` objects.
35
+
36
+ `day` is a trivially copyable and standard-layout class type.
37
+
38
+ #### Member functions <a id="time.cal.day.members">[[time.cal.day.members]]</a>
39
+
40
+ ``` cpp
41
+ constexpr explicit day(unsigned d) noexcept;
42
+ ```
43
+
44
+ *Effects:* Initializes `d_` with `d`. The value held is unspecified if
45
+ `d` is not in the range \[`0`, `255`\].
46
+
47
+ ``` cpp
48
+ constexpr day& operator++() noexcept;
49
+ ```
50
+
51
+ *Effects:* `++d_`.
52
+
53
+ *Returns:* `*this`.
54
+
55
+ ``` cpp
56
+ constexpr day operator++(int) noexcept;
57
+ ```
58
+
59
+ *Effects:* `++(*this)`.
60
+
61
+ *Returns:* A copy of `*this` as it existed on entry to this member
62
+ function.
63
+
64
+ ``` cpp
65
+ constexpr day& operator--() noexcept;
66
+ ```
67
+
68
+ *Effects:* Equivalent to: `–d_`.
69
+
70
+ *Returns:* `*this`.
71
+
72
+ ``` cpp
73
+ constexpr day operator--(int) noexcept;
74
+ ```
75
+
76
+ *Effects:* `–(*this)`.
77
+
78
+ *Returns:* A copy of `*this` as it existed on entry to this member
79
+ function.
80
+
81
+ ``` cpp
82
+ constexpr day& operator+=(const days& d) noexcept;
83
+ ```
84
+
85
+ *Effects:* `*this = *this + d`.
86
+
87
+ *Returns:* `*this`.
88
+
89
+ ``` cpp
90
+ constexpr day& operator-=(const days& d) noexcept;
91
+ ```
92
+
93
+ *Effects:* `*this = *this - d`.
94
+
95
+ *Returns:* `*this`.
96
+
97
+ ``` cpp
98
+ constexpr explicit operator unsigned() const noexcept;
99
+ ```
100
+
101
+ *Returns:* `d_`.
102
+
103
+ ``` cpp
104
+ constexpr bool ok() const noexcept;
105
+ ```
106
+
107
+ *Returns:* `1 <= d_ && d_ <= 31`.
108
+
109
+ #### Non-member functions <a id="time.cal.day.nonmembers">[[time.cal.day.nonmembers]]</a>
110
+
111
+ ``` cpp
112
+ constexpr bool operator==(const day& x, const day& y) noexcept;
113
+ ```
114
+
115
+ *Returns:* `unsigned{x} == unsigned{y}`.
116
+
117
+ ``` cpp
118
+ constexpr strong_ordering operator<=>(const day& x, const day& y) noexcept;
119
+ ```
120
+
121
+ *Returns:* `unsigned{x} <=> unsigned{y}`.
122
+
123
+ ``` cpp
124
+ constexpr day operator+(const day& x, const days& y) noexcept;
125
+ ```
126
+
127
+ *Returns:* `day(unsigned{x} + y.count())`.
128
+
129
+ ``` cpp
130
+ constexpr day operator+(const days& x, const day& y) noexcept;
131
+ ```
132
+
133
+ *Returns:* `y + x`.
134
+
135
+ ``` cpp
136
+ constexpr day operator-(const day& x, const days& y) noexcept;
137
+ ```
138
+
139
+ *Returns:* `x + -y`.
140
+
141
+ ``` cpp
142
+ constexpr days operator-(const day& x, const day& y) noexcept;
143
+ ```
144
+
145
+ *Returns:* `days{int(unsigned{x}) - int(unsigned{y})}`.
146
+
147
+ ``` cpp
148
+ template<class charT, class traits>
149
+ basic_ostream<charT, traits>&
150
+ operator<<(basic_ostream<charT, traits>& os, const day& d);
151
+ ```
152
+
153
+ *Effects:* Equivalent to:
154
+
155
+ ``` cpp
156
+ return os << (d.ok() ?
157
+ format(STATICALLY-WIDEN<charT>("{:%d}"), d) :
158
+ format(STATICALLY-WIDEN<charT>("{:%d} is not a valid day"), d));
159
+ ```
160
+
161
+ ``` cpp
162
+ template<class charT, class traits, class Alloc = allocator<charT>>
163
+ basic_istream<charT, traits>&
164
+ from_stream(basic_istream<charT, traits>& is, const charT* fmt,
165
+ day& d, basic_string<charT, traits, Alloc>* abbrev = nullptr,
166
+ minutes* offset = nullptr);
167
+ ```
168
+
169
+ *Effects:* Attempts to parse the input stream `is` into the `day` `d`
170
+ using the format flags given in the NTCTS `fmt` as specified in
171
+ [[time.parse]]. If the parse fails to decode a valid day,
172
+ `is.setstate(ios_base::failbit)` is called and `d` is not modified. If
173
+ `%Z` is used and successfully parsed, that value will be assigned to
174
+ `*abbrev` if `abbrev` is non-null. If `%z` (or a modified variant) is
175
+ used and successfully parsed, that value will be assigned to `*offset`
176
+ if `offset` is non-null.
177
+
178
+ *Returns:* `is`.
179
+
180
+ ``` cpp
181
+ constexpr chrono::day operator""d(unsigned long long d) noexcept;
182
+ ```
183
+
184
+ *Returns:* `day{static_cast<unsigned>(d)}`.
185
+