From Jason Turner

[time.cal.ymd.members]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp4w5ga_ys/{from.md → to.md} +137 -0
tmp/tmp4w5ga_ys/{from.md → to.md} RENAMED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### Member functions <a id="time.cal.ymd.members">[[time.cal.ymd.members]]</a>
2
+
3
+ ``` cpp
4
+ constexpr year_month_day(const chrono::year& y, const chrono::month& m,
5
+ const chrono::day& d) noexcept;
6
+ ```
7
+
8
+ *Effects:* Initializes `y_` with `y`, `m_` with `m`, and `d_` with `d`.
9
+
10
+ ``` cpp
11
+ constexpr year_month_day(const year_month_day_last& ymdl) noexcept;
12
+ ```
13
+
14
+ *Effects:* Initializes `y_` with `ymdl.year()`, `m_` with
15
+ `ymdl.month()`, and `d_` with `ymdl.day()`.
16
+
17
+ [*Note 1*: This conversion from `year_month_day_last` to
18
+ `year_month_day` may be more efficient than converting a
19
+ `year_month_day_last` to a `sys_days`, and then converting that
20
+ `sys_days` to a `year_month_day`. — *end note*]
21
+
22
+ ``` cpp
23
+ constexpr year_month_day(const sys_days& dp) noexcept;
24
+ ```
25
+
26
+ *Effects:* Constructs an object of type `year_month_day` that
27
+ corresponds to the date represented by `dp`.
28
+
29
+ *Remarks:* For any value `ymd` of type `year_month_day` for which
30
+ `ymd.ok()` is `true`, `ymd == year_month_day{sys_days{ymd}}` is `true`.
31
+
32
+ ``` cpp
33
+ constexpr explicit year_month_day(const local_days& dp) noexcept;
34
+ ```
35
+
36
+ *Effects:* Equivalent to constructing with
37
+ `sys_days{dp.time_since_epoch()}`.
38
+
39
+ ``` cpp
40
+ constexpr year_month_day& operator+=(const months& m) noexcept;
41
+ ```
42
+
43
+ *Constraints:* If the argument supplied by the caller for the `months`
44
+ parameter is convertible to `years`, its implicit conversion sequence to
45
+ `years` is worse than its implicit conversion sequence to `months`
46
+ [[over.ics.rank]].
47
+
48
+ *Effects:* `*this = *this + m`.
49
+
50
+ *Returns:* `*this`.
51
+
52
+ ``` cpp
53
+ constexpr year_month_day& operator-=(const months& m) noexcept;
54
+ ```
55
+
56
+ *Constraints:* If the argument supplied by the caller for the `months`
57
+ parameter is convertible to `years`, its implicit conversion sequence to
58
+ `years` is worse than its implicit conversion sequence to `months`
59
+ [[over.ics.rank]].
60
+
61
+ *Effects:* `*this = *this - m`.
62
+
63
+ *Returns:* `*this`.
64
+
65
+ ``` cpp
66
+ constexpr year_month_day& year_month_day::operator+=(const years& y) noexcept;
67
+ ```
68
+
69
+ *Effects:* `*this = *this + y`.
70
+
71
+ *Returns:* `*this`.
72
+
73
+ ``` cpp
74
+ constexpr year_month_day& year_month_day::operator-=(const years& y) noexcept;
75
+ ```
76
+
77
+ *Effects:* `*this = *this - y`.
78
+
79
+ *Returns:* `*this`.
80
+
81
+ ``` cpp
82
+ constexpr chrono::year year() const noexcept;
83
+ ```
84
+
85
+ *Returns:* `y_`.
86
+
87
+ ``` cpp
88
+ constexpr chrono::month month() const noexcept;
89
+ ```
90
+
91
+ *Returns:* `m_`.
92
+
93
+ ``` cpp
94
+ constexpr chrono::day day() const noexcept;
95
+ ```
96
+
97
+ *Returns:* `d_`.
98
+
99
+ ``` cpp
100
+ constexpr operator sys_days() const noexcept;
101
+ ```
102
+
103
+ *Returns:* If `ok()`, returns a `sys_days` holding a count of days from
104
+ the `sys_days` epoch to `*this` (a negative value if `*this` represents
105
+ a date prior to the `sys_days` epoch). Otherwise, if
106
+ `y_.ok() && m_.ok()` is `true`, returns
107
+ `sys_days{y_/m_/1d} + (d_ - 1d)`. Otherwise the value returned is
108
+ unspecified.
109
+
110
+ *Remarks:* A `sys_days` in the range \[`days{-12687428}`,
111
+ `days{11248737}`\] which is converted to a `year_month_day` has the same
112
+ value when converted back to a `sys_days`.
113
+
114
+ [*Example 1*:
115
+
116
+ ``` cpp
117
+ static_assert(year_month_day{sys_days{2017y/January/0}} == 2016y/December/31);
118
+ static_assert(year_month_day{sys_days{2017y/January/31}} == 2017y/January/31);
119
+ static_assert(year_month_day{sys_days{2017y/January/32}} == 2017y/February/1);
120
+ ```
121
+
122
+ — *end example*]
123
+
124
+ ``` cpp
125
+ constexpr explicit operator local_days() const noexcept;
126
+ ```
127
+
128
+ *Returns:* `local_days{sys_days{*this}.time_since_epoch()}`.
129
+
130
+ ``` cpp
131
+ constexpr bool ok() const noexcept;
132
+ ```
133
+
134
+ *Returns:* If `y_.ok()` is `true`, and `m_.ok()` is `true`, and `d_` is
135
+ in the range \[`1d`, `(y_/m_/last).day()`\], then returns `true`;
136
+ otherwise returns `false`.
137
+