Skip to content

Commit 571199f

Browse files
author
Colin Robertson
authored
Merge pull request #3463 from MicrosoftDocs/master637701753252703234
Repo sync for protected CLA branch
2 parents 69212b5 + 0c4f21c commit 571199f

15 files changed

+751
-56
lines changed

docs/cpp/void-cpp.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
---
22
description: "Learn more about: void (C++)"
33
title: "void (C++)"
4-
ms.date: "11/04/2016"
4+
ms.date: 10/15/2021
55
f1_keywords: ["void_cpp"]
66
helpviewer_keywords: ["void keyword [C++]", "functions [C++], void", "pointers, void"]
77
ms.assetid: d203edba-38e6-4056-8b89-011437351057
88
---
99
# void (C++)
1010

11-
When used as a function return type, the **`void`** keyword specifies that the function does not return a value. When used for a function's parameter list, **`void`** specifies that the function takes no parameters. When used in the declaration of a pointer, **`void`** specifies that the pointer is "universal."
11+
When used as a function return type, the **`void`** keyword specifies that the function doesn't return a value. When used for a function's parameter list, **`void`** specifies that the function takes no parameters. When used in the declaration of a pointer, **`void`** specifies that the pointer is "universal."
1212

13-
If a pointer's type is **void\***, the pointer can point to any variable that is not declared with the **`const`** or **`volatile`** keyword. A **void\*** pointer cannot be dereferenced unless it is cast to another type. A **void\*** pointer can be converted into any other type of data pointer.
13+
If a pointer's type is `void*`, the pointer can point to any variable that's not declared with the **`const`** or **`volatile`** keyword. A `void*` pointer can't be dereferenced unless it's cast to another type. A `void*` pointer can be converted into any other type of data pointer.
1414

15-
A **`void`** pointer can point to a function, but not to a class member in C++.
15+
In C++, a **`void`** pointer can point to a free function (a function that's not a member of a class), or to a static member function, but not to a non-static member function.
1616

17-
You cannot declare a variable of type **`void`**.
17+
You can't declare a variable of type **`void`**.
1818

1919
## Example
2020

@@ -32,5 +32,5 @@ int main() {
3232

3333
## See also
3434

35-
[Keywords](../cpp/keywords-cpp.md)<br/>
35+
[Keywords](../cpp/keywords-cpp.md)\
3636
[Built-in types](../cpp/fundamental-types-cpp.md)

docs/mfc/codesnippet/CPP/cfindreplacedialog-class_5.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ LRESULT CMyRichEditView::OnFindReplace(WPARAM wparam, LPARAM lparam)
2020
_T("FindString"), csFindString));
2121
VERIFY(AfxGetApp()->WriteProfileString(AfxGetApp()->m_pszAppName,
2222
_T("ReplaceString"), csReplaceString));
23-
24-
VERIFY(pDlg->DestroyWindow());
2523
}
2624
}
2725

docs/mfc/reference/cfindreplacedialog-class.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,10 +239,6 @@ BOOL IsTerminating() const;
239239

240240
Nonzero if the user has decided to terminate the dialog box; otherwise 0.
241241

242-
### Remarks
243-
244-
If this function returns nonzero, you should call the `DestroyWindow` member function of the current dialog box and set any dialog box pointer variable to NULL. Optionally, you can also store the find/replace text last entered and use it to initialize the next find/replace dialog box.
245-
246242
### Example
247243

248244
See the example for [CFindReplaceDialog::GetFindString](#getfindstring).

docs/standard-library/choose-enum.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ If a `local_time` specifies a time during this "extra" hour, it isn't clear how
3838
3939
**Nonexistent conversion error**
4040
41-
When converting from standard time to daylight saving time, a different problem can arise. During the transition from standard time to daylight saving time in the spring, clocks move ahead an hour. The skipped hour disappears, so even though it appears that we've added an hour to the time, by "springing forward" an hour, the hour following the transition is effectively removed.
41+
When converting from standard time to daylight saving time, a different problem can arise. During the transition from standard time to daylight saving time in the spring, clocks move ahead an hour. The skipped hour disappears, so even though it appears we've added an hour to the time, by "springing forward" an hour, the hour following the transition is effectively removed.
4242
4343
Consider the change to daylight saving time in New York, which happens on the second Sunday in March at 2am. At 2am, the clock transitions to daylight savings time and now reads 3:00am. If the `local_time` being converted is 2:30am, for example, that time is during the period that was "removed" and so is "nonexistent", resulting in a [`nonexistent_local_time`](nonexistent-local-time.md#example-nonexistent_local_time) exception.
4444

docs/standard-library/chrono-functions.md

Lines changed: 80 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
22
description: "Learn more about: <chrono> functions"
33
title: "<chrono> functions"
4-
ms.date: 10/06/2021
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::abs", "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"]
6-
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"]
4+
ms.date: 10/15/2021
5+
f1_keywords: ["chrono/std::duration_cast", "chrono/std::time_point_cast", "chrono/std::chrono::clock_cast", "chrono/std::chrono::duration_cast", "chrono/std::chrono::time_point_cast", "chrono/std::chrono::from_stream", "chrono/std::chrono::abs", "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"]
6+
helpviewer_keywords: ["std::duration_cast function", "std::time_point_cast function", "std::chrono::clock_cast", "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

99
# `<chrono>` functions
@@ -120,6 +120,83 @@ Returns the smallest time point representable using `ToDuration` that's greater
120120

121121
`ceil` doesn't participate in overload resolution unless the `ToDuration` type is an instance of a [`duration`](../standard-library/duration-class.md).
122122

123+
## <a name="std-chrono-clock-cast"></a> `clock_cast`
124+
125+
Converts a [`time_point`](time-point-class.md) for one clock to an equivalent `time_point` for another clock.
126+
127+
### Syntax
128+
129+
```cpp
130+
template <class DestClock, class SourceClock, class Duration>
131+
auto clock_cast(const time_point<SourceClock, Duration>& t); // C++ 20
132+
```
133+
134+
### Parameters
135+
136+
*`DestClock`*\
137+
The clock type to convert the `time_point` to.
138+
139+
*`Duration`*\
140+
The [`duration`](duration-class.md) of the `SourceClock`, or one that you specify.
141+
142+
*`SourceClock`*\
143+
The clock type that the `time_point` to convert is based on.
144+
145+
*`t`*\
146+
The `time_point` to convert.
147+
148+
### Return value
149+
150+
A [`time_point`](time-point-class.md) equivalent to **`t`**, but specific to `DestClock`.
151+
152+
### Remarks
153+
154+
The parameters `SourceClock` and `Duration` can be inferred via class template argument deduction when not explicitly passed. For example, given `clock_cast<utc_clock>(file_clock::now())`, `SourceClock` is deduced to be `file_clock`, and `Duration` is deduced to be `file_clock::duration`.
155+
156+
From the following list of well-formed clock conversions, the one that requires the fewest conversion steps to get from the `SourceClock` to the `DestClock` is selected.
157+
158+
```cpp
159+
clock_time_conversion<DestClock, SourceClock>{}(t)
160+
161+
clock_time_conversion<DestClock, system_clock>{}(
162+
clock_time_conversion<system_clock, SourceClock>{}(t))
163+
164+
clock_time_conversion<DestClock, utc_clock>{}(
165+
clock_time_conversion<utc_clock, SourceClock>{}(t))
166+
167+
clock_time_conversion<DestClock, utc_clock>{}(
168+
clock_time_conversion<utc_clock, system_clock>{}(
169+
clock_time_conversion<system_clock, SourceClock>{}(t)))
170+
171+
clock_time_conversion<DestClock, system_clock>{}(
172+
clock_time_conversion<system_clock, utc_clock>{}(
173+
clock_time_conversion<utc_clock, SourceClock>{}(t)))
174+
```
175+
176+
For more information about what `clock_time_conversion` does, see [`clock_time_conversion` struct](clock-time-conversion-struct.md).
177+
178+
### Example `clock_cast`
179+
180+
```cpp
181+
// compile using: /std:c++latest
182+
#include <iostream>
183+
#include <chrono>
184+
185+
using namespace std::chrono;
186+
187+
int main()
188+
{
189+
utc_clock::time_point t = clock_cast<utc_clock>(file_clock::now());
190+
std::cout << t;
191+
192+
return 0;
193+
}
194+
```
195+
196+
```output
197+
2021-10-11 22:58:17.8540720
198+
```
199+
123200
## <a name="std-chrono-current-zone"></a> `current_zone`
124201

125202
Gets the current time zone object.

docs/standard-library/chrono.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
description: "Learn more about: <chrono>"
33
title: "<chrono>"
4-
ms.date: 09/30/2021
4+
ms.date: 10/13/2021
55
f1_keywords: ["<chrono>", "chrono/std::chrono::nanoseconds", "chrono/std::chrono::minutes", "chrono/std::chrono::seconds", "chrono/std::chrono::hours", "chrono/std::chrono::milliseconds", "chrono/std::chrono::microseconds"]
66
---
77

@@ -70,7 +70,10 @@ In the Microsoft C++ implementation, `steady_clock::time_point` is now a `typede
7070
| [`sys_info`](sys-info-struct.md) | Provides a low-level interface to time zone information about the result of converting a `sys_time` to a `local_time`. |
7171
| [`time_zone` class](time-zone-class.md) | All time zone transitions for a specific geographic area. |
7272
| [`time_zone_link` class](time-zone-link-class.md) | An alternative name for a `time_zone`. |
73+
| [`tzdb` struct](tzdb-struct.md) | Represents a copy of the time zone database. |
74+
| [`tzdb_list` class](tzdb-list-class.md) | A singleton list of time zone databases. |
7375
| [`zoned_time` class](zoned-time-class.md) | A pairing of a [`time_zone`](time-zone-class.md) and a [`time_point`](time-point-class.md) with a specified precision. |
76+
| [`zoned_traits` struct](zoned-traits-struct.md) | Used to associate a different default time zone with a `zoned_time`, and optionally map a custom name to that default time zone. |
7477

7578
**Exceptions**
7679

@@ -85,6 +88,7 @@ In the Microsoft C++ implementation, `steady_clock::time_point` is now a `typede
8588
|--|--|
8689
| [`ceil(duration)`](chrono-functions.md#std-chrono-ceil-duration) | Returns the `ceil` of a `duration` object as a specified type. |
8790
| [`ceil(time_point)`](chrono-functions.md#std-chrono-ceil-time-point) | Returns the `ceil` of a `time_point` object as a specified type. |
91+
| [`clock_cast`](chrono-functions.md#std-chrono-clock-cast) | Converts a [`time_point`](time-point-class.md) from one clock to an equivalent `time_point` for another clock. |
8892
| [`duration_cast`](chrono-functions.md#std-chrono-duration-cast) | Casts a `duration` object to a specified type. |
8993
| [`floor(duration)`](chrono-functions.md#std-chrono-floor-duration) | Returns the `floor` of a `duration` object as a specified type. |
9094
| [`floor(time_point)`](chrono-functions.md#std-chrono-floor-time-point) | Returns the `floor` of a `time_point` object as a specified type. |
@@ -104,8 +108,8 @@ In the Microsoft C++ implementation, `steady_clock::time_point` is now a `typede
104108
| Name | Description |
105109
|--|--|
106110
| [`current_zone`](chrono-functions.md#std-chrono-current-zone) | Gets the current time zone. |
107-
| [`get_tzdb_list`](chrono-functions.md#std-chrono-get-tzdb-list) | Gets the list of time zone database entries. |
108111
| [`get_tzdb`](chrono-functions.md#std-chrono-get-tzdb) | Gets the first time zone database entry. |
112+
| [`get_tzdb_list`](chrono-functions.md#std-chrono-get-tzdb-list) | Gets the list of time zone database entries. |
109113
| [`reload_tzdb`](chrono-functions.md#std-chrono-reload-tzdb) | Gets an updated time zone database entry. |
110114
| [`remote_version`](chrono-functions.md#std-chrono-remote-version) | Checks for an updated time zone database entry. |
111115

@@ -163,6 +167,7 @@ For more information about ratio types that are used in the following typedefs,
163167

164168
| Name | Description |
165169
|--|--|
170+
| [`clock_time_conversion`](clock-time-conversion-struct.md) | A trait that specifies how to convert a [`time_point`](time-point-class.md) from one clock to another. |
166171
| [is_clock](is-clock-struct.md) | Check if a type is a clock. |
167172
| [treat_as_floating_point](treat-as-floating-point-structure.md) | Check if a `duration` can be converted to another `duration` that has a different tick period. |
168173

@@ -185,7 +190,7 @@ For more information about ratio types that are used in the following typedefs,
185190
| `nanoseconds operator "" ns(unsigned long long Val)` | Specifies nanoseconds as an integral value. |
186191
| `duration<double, nano> operator "" ns(long double Val)` | Specifies nanoseconds as a floating-point value. |
187192

188-
The following examples show how to use `<chrono>` literals.
193+
The following examples show how to use `<chrono>` literals:
189194

190195
```cpp
191196
constexpr auto day = 24h;
Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
---
2+
description: "Learn more about clock_conversion trait"
3+
title: "clock_conversion struct"
4+
ms.date: 10/12/2021
5+
f1_keywords: ["chrono/std::clock_conversion"]
6+
helpviewer_keywords: ["std::chrono [C++], clock_conversion"]
7+
---
8+
9+
# `clock_time_conversion` struct
10+
11+
A trait that specifies how to convert a [`time_point`](time-point-class.md) from one type of clock to another, while maintaining the equivalent point in time.
12+
13+
## Syntax
14+
15+
```cpp
16+
// C++20
17+
1) template<class Dest, class Source> struct clock_time_conversion {};
18+
2) template<class Clock> struct clock_time_conversion<Clock, Clock>;
19+
3) template<> struct clock_time_conversion<system_clock, system_clock>;
20+
4) template<> struct clock_time_conversion<utc_clock, utc_clock>;
21+
5) template<> struct clock_time_conversion<system_clock, utc_clock>;
22+
6) template<> struct clock_time_conversion<utc_clock, system_clock>;
23+
7) template<class Clock> struct clock_time_conversion<Clock, system_clock>;
24+
8) template<class Clock> struct clock_time_conversion<system_clock, Clock>;
25+
9) template<class Clock> struct clock_time_conversion<Clock, utc_clock>;
26+
10) template<class Clock> struct clock_time_conversion<utc_clock, Clock>;
27+
```
28+
29+
### Template parameters
30+
31+
*`Clock`*\
32+
A clock type to convert from/to.
33+
34+
*`Dest`*\
35+
The clock type to convert to.
36+
37+
*`Source`*\
38+
The clock type to convert from.
39+
40+
The traits provide the following conversions:
41+
42+
1\) An empty struct that is defined only so that it can be specialized.\
43+
2-4\) Identity conversions. Returns the same clock you pass in.\
44+
5-6\) Converting between `sys_time` and `utc_time` calls `utc_clock::to_sys` or `utc_clock::from_sys` depending on the direction of the conversion.\
45+
7-8\) Converting between `sys_time` and the specified clock, when the specified clock supports `to_sys` and `from_sys`, results in a call to `Clock::to_sys` or `Clock::from_sys`, depending on the direction of the conversion.\
46+
9-10\) Converting between `utc_time`and the specified clock, when the specified clock supports `from_utc` and `to_sys`, results in a call to `Clock::to_utc` or `Clock::from_utc`, depending on the direction of the conversion.
47+
48+
## Members
49+
50+
|Name|Description|
51+
|----------|-----------------|
52+
| [`operator ()`](#op_parens) | Converts a `time_point` from one clock to another. |
53+
54+
## Remarks
55+
56+
You usually won't use this trait directly in your code. It's used by the [`clock_cast`](chrono-functions.md#std-chrono-clock-cast) conversion function.
57+
58+
## Requirements
59+
60+
**Header:** \<`chrono`>
61+
62+
**Namespace:** `std`
63+
64+
**Compiler Option:** [`/std:c++latest`](../build/reference/std-specify-language-standard-version.md)
65+
66+
## <a name="op_parens"></a> `operator()`
67+
68+
Converts a `time_point` from one clock type to another while maintaining the equivalent point in time.
69+
70+
### Syntax
71+
72+
```cpp
73+
1)
74+
template <class Duration>
75+
time_point<Clock, Duration> operator()(const time_point<Clock, Duration>& t) const;
76+
77+
2)
78+
template <class Duration>
79+
sys_time<Duration> operator()(const sys_time<Duration> & t) const;
80+
81+
3)
82+
template <class Duration>
83+
utc_time<Duration> operator()(const utc_time<Duration>& t) const;
84+
85+
4)
86+
template <class Duration>
87+
sys_time<Duration> operator()(const utc_time<Duration>& t) const;
88+
89+
5)
90+
template <class Duration>
91+
utc_time<Duration> operator()(const sys_time<Duration>& t) const;
92+
```
93+
94+
### Parameters
95+
96+
**`t`**
97+
The `time_point` to convert.
98+
99+
### Return value
100+
101+
1-3\) Identity conversions. No conversion. Returns `t` without any changes.\
102+
4\) Returns `utc_clock::to_sys(t)`.\
103+
5\) Returns` utc_clock::from_sys(t)`.
104+
105+
### Deduction guides
106+
107+
The following deduction guides are provided for `template <class Duration> operator()`:
108+
109+
```cpp
110+
1)
111+
template <class Duration> auto operator()(const sys_time<Duration>& t) const
112+
-> decltype(Clock::from_sys(t));
113+
114+
2)
115+
template <class Duration> auto operator()(const time_point<SourceClock, Duration>& t) const
116+
-> decltype(Clock::to_sys(t));
117+
118+
3)
119+
template <class Duration> auto operator()(const utc_time<Duration>& t) const
120+
-> decltype(Clock::from_utc(t));
121+
122+
4)
123+
template <class Duration> auto operator()(const time_point<Clock, Duration>& t) const
124+
-> decltype(Clock::to_utc(t));
125+
```
126+
127+
1\) Participates in overload resolution only when `Clock` supports `from_sys()` and returns `time_point<Clock, Duration>`.\
128+
2\) Participates in overload resolution only when `Clock` supports `to_sys()` and returns `sys_time<Duration>`.\
129+
3\) Participates in overload resolution only when `Clock` supports `from_utc()` and returns `time_point<Clock, Duration>`.\
130+
4\) Participates in overload resolution only when `Clock` supports `to_utc()` and returns `utc_time<Duration>`.
131+
132+
## Example: `clock_time_conversion`
133+
134+
```cpp
135+
#include <iostream>
136+
#include <chrono>
137+
138+
using namespace std::chrono;
139+
140+
int main()
141+
{
142+
auto sd = sys_days{ 2021y / July / 26 };
143+
auto time = clock_time_conversion<utc_clock, system_clock>{}(sd);
144+
std::cout << time << "\n";
145+
return 0;
146+
}
147+
```
148+
149+
```output
150+
2021-07-26 00:00:00
151+
```
152+
153+
## See also
154+
155+
[`<chrono>`](chrono.md)\
156+
[`clock_cast`](chrono-functions.md#std-chrono-clock-cast)\
157+
[Header Files Reference](cpp-standard-library-header-files.md)

docs/standard-library/day-class.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Represents a day of the month. For example, the 25th day of the month.
1212
## Syntax
1313

1414
```cpp
15-
class day; // c++ 20
15+
class day; // C++ 20
1616
```
1717

1818
## Remarks

0 commit comments

Comments
 (0)