From d597aff52b4a69010f3926a15c5abe3a46db81d7 Mon Sep 17 00:00:00 2001 From: Colin Robertson Date: Tue, 28 Jan 2020 15:43:39 -0800 Subject: [PATCH 1/3] Fix initializer_list for 1881 --- .../initializer-list-class.md | 46 ++++++++++--------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/docs/standard-library/initializer-list-class.md b/docs/standard-library/initializer-list-class.md index bc110b88b6e..11e4e7ade1b 100644 --- a/docs/standard-library/initializer-list-class.md +++ b/docs/standard-library/initializer-list-class.md @@ -1,11 +1,12 @@ --- -title: "initializer_list Class" -ms.date: "11/04/2016" +title: "initializer_list class" +description: "A reference for the initializer_list class in the C++ Standard library, as implemented by Microsoft in Visual Studio." +ms.date: "01/28/2020" f1_keywords: ["initializer_list/std::initializer_list::initializer_list", "initializer_list/std::initializer_list::begin", "initializer_list/std::initializer_list::end", "initializer_list/std::initializer_list::size"] ms.assetid: 1f2c0ff4-5636-4f79-b008-e75426e3d2ab helpviewer_keywords: ["std::initializer_list::initializer_list", "std::initializer_list::begin", "std::initializer_list::end", "std::initializer_list::size"] --- -# initializer_list Class +# initializer_list class Provides access to an array of elements in which each member is of the specified type. @@ -30,24 +31,24 @@ An `initializer_list` can be constructed using a braced initializer list: initializer_list i1{ 1, 2, 3, 4 }; ``` -The compiler transforms braced initializer lists with homogeneous elements into an `initializer_list` whenever the function signature requires an `initializer_list`. For more details on using `initializer_list`, see [Uniform Initialization and Delegating Constructors](../cpp/uniform-initialization-and-delegating-constructors.md) +The compiler transforms braced initializer lists with homogeneous elements into an `initializer_list` whenever the function signature requires an `initializer_list`. For more information about using `initializer_list`, see [Uniform initialization and delegating constructors](../cpp/uniform-initialization-and-delegating-constructors.md) ### Constructors |Constructor|Description| |-|-| -|[initializer_list](../standard-library/forward-list-class.md#forward_list)|Constructs an object of type `initializer_list`.| +|[initializer_list](#initializer_list)|Constructs an object of type `initializer_list`.| ### Typedefs |Type name|Description| |-|-| -|value_type|The type of the elements in the `initializer_list`.| -|reference|A type that provides a reference to an element in the `initializer_list`.| -|const_reference|A type that provides a constant reference to an element in the `initializer_list`.| -|size_type|A type that represents the number of elements in the `initializer_list`.| -|iterator|A type that provides an iterator for the `initializer_list`.| -|const_iterator|A type that provides a constant iterator for the `initializer_list`.| +|`value_type`|The type of the elements in the `initializer_list`.| +|`reference`|A type that provides a reference to an element in the `initializer_list`.| +|`const_reference`|A type that provides a constant reference to an element in the `initializer_list`.| +|`size_type`|A type that represents the number of elements in the `initializer_list`.| +|`iterator`|A type that provides an iterator for the `initializer_list`.| +|`const_iterator`|A type that provides a constant iterator for the `initializer_list`.| ### Member functions @@ -75,8 +76,6 @@ constexpr const InputIterator* begin() const noexcept; A pointer to the first element of the `initializer_list`. If the list is empty, the pointer is the same for the beginning and end of the list. -### Remarks - ## initializer_list::end Returns a pointer to one past the last element in an `initializer list`. @@ -87,7 +86,7 @@ constexpr const InputIterator* end() const noexcept; ### Return Value -A pointer to one past the last element in the list. If the list is empty, this is the same as the pointer to the first element in the list. +A pointer to one past the last element in the list. If the list is empty, it's the same as the pointer to the first element in the list. ## initializer_list::initializer_list @@ -100,14 +99,15 @@ initializer_list(const InputIterator First, const InputIterator Last); ### Parameters -|Parameter|Description| -|---------------|-----------------| -|*First*|The position of the first element in the range of elements to be copied.| -|*Last*|The position of the first element beyond the range of elements to be copied.| +*First*\ +The position of the first element in the range of elements to be copied. + +*Last*\ +The position of the first element beyond the range of elements to be copied. ### Remarks -An `initializer_list` is based on an array of objects of the specified type. Copying an `initializer_list` creates a second instance of a list pointing to the same objects; the underlying objects are not copied. +An `initializer_list` is based on an array of objects of the specified type. Copying an `initializer_list` creates a second instance of a list pointing to the same objects; the underlying objects aren't copied. ### Example @@ -169,7 +169,11 @@ int main() ``` ```Output -c1 = 3c2 = 5 4 3 2 1c3 = 5 4 3 2 1c4 = 5 4c5 = 5 4 +c1 = 3 +c2 = 5 4 3 2 1 +c3 = 5 4 3 2 1 +c4 = 5 4 +c5 = 5 4 ``` ## initializer_list::size @@ -184,8 +188,6 @@ constexpr size_t size() const noexcept; The number of elements in the list. -### Remarks - ## See also [](../standard-library/forward-list.md) From c2fecb7ba60cad28c986a8f16135b52fd8524fb3 Mon Sep 17 00:00:00 2001 From: Colin Robertson Date: Tue, 28 Jan 2020 15:49:08 -0800 Subject: [PATCH 2/3] fix more issues --- docs/standard-library/initializer-list-class.md | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/docs/standard-library/initializer-list-class.md b/docs/standard-library/initializer-list-class.md index 11e4e7ade1b..4304809949e 100644 --- a/docs/standard-library/initializer-list-class.md +++ b/docs/standard-library/initializer-list-class.md @@ -19,9 +19,8 @@ class initializer_list ### Parameters -|Parameter|Description| -|---------------|-----------------| -|*Type*|The element data type to be stored in the `initializer_list`.| +*Type*\ +The element data type to be stored in the `initializer_list`. ## Remarks @@ -72,7 +71,7 @@ Returns a pointer to the first element in an `initializer_list`. constexpr const InputIterator* begin() const noexcept; ``` -### Return Value +### Return value A pointer to the first element of the `initializer_list`. If the list is empty, the pointer is the same for the beginning and end of the list. @@ -84,7 +83,7 @@ Returns a pointer to one past the last element in an `initializer list`. constexpr const InputIterator* end() const noexcept; ``` -### Return Value +### Return value A pointer to one past the last element in the list. If the list is empty, it's the same as the pointer to the first element in the list. @@ -156,11 +155,6 @@ int main() cout << " " << c; cout << endl; - cout << "c4 ="; - for (auto c : c4) - cout << " " << c; - cout << endl; - cout << "c5 ="; for (auto c : c5) cout << " " << c; @@ -172,7 +166,6 @@ int main() c1 = 3 c2 = 5 4 3 2 1 c3 = 5 4 3 2 1 -c4 = 5 4 c5 = 5 4 ``` @@ -184,7 +177,7 @@ Returns the number of elements in the list. constexpr size_t size() const noexcept; ``` -### Return Value +### Return value The number of elements in the list. From e9dd1e832f6bdc940512d03b17a4123362fea95f Mon Sep 17 00:00:00 2001 From: Colin Robertson Date: Tue, 28 Jan 2020 16:49:12 -0800 Subject: [PATCH 3/3] Address _popen code issue per 1880 --- .../reference/popen-wpopen.md | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/docs/c-runtime-library/reference/popen-wpopen.md b/docs/c-runtime-library/reference/popen-wpopen.md index 8726f6643a4..935e7a493bc 100644 --- a/docs/c-runtime-library/reference/popen-wpopen.md +++ b/docs/c-runtime-library/reference/popen-wpopen.md @@ -1,6 +1,7 @@ --- title: "_popen, _wpopen" -ms.date: "11/04/2016" +description: "A reference for the Microsoft C runtime (CRT) library functions _popen and _wpopen." +ms.date: "01/28/2020" api_name: ["_popen", "_wpopen"] api_location: ["msvcrt.dll", "msvcr80.dll", "msvcr90.dll", "msvcr100.dll", "msvcr100_clr0400.dll", "msvcr110.dll", "msvcr110_clr0400.dll", "msvcr120.dll", "msvcr120_clr0400.dll", "ucrtbase.dll", "api-ms-win-crt-stdio-l1-1-0.dll"] api_type: ["DLLExport"] @@ -8,6 +9,7 @@ topic_type: ["apiref"] f1_keywords: ["tpopen", "popen", "wpopen", "_popen", "_wpopen", "_tpopen"] helpviewer_keywords: ["tpopen function", "pipes, creating", "_popen function", "_tpopen function", "popen function", "wpopen function", "_wpopen function"] ms.assetid: eb718ff2-c87d-4bd4-bd2e-ba317c3d6973 +no-loc: [_popen, _wpopen, _tpopen, _doserrno, errno, _sys_errlist, _sys_nerr, EINVAL] --- # _popen, _wpopen @@ -31,21 +33,21 @@ FILE *_wpopen( ### Parameters -*command*
+*command*\ Command to be executed. -*mode*
+*mode*\ Mode of the returned stream. -## Return Value +## Return value -Returns a stream associated with one end of the created pipe. The other end of the pipe is associated with the spawned command's standard input or standard output. The functions return **NULL** on an error. If the error is an invalid parameter, such as if *command* or *mode* is a null pointer, or *mode* is not a valid mode, **errno** is set to **EINVAL**. See the Remarks section for valid modes. +Returns a stream associated with one end of the created pipe. The other end of the pipe is associated with the spawned command's standard input or standard output. The functions return **NULL** on an error. If the error is caused by an invalid parameter, **errno** is set to **EINVAL**. See the Remarks section for valid modes. For information about these and other error codes, see [_doserrno, errno, _sys_errlist, and _sys_nerr](../../c-runtime-library/errno-doserrno-sys-errlist-and-sys-nerr.md). ## Remarks -The **_popen** function creates a pipe and asynchronously executes a spawned copy of the command processor with the specified string *command*. The character string *mode* specifies the type of access requested, as follows. +The **_popen** function creates a pipe. It then asynchronously executes a spawned copy of the command processor, and uses *command* as the command line. The character string *mode* specifies the type of access requested, as follows. |Access mode|Description| |-|-| @@ -107,7 +109,7 @@ int main( void ) while(fgets(psBuffer, 128, pPipe)) { - printf(psBuffer); + puts(psBuffer); } /* Close pipe and print return value of pPipe. */ @@ -122,9 +124,7 @@ int main( void ) } ``` -### Sample Output - -This output assumes that there is only one file in the current directory with a .c file name extension. +This output assumes there's only one file in the current directory that has a `.c` file name extension. ```Output Volume in drive C is CDRIVE @@ -141,6 +141,6 @@ Process returned 0 ## See also -[Process and Environment Control](../../c-runtime-library/process-and-environment-control.md)
-[_pclose](pclose.md)
-[_pipe](pipe.md)
+[Process and environment control](../../c-runtime-library/process-and-environment-control.md)\ +[_pclose](pclose.md)\ +[_pipe](pipe.md)