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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
### Class `year_month` <a id="time.cal.ym">[[time.cal.ym]]</a>
|
| 2 |
+
|
| 3 |
+
#### Overview <a id="time.cal.ym.overview">[[time.cal.ym.overview]]</a>
|
| 4 |
+
|
| 5 |
+
``` cpp
|
| 6 |
+
namespace std::chrono {
|
| 7 |
+
class year_month {
|
| 8 |
+
chrono::year y_; // exposition only
|
| 9 |
+
chrono::month m_; // exposition only
|
| 10 |
+
|
| 11 |
+
public:
|
| 12 |
+
year_month() = default;
|
| 13 |
+
constexpr year_month(const chrono::year& y, const chrono::month& m) noexcept;
|
| 14 |
+
|
| 15 |
+
constexpr chrono::year year() const noexcept;
|
| 16 |
+
constexpr chrono::month month() const noexcept;
|
| 17 |
+
|
| 18 |
+
constexpr year_month& operator+=(const months& dm) noexcept;
|
| 19 |
+
constexpr year_month& operator-=(const months& dm) noexcept;
|
| 20 |
+
constexpr year_month& operator+=(const years& dy) noexcept;
|
| 21 |
+
constexpr year_month& operator-=(const years& dy) noexcept;
|
| 22 |
+
|
| 23 |
+
constexpr bool ok() const noexcept;
|
| 24 |
+
};
|
| 25 |
+
}
|
| 26 |
+
```
|
| 27 |
+
|
| 28 |
+
`year_month` represents a specific month of a specific year, but with an
|
| 29 |
+
unspecified day. `year_month` is a field-based time point with a
|
| 30 |
+
resolution of `months`. `year_month` meets the *Cpp17EqualityComparable*
|
| 31 |
+
([[cpp17.equalitycomparable]]) and *Cpp17LessThanComparable* (
|
| 32 |
+
[[cpp17.lessthancomparable]]) requirements.
|
| 33 |
+
|
| 34 |
+
`year_month` is a trivially copyable and standard-layout class type.
|
| 35 |
+
|
| 36 |
+
#### Member functions <a id="time.cal.ym.members">[[time.cal.ym.members]]</a>
|
| 37 |
+
|
| 38 |
+
``` cpp
|
| 39 |
+
constexpr year_month(const chrono::year& y, const chrono::month& m) noexcept;
|
| 40 |
+
```
|
| 41 |
+
|
| 42 |
+
*Effects:* Initializes `y_` with `y`, and `m_` with `m`.
|
| 43 |
+
|
| 44 |
+
``` cpp
|
| 45 |
+
constexpr chrono::year year() const noexcept;
|
| 46 |
+
```
|
| 47 |
+
|
| 48 |
+
*Returns:* `y_`.
|
| 49 |
+
|
| 50 |
+
``` cpp
|
| 51 |
+
constexpr chrono::month month() const noexcept;
|
| 52 |
+
```
|
| 53 |
+
|
| 54 |
+
*Returns:* `m_`.
|
| 55 |
+
|
| 56 |
+
``` cpp
|
| 57 |
+
constexpr year_month& operator+=(const months& dm) noexcept;
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
+
*Constraints:* If the argument supplied by the caller for the `months`
|
| 61 |
+
parameter is convertible to `years`, its implicit conversion sequence to
|
| 62 |
+
`years` is worse than its implicit conversion sequence to `months`
|
| 63 |
+
[[over.ics.rank]].
|
| 64 |
+
|
| 65 |
+
*Effects:* `*this = *this + dm`.
|
| 66 |
+
|
| 67 |
+
*Returns:* `*this`.
|
| 68 |
+
|
| 69 |
+
``` cpp
|
| 70 |
+
constexpr year_month& operator-=(const months& dm) noexcept;
|
| 71 |
+
```
|
| 72 |
+
|
| 73 |
+
*Constraints:* If the argument supplied by the caller for the `months`
|
| 74 |
+
parameter is convertible to `years`, its implicit conversion sequence to
|
| 75 |
+
`years` is worse than its implicit conversion sequence to `months`
|
| 76 |
+
[[over.ics.rank]].
|
| 77 |
+
|
| 78 |
+
*Effects:* `*this = *this - dm`.
|
| 79 |
+
|
| 80 |
+
*Returns:* `*this`.
|
| 81 |
+
|
| 82 |
+
``` cpp
|
| 83 |
+
constexpr year_month& operator+=(const years& dy) noexcept;
|
| 84 |
+
```
|
| 85 |
+
|
| 86 |
+
*Effects:* `*this = *this + dy`.
|
| 87 |
+
|
| 88 |
+
*Returns:* `*this`.
|
| 89 |
+
|
| 90 |
+
``` cpp
|
| 91 |
+
constexpr year_month& operator-=(const years& dy) noexcept;
|
| 92 |
+
```
|
| 93 |
+
|
| 94 |
+
*Effects:* `*this = *this - dy`.
|
| 95 |
+
|
| 96 |
+
*Returns:* `*this`.
|
| 97 |
+
|
| 98 |
+
``` cpp
|
| 99 |
+
constexpr bool ok() const noexcept;
|
| 100 |
+
```
|
| 101 |
+
|
| 102 |
+
*Returns:* `y_.ok() && m_.ok()`.
|
| 103 |
+
|
| 104 |
+
#### Non-member functions <a id="time.cal.ym.nonmembers">[[time.cal.ym.nonmembers]]</a>
|
| 105 |
+
|
| 106 |
+
``` cpp
|
| 107 |
+
constexpr bool operator==(const year_month& x, const year_month& y) noexcept;
|
| 108 |
+
```
|
| 109 |
+
|
| 110 |
+
*Returns:* `x.year() == y.year() && x.month() == y.month()`.
|
| 111 |
+
|
| 112 |
+
``` cpp
|
| 113 |
+
constexpr strong_ordering operator<=>(const year_month& x, const year_month& y) noexcept;
|
| 114 |
+
```
|
| 115 |
+
|
| 116 |
+
*Effects:* Equivalent to:
|
| 117 |
+
|
| 118 |
+
``` cpp
|
| 119 |
+
if (auto c = x.year() <=> y.year(); c != 0) return c;
|
| 120 |
+
return x.month() <=> y.month();
|
| 121 |
+
```
|
| 122 |
+
|
| 123 |
+
``` cpp
|
| 124 |
+
constexpr year_month operator+(const year_month& ym, const months& dm) noexcept;
|
| 125 |
+
```
|
| 126 |
+
|
| 127 |
+
*Constraints:* If the argument supplied by the caller for the `months`
|
| 128 |
+
parameter is convertible to `years`, its implicit conversion sequence to
|
| 129 |
+
`years` is worse than its implicit conversion sequence to `months`
|
| 130 |
+
[[over.ics.rank]].
|
| 131 |
+
|
| 132 |
+
*Returns:* A `year_month` value `z` such that `z.ok() && z - ym == dm`
|
| 133 |
+
is `true`.
|
| 134 |
+
|
| 135 |
+
*Complexity:* 𝑂(1) with respect to the value of `dm`.
|
| 136 |
+
|
| 137 |
+
``` cpp
|
| 138 |
+
constexpr year_month operator+(const months& dm, const year_month& ym) noexcept;
|
| 139 |
+
```
|
| 140 |
+
|
| 141 |
+
*Constraints:* If the argument supplied by the caller for the `months`
|
| 142 |
+
parameter is convertible to `years`, its implicit conversion sequence to
|
| 143 |
+
`years` is worse than its implicit conversion sequence to `months`
|
| 144 |
+
[[over.ics.rank]].
|
| 145 |
+
|
| 146 |
+
*Returns:* `ym + dm`.
|
| 147 |
+
|
| 148 |
+
``` cpp
|
| 149 |
+
constexpr year_month operator-(const year_month& ym, const months& dm) noexcept;
|
| 150 |
+
```
|
| 151 |
+
|
| 152 |
+
*Constraints:* If the argument supplied by the caller for the `months`
|
| 153 |
+
parameter is convertible to `years`, its implicit conversion sequence to
|
| 154 |
+
`years` is worse than its implicit conversion sequence to `months`
|
| 155 |
+
[[over.ics.rank]].
|
| 156 |
+
|
| 157 |
+
*Returns:* `ym + -dm`.
|
| 158 |
+
|
| 159 |
+
``` cpp
|
| 160 |
+
constexpr months operator-(const year_month& x, const year_month& y) noexcept;
|
| 161 |
+
```
|
| 162 |
+
|
| 163 |
+
*Returns:*
|
| 164 |
+
|
| 165 |
+
``` cpp
|
| 166 |
+
x.year() - y.year() + months{static_cast<int>(unsigned{x.month()}) -
|
| 167 |
+
static_cast<int>(unsigned{y.month()})}
|
| 168 |
+
```
|
| 169 |
+
|
| 170 |
+
``` cpp
|
| 171 |
+
constexpr year_month operator+(const year_month& ym, const years& dy) noexcept;
|
| 172 |
+
```
|
| 173 |
+
|
| 174 |
+
*Returns:* `(ym.year() + dy) / ym.month()`.
|
| 175 |
+
|
| 176 |
+
``` cpp
|
| 177 |
+
constexpr year_month operator+(const years& dy, const year_month& ym) noexcept;
|
| 178 |
+
```
|
| 179 |
+
|
| 180 |
+
*Returns:* `ym + dy`.
|
| 181 |
+
|
| 182 |
+
``` cpp
|
| 183 |
+
constexpr year_month operator-(const year_month& ym, const years& dy) noexcept;
|
| 184 |
+
```
|
| 185 |
+
|
| 186 |
+
*Returns:* `ym + -dy`.
|
| 187 |
+
|
| 188 |
+
``` cpp
|
| 189 |
+
template<class charT, class traits>
|
| 190 |
+
basic_ostream<charT, traits>&
|
| 191 |
+
operator<<(basic_ostream<charT, traits>& os, const year_month& ym);
|
| 192 |
+
```
|
| 193 |
+
|
| 194 |
+
*Effects:* Equivalent to:
|
| 195 |
+
|
| 196 |
+
``` cpp
|
| 197 |
+
return os << format(os.getloc(), STATICALLY-WIDEN<charT>("{}/{}"),
|
| 198 |
+
ym.year(), ym.month());
|
| 199 |
+
```
|
| 200 |
+
|
| 201 |
+
``` cpp
|
| 202 |
+
template<class charT, class traits, class Alloc = allocator<charT>>
|
| 203 |
+
basic_istream<charT, traits>&
|
| 204 |
+
from_stream(basic_istream<charT, traits>& is, const charT* fmt,
|
| 205 |
+
year_month& ym, basic_string<charT, traits, Alloc>* abbrev = nullptr,
|
| 206 |
+
minutes* offset = nullptr);
|
| 207 |
+
```
|
| 208 |
+
|
| 209 |
+
*Effects:* Attempts to parse the input stream `is` into the `year_month`
|
| 210 |
+
`ym` using the format flags given in the NTCTS `fmt` as specified in
|
| 211 |
+
[[time.parse]]. If the parse fails to decode a valid `year_month`,
|
| 212 |
+
`is.setstate(ios_base::failbit)` is called and `ym` is not modified. If
|
| 213 |
+
`%Z` is used and successfully parsed, that value will be assigned to
|
| 214 |
+
`*abbrev` if `abbrev` is non-null. If `%z` (or a modified variant) is
|
| 215 |
+
used and successfully parsed, that value will be assigned to `*offset`
|
| 216 |
+
if `offset` is non-null.
|
| 217 |
+
|
| 218 |
+
*Returns:* `is`.
|
| 219 |
+
|