From Jason Turner

[time.cal.month.nonmembers]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpo2uj2erp/{from.md → to.md} +91 -0
tmp/tmpo2uj2erp/{from.md → to.md} RENAMED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### Non-member functions <a id="time.cal.month.nonmembers">[[time.cal.month.nonmembers]]</a>
2
+
3
+ ``` cpp
4
+ constexpr bool operator==(const month& x, const month& y) noexcept;
5
+ ```
6
+
7
+ *Returns:* `unsigned{x} == unsigned{y}`.
8
+
9
+ ``` cpp
10
+ constexpr strong_ordering operator<=>(const month& x, const month& y) noexcept;
11
+ ```
12
+
13
+ *Returns:* `unsigned{x} <=> unsigned{y}`.
14
+
15
+ ``` cpp
16
+ constexpr month operator+(const month& x, const months& y) noexcept;
17
+ ```
18
+
19
+ *Returns:*
20
+
21
+ ``` cpp
22
+ month{modulo(static_cast<long long>(unsigned{x}) + (y.count() - 1), 12) + 1}
23
+ ```
24
+
25
+ where `modulo(n, 12)` computes the remainder of `n` divided by 12 using
26
+ Euclidean division.
27
+
28
+ [*Note 1*: Given a divisor of 12, Euclidean division truncates towards
29
+ negative infinity and always produces a remainder in the range of \[`0`,
30
+ `11`\]. Assuming no overflow in the signed summation, this operation
31
+ results in a `month` holding a value in the range \[`1`, `12`\] even if
32
+ `!x.ok()`. — *end note*]
33
+
34
+ [*Example 1*: `February + months{11} == January`. — *end example*]
35
+
36
+ ``` cpp
37
+ constexpr month operator+(const months& x, const month& y) noexcept;
38
+ ```
39
+
40
+ *Returns:* `y + x`.
41
+
42
+ ``` cpp
43
+ constexpr month operator-(const month& x, const months& y) noexcept;
44
+ ```
45
+
46
+ *Returns:* `x + -y`.
47
+
48
+ ``` cpp
49
+ constexpr months operator-(const month& x, const month& y) noexcept;
50
+ ```
51
+
52
+ *Returns:* If `x.ok() == true` and `y.ok() == true`, returns a value `m`
53
+ in the range \[`months{0}`, `months{11}`\] satisfying `y + m == x`.
54
+ Otherwise the value returned is unspecified.
55
+
56
+ [*Example 2*: `January - February == months{11}`. — *end example*]
57
+
58
+ ``` cpp
59
+ template<class charT, class traits>
60
+ basic_ostream<charT, traits>&
61
+ operator<<(basic_ostream<charT, traits>& os, const month& m);
62
+ ```
63
+
64
+ *Effects:* Equivalent to:
65
+
66
+ ``` cpp
67
+ return os << (m.ok() ?
68
+ format(os.getloc(), STATICALLY-WIDEN<charT>("{:%b}"), m) :
69
+ format(os.getloc(), STATICALLY-WIDEN<charT>("{} is not a valid month"),
70
+ static_cast<unsigned>(m)));
71
+ ```
72
+
73
+ ``` cpp
74
+ template<class charT, class traits, class Alloc = allocator<charT>>
75
+ basic_istream<charT, traits>&
76
+ from_stream(basic_istream<charT, traits>& is, const charT* fmt,
77
+ month& m, basic_string<charT, traits, Alloc>* abbrev = nullptr,
78
+ minutes* offset = nullptr);
79
+ ```
80
+
81
+ *Effects:* Attempts to parse the input stream `is` into the `month` `m`
82
+ using the format flags given in the NTCTS `fmt` as specified in
83
+ [[time.parse]]. If the parse fails to decode a valid month,
84
+ `is.setstate(ios_base::failbit)` is called and `m` is not modified. If
85
+ `%Z` is used and successfully parsed, that value will be assigned to
86
+ `*abbrev` if `abbrev` is non-null. If `%z` (or a modified variant) is
87
+ used and successfully parsed, that value will be assigned to `*offset`
88
+ if `offset` is non-null.
89
+
90
+ *Returns:* `is`.
91
+