From Jason Turner

[time.cal.md]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp2fgembx0/{from.md → to.md} +108 -0
tmp/tmp2fgembx0/{from.md → to.md} RENAMED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### Class `month_day` <a id="time.cal.md">[[time.cal.md]]</a>
2
+
3
+ #### Overview <a id="time.cal.md.overview">[[time.cal.md.overview]]</a>
4
+
5
+ ``` cpp
6
+ namespace std::chrono {
7
+ class month_day {
8
+ chrono::month m_; // exposition only
9
+ chrono::day d_; // exposition only
10
+
11
+ public:
12
+ month_day() = default;
13
+ constexpr month_day(const chrono::month& m, const chrono::day& d) noexcept;
14
+
15
+ constexpr chrono::month month() const noexcept;
16
+ constexpr chrono::day day() const noexcept;
17
+ constexpr bool ok() const noexcept;
18
+ };
19
+ }
20
+ ```
21
+
22
+ `month_day` represents a specific day of a specific month, but with an
23
+ unspecified year. `month_day` meets the *Cpp17EqualityComparable* (
24
+ [[cpp17.equalitycomparable]]) and *Cpp17LessThanComparable* (
25
+ [[cpp17.lessthancomparable]]) requirements.
26
+
27
+ `month_day` is a trivially copyable and standard-layout class type.
28
+
29
+ #### Member functions <a id="time.cal.md.members">[[time.cal.md.members]]</a>
30
+
31
+ ``` cpp
32
+ constexpr month_day(const chrono::month& m, const chrono::day& d) noexcept;
33
+ ```
34
+
35
+ *Effects:* Initializes `m_` with `m`, and `d_` with `d`.
36
+
37
+ ``` cpp
38
+ constexpr chrono::month month() const noexcept;
39
+ ```
40
+
41
+ *Returns:* `m_`.
42
+
43
+ ``` cpp
44
+ constexpr chrono::day day() const noexcept;
45
+ ```
46
+
47
+ *Returns:* `d_`.
48
+
49
+ ``` cpp
50
+ constexpr bool ok() const noexcept;
51
+ ```
52
+
53
+ *Returns:* `true` if `m_.ok()` is `true`, `1d <= d_`, and `d_` is less
54
+ than or equal to the number of days in month `m_`; otherwise returns
55
+ `false`. When `m_ == February`, the number of days is considered to be
56
+ 29.
57
+
58
+ #### Non-member functions <a id="time.cal.md.nonmembers">[[time.cal.md.nonmembers]]</a>
59
+
60
+ ``` cpp
61
+ constexpr bool operator==(const month_day& x, const month_day& y) noexcept;
62
+ ```
63
+
64
+ *Returns:* `x.month() == y.month() && x.day() == y.day()`.
65
+
66
+ ``` cpp
67
+ constexpr strong_ordering operator<=>(const month_day& x, const month_day& y) noexcept;
68
+ ```
69
+
70
+ *Effects:* Equivalent to:
71
+
72
+ ``` cpp
73
+ if (auto c = x.month() <=> y.month(); c != 0) return c;
74
+ return x.day() <=> y.day();
75
+ ```
76
+
77
+ ``` cpp
78
+ template<class charT, class traits>
79
+ basic_ostream<charT, traits>&
80
+ operator<<(basic_ostream<charT, traits>& os, const month_day& md);
81
+ ```
82
+
83
+ *Effects:* Equivalent to:
84
+
85
+ ``` cpp
86
+ return os << format(os.getloc(), STATICALLY-WIDEN<charT>("{}/{}"),
87
+ md.month(), md.day());
88
+ ```
89
+
90
+ ``` cpp
91
+ template<class charT, class traits, class Alloc = allocator<charT>>
92
+ basic_istream<charT, traits>&
93
+ from_stream(basic_istream<charT, traits>& is, const charT* fmt,
94
+ month_day& md, basic_string<charT, traits, Alloc>* abbrev = nullptr,
95
+ minutes* offset = nullptr);
96
+ ```
97
+
98
+ *Effects:* Attempts to parse the input stream `is` into the `month_day`
99
+ `md` using the format flags given in the NTCTS `fmt` as specified in
100
+ [[time.parse]]. If the parse fails to decode a valid `month_day`,
101
+ `is.setstate(ios_base::failbit)` is called and `md` is not modified. If
102
+ `%Z` is used and successfully parsed, that value will be assigned to
103
+ `*abbrev` if `abbrev` is non-null. If `%z` (or a modified variant) is
104
+ used and successfully parsed, that value will be assigned to `*offset`
105
+ if `offset` is non-null.
106
+
107
+ *Returns:* `is`.
108
+