From Jason Turner

[time.cal.wd.nonmembers]

Diff to HTML by rtfpessoa

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