Skip to content

Commit 017c4ef

Browse files
authored
Merge pull request #3635 from MicrosoftDocs/master
6/28/2021 AM Publish
2 parents cd37cd0 + 29be4c8 commit 017c4ef

19 files changed

+1360
-170
lines changed

docs/sanitizers/asan-error-examples.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Each error example provides source code and compilation instructions for a comma
2424

2525
- [Error: `dynamic-stack-buffer-overflow`](./error-dynamic-stack-buffer-overflow.md)
2626

27-
- [Error: `global-overflow`](./error-global-buffer-overflow.md)
27+
- [Error: `global-buffer-overflow`](./error-global-buffer-overflow.md)
2828

2929
- [Error: `heap-buffer-overflow`](./error-heap-buffer-overflow.md)
3030

docs/standard-library/chrono-functions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
description: "Learn more about: <chrono> functions"
33
title: "<chrono> functions"
44
ms.date: 6/16/2021
5-
f1_keywords: ["chrono/std::duration_cast", "chrono/std::time_point_cast", "chrono/std::from_stream", "chrono/std::chrono::duration_cast", "chrono/std::chrono::time_point_cast", "chrono/std::chrono::from_stream", "chrono/std::chrono::floor", "chrono/std::chrono::ceil", "chrono/std::chrono::round", "chrono/std::chrono::is_am", "chrono/std::chrono::is_pm", "chrono/std::chrono::make12", "chrono/std::chrono::make24", "chrono/std::chrono::get_leap_second_info", "chrono/std::chrono::get_tzdb", "chrono/std::chrono::get_tzdb_list", "chrono/std::chrono::locate_zone", "chrono/std::chrono::current_zone", "chrono/std::chrono::reload_tzdb", "chrono/std::chrono::remote_version"]
5+
f1_keywords: ["chrono/std::duration_cast", "chrono/std::time_point_cast", "chrono/std::chrono::duration_cast", "chrono/std::chrono::time_point_cast", "chrono/std::chrono::from_stream", "chrono/std::chrono::floor", "chrono/std::chrono::ceil", "chrono/std::chrono::round", "chrono/std::chrono::is_am", "chrono/std::chrono::is_pm", "chrono/std::chrono::make12", "chrono/std::chrono::make24", "chrono/std::chrono::get_leap_second_info", "chrono/std::chrono::get_tzdb", "chrono/std::chrono::get_tzdb_list", "chrono/std::chrono::locate_zone", "chrono/std::chrono::current_zone", "chrono/std::chrono::reload_tzdb", "chrono/std::chrono::remote_version"]
66
helpviewer_keywords: ["std::duration_cast function", "std::time_point_cast function", "std::chrono::duration_cast function", "std::chrono::time_point_cast function", "std::chrono::from_stream function", "std::chrono::floor function", "std::chrono::ceil function", "std::chrono::round function", "std::chrono::is_am function", "std::chrono::is_pm function", "std::chrono::make12 function", "std::chrono::make24 function", "std::chrono::get_leap_second_info function", "std::chrono::get_tzdb function", "std::chrono::get_tzdb_list function", "std::chrono::locate_zone function", "std::chrono::current_zone function", "std::chrono::reload_tzdb function", "std::chrono::remote_version function"]
77
---
88

docs/standard-library/chrono-operators.md

Lines changed: 303 additions & 91 deletions
Large diffs are not rendered by default.

docs/standard-library/chrono.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ Beginning in Visual Studio 2015, the implementation of `steady_clock` has change
3939
| [`year` class](../standard-library/year-class.md) | A year in the [Gregorian calendar](https://en.wikipedia.org/wiki/Proleptic_Gregorian_calendar).|
4040
| [`year_month` class](../standard-library/year-month-class.md) | A year and month. The day isn't specified.|
4141
| [`year_month_day` class](../standard-library/year-month-day-class.md) | A year, month, and day.|
42+
| [`year_month_day_last` class](../standard-library/year-month-day-last-class.md) | The last day of a specific month and year. |
43+
| [`year_month_weekday` class](../standard-library/year-month-weekday-class.md) | A specific year, month, and nth weekday of the month. |
44+
| [`year_month_weekday_last` class](../standard-library/year-month-weekday-last-class.md) | A specific year, month, and last weekday of the month. |
4245

4346
### Structs
4447

docs/standard-library/month-class.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
description: "Learn more about: month Class"
33
title: "month class"
4-
ms.date: "04/26/2021"
4+
ms.date: "6/25/2021"
55
f1_keywords: ["chrono/std::chrono::month", "chrono/std::chrono::month::January", "chrono/std::chrono::month::February", "chrono/std::chrono::month::March","chrono/std::chrono::month::April","chrono/std::chrono::month::May","chrono/std::chrono::month::June","chrono/std::chrono::month::July","chrono/std::chrono::month::August","chrono/std::chrono::month::September","chrono/std::chrono::month::October","chrono/std::chrono::month::November","chrono/std::chrono::month::December","chrono/std::chrono::month::operator++", "chrono/std::chrono::month::operator--", "chrono/std::chrono::month::operator unsigned", "chrono/std::chrono::month::ok"]
66
helpviewer_keywords: ["std::chrono [C++], month"]
77
---
@@ -107,7 +107,7 @@ using namespace std::chrono;
107107

108108
int main()
109109
{
110-
month m{1};
110+
month m{January};
111111

112112
std::cout << m << " " << ++m << "\n"; // constexpr month& operator++() noexcept
113113
std::cout << m << " " << m++ << "\n"; // constexpr month operator++(int) noexcept
@@ -153,7 +153,7 @@ using namespace std::chrono;
153153

154154
int main()
155155
{
156-
std::chrono::month m{5};
156+
month m{May};
157157

158158
cout << m << " " << --m << "\n"; // constexpr month& operator++() noexcept
159159
cout << m << " " << m-- << "\n"; // constexpr month operator++(int) noexcept

docs/standard-library/month-day-class.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
description: "Learn more about: month_day Class"
33
title: "month_day class"
4-
ms.date: "6/4/2021"
4+
ms.date: "6/25/2021"
55
f1_keywords: ["chrono/std::chrono::month_day", "chrono/std::chrono::month_day::day", "chrono/std::chrono::month_day::month", "chrono/std::chrono::month_day::ok"]
66
helpviewer_keywords: ["std::chrono [C++], month_day"]
77
---
@@ -75,19 +75,17 @@ using namespace std::chrono;
7575
7676
int main()
7777
{
78-
month m(7);
79-
day d(30);
80-
month_day md(m, d);
78+
month_day md(30d/July);
79+
month_day md2 = July/30; // another way to construct a month_day
8180
82-
month_day md2 = July/30; // a convenient way to construct a month_day
83-
84-
std::cout << md << ' ' << md2;
81+
std::cout << md << '\n' << md2;
8582
return 0;
8683
}
8784
```
8885

8986
```output
90-
Jul/30 Jul/30
87+
Jul/30
88+
Jul/30
9189
```
9290

9391
## <a name="day"></a> `day`

docs/standard-library/month-day-last-class.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
description: "Learn more about: month_day_last Class"
33
title: "month_day_last class"
4-
ms.date: "06/04/2021"
4+
ms.date: "06/25/2021"
55
f1_keywords: ["chrono/std::chrono::month_day_last", "chrono/std::chrono::month_day_last::month", "chrono/std::chrono::month_day_last::ok"]
66
helpviewer_keywords: ["std::chrono [C++], month_day_last"]
77
---
@@ -63,13 +63,17 @@ using namespace std::chrono;
6363
6464
int main()
6565
{
66-
month_day_last mdl = month_day_last(month(10));
67-
68-
// a convenient way to create a month_day_last
69-
month_day_last mdl2 {October / last };
66+
month_day_last mdl{ October / last };
67+
std::cout << mdl;
68+
69+
return 0;
7070
}
7171
```
7272

73+
```output
74+
Oct/last
75+
```
76+
7377
## <a name="month"></a> `month`
7478

7579
Return the month value.

docs/standard-library/month-weekday-class.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
description: "Learn more about: month_weekday Class"
33
title: "month_weekday class"
4-
ms.date: "06/4/2021"
4+
ms.date: "06/25/2021"
55
f1_keywords: ["chrono/std::chrono::month_weekday", "chrono/std::chrono::month_weekday::weekday", "chrono/std::chrono::month_weekday::month", "chrono/std::chrono::month_weekday::ok", "chrono/std::chrono::month_weekday::weekday_indexed"]
66
helpviewer_keywords: ["std::chrono [C++], month_weekday"]
77
---
@@ -72,14 +72,13 @@ using namespace std::chrono;
7272
7373
int main()
7474
{
75-
constexpr auto wdi = weekday_indexed(Monday, 1);
76-
constexpr auto month = July;
77-
month_weekday mw(month, wdi);
75+
month_weekday mw{ July/Monday[1] };
7876
std::cout << mw << '\n';
7977
80-
// A convenient way to create a month_weekday
78+
// Another way to create a month_weekday
8179
month_weekday mw2 = February / Tuesday[3];
8280
std::cout << mw2;
81+
8382
return 0;
8483
}
8584
```

docs/standard-library/month-weekday-last-class.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
description: "Learn more about: month_weekday_last Class"
33
title: "month_weekday_last class"
4-
ms.date: "5/21/2021"
4+
ms.date: "6/25/2021"
55
f1_keywords: ["chrono/std::chrono::month_weekday_last", "chrono/std::chrono::month_weekday_last::ok", "std::chrono::month_weekday_last::month_weekday_last", "chrono/std::chrono::month_weekday_last::ok", "chrono/std::chrono::month_weekday_last::month"]
66
helpviewer_keywords: ["std::chrono [C++], month_weekday_last"]
77
---
@@ -71,7 +71,7 @@ using namespace std::chrono;
7171
7272
int main()
7373
{
74-
constexpr auto mwdl = January/Monday[last]; // wdl is the last Monday of January of an unspecified year
74+
constexpr auto mwdl{ January / Monday[last] }; // wdl is the last Monday of January of an unspecified year
7575
std::cout << mwdl << "\n";
7676
7777
const auto theMonth = August;

docs/standard-library/toc.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,12 @@
194194
href: year-month-class.md
195195
- name: year_month_day class
196196
href: year-month-day-class.md
197+
- name: year_month_day_last class
198+
href: year-month-day-last-class.md
199+
- name: year_month_weekday class
200+
href: year-month-weekday-class.md
201+
- name: year_month_weekday_last class
202+
href: year-month-weekday-last-class.md
197203
- name: <cinttypes>
198204
href: ../standard-library/cinttypes.md
199205
- name: <ciso646>

docs/standard-library/weekday-class.md

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
description: "Learn more about: weekday Class"
33
title: "weekday class"
4-
ms.date: "04/28/2021"
4+
ms.date: "6/25/2021"
55
f1_keywords: ["chrono/std::chrono::weekday", "chrono/std::chrono::weekday::January", "chrono/std::chrono::weekday::February", "chrono/std::chrono::weekday::March","chrono/std::chrono::weekday::April","chrono/std::chrono::weekday::May","chrono/std::chrono::weekday::June","chrono/std::chrono::weekday::July","chrono/std::chrono::weekday::August","chrono/std::chrono::weekday::September","chrono/std::chrono::weekday::October","chrono/std::chrono::weekday::November","chrono/std::chrono::weekday::December","chrono/std::chrono::weekday::operator++", "chrono/std::chrono::weekday::operator--", "chrono/std::chrono::weekday::operator unsigned", "chrono/std::chrono::weekday::ok", "chrono/std::chrono::weekday::iso_encoding", "chrono/std::chrono::weekday::c_encoding"]
66
helpviewer_keywords: ["std::chrono [C++], weekday"]
77
---
@@ -78,6 +78,30 @@ Construct a `weekday` with value *`wd`*.
7878
3\) Computes what day of the week corresponds to the `std::chrono::sys_days` value `dp`, and constructs a `weekday` using that day.\
7979
4\) Computes the day of the week that corresponds to the `std::chrono::local_days` value `dp`, and constructs a `weekday` using that day. It behaves as if you created the `weekday` using `weekday(std::chrono::sys_days(dp.time_since_epoch()))`.
8080
81+
### Example: Create a `weekday`
82+
83+
```cpp
84+
// compile using: /std:c++latest
85+
#include <iostream>
86+
#include <chrono>
87+
88+
using namespace std::chrono;
89+
90+
int main()
91+
{
92+
weekday wd{ Wednesday };
93+
weekday wd2{ 3 };
94+
std::cout << wd << '\n' << wd2;
95+
96+
return 0;
97+
}
98+
```
99+
100+
```output
101+
Wednesday
102+
Wednesday
103+
```
104+
81105
## <a name="c_encoding"></a> `c_encoding`
82106

83107
```cpp
@@ -138,17 +162,16 @@ using namespace std::chrono;
138162

139163
int main()
140164
{
141-
std::chrono::weekday y{4};
165+
std::chrono::weekday wd{Thursday};
142166

143-
std::cout << y << " " << ++y << "\n"; // constexpr weekday& operator++() noexcept
144-
std::cout << y << " " << y++ << "\n"; // constexpr weekday operator++(int) noexcept
145-
std::cout << y << "\n";
167+
std::cout << wd << " " << ++wd << "\n"; // constexpr weekday& operator++() noexcept
168+
std::cout << wd << " " << wd++ << "\n"; // constexpr weekday operator++(int) noexcept
169+
std::cout << wd << "\n";
146170

147171
return 0;
148172
}
149173
```
150174

151-
Output:
152175
```output
153176
Thu Fri
154177
Fri Fri
@@ -185,7 +208,7 @@ using namespace std::chrono;
185208

186209
int main()
187210
{
188-
weekday y = weekday{4};
211+
weekday y = weekday{Thursday};
189212

190213
cout << y << " " << --y << "\n"; // constexpr weekday& operator--() noexcept
191214
cout << y << " " << y-- << "\n"; // constexpr weekday operator--(int) noexcept
@@ -195,8 +218,6 @@ int main()
195218
}
196219
```
197220

198-
Output:
199-
200221
```output
201222
Thu Wed
202223
Wed Wed
@@ -267,7 +288,7 @@ using namespace std::chrono;
267288

268289
int main()
269290
{
270-
constexpr auto firstMondayInJanuary =
291+
constexpr auto firstMondayInJanuary =
271292
year_month_day{ Monday[2] / January / 2021y };
272293

273294
std::cout << firstMondayInJanuary << "\n";

docs/standard-library/weekdayindexed-class.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
description: "Learn more about: weekday_indexed Class"
33
title: "weekday_indexed class"
4-
ms.date: "06/07/2021"
4+
ms.date: "06/25/2021"
55
f1_keywords: ["chrono/std::chrono::weekday_indexed", "chrono/std::chrono::weekday_indexed::ok", "std::chrono::weekday_indexed::weekday", "std::chrono::weekday_indexed::ok"]
66
helpviewer_keywords: ["std::chrono [C++], weekday_indexed"]
77
---
@@ -69,7 +69,7 @@ using namespace std::chrono;
6969
7070
int main()
7171
{
72-
constexpr auto wdi = weekday_indexed(Monday, 1);
72+
constexpr auto wdi = weekday_indexed{Monday, 1};
7373
7474
std::cout << wdi;
7575
return 0;
@@ -113,7 +113,7 @@ The weekday value.
113113

114114
int main()
115115
{
116-
constexpr auto wdi = weekday_indexed(Monday, 1);
116+
constexpr auto wdi = weekday_indexed{ Monday, 1 };
117117
std::cout << wdi << "\n";
118118

119119
return 0;

docs/standard-library/weekdaylast-class.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
description: "Learn more about: weekday_last Class"
33
title: "weekday_last class"
4-
ms.date: "06/07/2021"
4+
ms.date: "06/25/2021"
55
f1_keywords: ["chrono/std::chrono::weekday_last", "chrono/std::chrono::weekday_last::ok", "std::chrono::weekday_last::weekday", "chrono/std::chrono::weekday_last::ok", "chrono/std::chrono::weekday_last::weekday"]
66
helpviewer_keywords: ["std::chrono [C++], weekday_last"]
77
---
@@ -103,17 +103,15 @@ using namespace std::chrono;
103103

104104
int main()
105105
{
106-
constexpr auto wdl = Monday[last]; // lastWeekday is the last Monday of an unspecified month
106+
constexpr auto wdl{ Monday[last] }; // wdl is the last Monday of an unspecified month
107107
std::cout << wdl.weekday() << "\n";
108108

109109
return 0;
110110
}
111111
```
112112

113-
Output:
114-
115113
```output
116-
Monday
114+
Mon
117115
```
118116

119117
## See also

0 commit comments

Comments
 (0)