From Jason Turner

[time.cal.ymd.nonmembers]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp433_jt3a/{from.md → to.md} +112 -0
tmp/tmp433_jt3a/{from.md → to.md} RENAMED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### Non-member functions <a id="time.cal.ymd.nonmembers">[[time.cal.ymd.nonmembers]]</a>
2
+
3
+ ``` cpp
4
+ constexpr bool operator==(const year_month_day& x, const year_month_day& y) noexcept;
5
+ ```
6
+
7
+ *Returns:*
8
+ `x.year() == y.year() && x.month() == y.month() && x.day() == y.day()`.
9
+
10
+ ``` cpp
11
+ constexpr strong_ordering operator<=>(const year_month_day& x, const year_month_day& y) noexcept;
12
+ ```
13
+
14
+ *Effects:* Equivalent to:
15
+
16
+ ``` cpp
17
+ if (auto c = x.year() <=> y.year(); c != 0) return c;
18
+ if (auto c = x.month() <=> y.month(); c != 0) return c;
19
+ return x.day() <=> y.day();
20
+ ```
21
+
22
+ ``` cpp
23
+ constexpr year_month_day operator+(const year_month_day& ymd, const months& dm) noexcept;
24
+ ```
25
+
26
+ *Constraints:* If the argument supplied by the caller for the `months`
27
+ parameter is convertible to `years`, its implicit conversion sequence to
28
+ `years` is worse than its implicit conversion sequence to `months`
29
+ [[over.ics.rank]].
30
+
31
+ *Returns:* `(ymd.year() / ymd.month() + dm) / ymd.day()`.
32
+
33
+ [*Note 1*: If `ymd.day()` is in the range \[`1d`, `28d`\], `ok()` will
34
+ return `true` for the resultant `year_month_day`. — *end note*]
35
+
36
+ ``` cpp
37
+ constexpr year_month_day operator+(const months& dm, const year_month_day& ymd) noexcept;
38
+ ```
39
+
40
+ *Constraints:* If the argument supplied by the caller for the `months`
41
+ parameter is convertible to `years`, its implicit conversion sequence to
42
+ `years` is worse than its implicit conversion sequence to `months`
43
+ [[over.ics.rank]].
44
+
45
+ *Returns:* `ymd + dm`.
46
+
47
+ ``` cpp
48
+ constexpr year_month_day operator-(const year_month_day& ymd, const months& dm) noexcept;
49
+ ```
50
+
51
+ *Constraints:* If the argument supplied by the caller for the `months`
52
+ parameter is convertible to `years`, its implicit conversion sequence to
53
+ `years` is worse than its implicit conversion sequence to `months`
54
+ [[over.ics.rank]].
55
+
56
+ *Returns:* `ymd + (-dm)`.
57
+
58
+ ``` cpp
59
+ constexpr year_month_day operator+(const year_month_day& ymd, const years& dy) noexcept;
60
+ ```
61
+
62
+ *Returns:* `(ymd.year() + dy) / ymd.month() / ymd.day()`.
63
+
64
+ [*Note 2*: If `ymd.month()` is February and `ymd.day()` is not in the
65
+ range \[`1d`, `28d`\], `ok()` may return `false` for the resultant
66
+ `year_month_day`. — *end note*]
67
+
68
+ ``` cpp
69
+ constexpr year_month_day operator+(const years& dy, const year_month_day& ymd) noexcept;
70
+ ```
71
+
72
+ *Returns:* `ymd + dy`.
73
+
74
+ ``` cpp
75
+ constexpr year_month_day operator-(const year_month_day& ymd, const years& dy) noexcept;
76
+ ```
77
+
78
+ *Returns:* `ymd + (-dy)`.
79
+
80
+ ``` cpp
81
+ template<class charT, class traits>
82
+ basic_ostream<charT, traits>&
83
+ operator<<(basic_ostream<charT, traits>& os, const year_month_day& ymd);
84
+ ```
85
+
86
+ *Effects:* Equivalent to:
87
+
88
+ ``` cpp
89
+ return os << (ymd.ok() ?
90
+ format(STATICALLY-WIDEN<charT>("{:%F}"), ymd) :
91
+ format(STATICALLY-WIDEN<charT>("{:%F} is not a valid date"), ymd));
92
+ ```
93
+
94
+ ``` cpp
95
+ template<class charT, class traits, class Alloc = allocator<charT>>
96
+ basic_istream<charT, traits>&
97
+ from_stream(basic_istream<charT, traits>& is, const charT* fmt,
98
+ year_month_day& ymd, basic_string<charT, traits, Alloc>* abbrev = nullptr,
99
+ minutes* offset = nullptr);
100
+ ```
101
+
102
+ *Effects:* Attempts to parse the input stream `is` into the
103
+ `year_month_day` `ymd` using the format flags given in the NTCTS `fmt`
104
+ as specified in [[time.parse]]. If the parse fails to decode a valid
105
+ `year_month_day`, `is.setstate(ios_base::failbit)` is called and `ymd`
106
+ is not modified. If `%Z` is used and successfully parsed, that value
107
+ will be assigned to `*abbrev` if `abbrev` is non-null. If `%z` (or a
108
+ modified variant) is used and successfully parsed, that value will be
109
+ assigned to `*offset` if `offset` is non-null.
110
+
111
+ *Returns:* `is`.
112
+