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