tmp/tmp41m03oym/{from.md → to.md}
RENAMED
|
@@ -1,56 +1,62 @@
|
|
| 1 |
### Library contents and organization <a id="organization">[[organization]]</a>
|
| 2 |
|
| 3 |
-
[[contents]] describes the entities defined in the
|
| 4 |
-
[[headers]] lists the standard library headers and
|
| 5 |
-
those headers. [[compliance]] lists requirements for
|
| 6 |
-
implementation of the C++ standard library.
|
| 7 |
|
| 8 |
#### Library contents <a id="contents">[[contents]]</a>
|
| 9 |
|
| 10 |
-
The C++standard library provides definitions for the
|
| 11 |
-
|
|
|
|
| 12 |
|
| 13 |
-
All library entities except
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
|
| 19 |
Whenever a name `x` defined in the standard library is mentioned, the
|
| 20 |
name `x` is assumed to be fully qualified as `::std::x`, unless
|
| 21 |
-
explicitly described otherwise. For example, if the Effects section
|
| 22 |
-
library function `F` is described as calling library function `G`,
|
| 23 |
-
function `::std::G` is meant.
|
| 24 |
|
| 25 |
#### Headers <a id="headers">[[headers]]</a>
|
| 26 |
|
| 27 |
Each element of the C++standard library is declared or defined (as
|
| 28 |
-
appropriate) in a *header*.[^
|
| 29 |
|
| 30 |
-
The C++standard library provides
|
| 31 |
Table [[tab:cpp.library.headers]].
|
| 32 |
|
| 33 |
**Table: C++library headers** <a id="tab:cpp.library.headers">[tab:cpp.library.headers]</a>
|
| 34 |
|
| 35 |
-
| | |
|
| 36 |
-
| ---------------------- | -------------------- | -----------
|
| 37 |
-
| `<algorithm>` | `<
|
| 38 |
-
| `<
|
| 39 |
-
| `<
|
| 40 |
-
| `<
|
| 41 |
-
| `<
|
| 42 |
-
| `<
|
| 43 |
-
| `<
|
| 44 |
-
| `<
|
| 45 |
-
| `<
|
| 46 |
-
| `<
|
| 47 |
-
| `<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
|
| 49 |
|
| 50 |
-
The facilities of the C standard
|
| 51 |
-
headers
|
| 52 |
|
| 53 |
**Table: C++headers for C library facilities** <a id="tab:cpp.c.headers">[tab:cpp.c.headers]</a>
|
| 54 |
|
| 55 |
| | | | | |
|
| 56 |
| ------------ | ------------- | ------------- | ----------- | ----------- |
|
|
@@ -60,34 +66,77 @@ headers, as shown in Table [[tab:cpp.c.headers]].
|
|
| 60 |
| `<cerrno>` | `<clocale>` | `<cstdbool>` | `<ctgmath>` | |
|
| 61 |
| `<cfenv>` | `<cmath>` | `<cstddef>` | `<ctime>` | |
|
| 62 |
| `<cfloat>` | `<csetjmp>` | `<cstdint>` | `<cuchar>` | |
|
| 63 |
|
| 64 |
|
| 65 |
-
Except as noted in Clauses [[
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
as if by inclusion. In the C++standard library, however, the
|
| 70 |
declarations (except for names which are defined as macros in C) are
|
| 71 |
within namespace scope ([[basic.scope.namespace]]) of the namespace
|
| 72 |
-
`std
|
| 73 |
-
|
| 74 |
-
|
|
|
|
|
|
|
| 75 |
|
| 76 |
Names which are defined as macros in C shall be defined as macros in the
|
| 77 |
C++ standard library, even if C grants license for implementation as
|
| 78 |
-
functions.
|
| 79 |
-
|
|
|
|
|
|
|
|
|
|
| 80 |
|
| 81 |
Names that are defined as functions in C shall be defined as functions
|
| 82 |
-
in the C++standard library.[^
|
| 83 |
|
| 84 |
Identifiers that are keywords or operators in C++shall not be defined as
|
| 85 |
-
macros in C++standard library headers.[^
|
| 86 |
|
| 87 |
[[depr.c.headers]], C standard library headers, describes the effects of
|
| 88 |
-
using the `name.h` (C header) form in a C++program.[^
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
|
| 90 |
#### Freestanding implementations <a id="compliance">[[compliance]]</a>
|
| 91 |
|
| 92 |
Two kinds of implementations are defined: *hosted* and *freestanding* (
|
| 93 |
[[intro.compliance]]). For a hosted implementation, this International
|
|
@@ -98,23 +147,24 @@ headers. This set shall include at least the headers shown in Table
|
|
| 98 |
[[tab:cpp.headers.freestanding]].
|
| 99 |
|
| 100 |
**Table: C++headers for freestanding implementations** <a id="tab:cpp.headers.freestanding">[tab:cpp.headers.freestanding]</a>
|
| 101 |
|
| 102 |
| Subclause | | Header |
|
| 103 |
-
| ----------------------
|
| 104 |
| | | `<ciso646>` |
|
| 105 |
| [[support.types]] | Types | `<cstddef>` |
|
| 106 |
| [[support.limits]] | Implementation properties | `<cfloat>` `<limits>` `<climits>` |
|
| 107 |
| [[cstdint]] | Integer types | `<cstdint>` |
|
| 108 |
| [[support.start.term]] | Start and termination | `<cstdlib>` |
|
| 109 |
| [[support.dynamic]] | Dynamic memory management | `<new>` |
|
| 110 |
| [[support.rtti]] | Type identification | `<typeinfo>` |
|
| 111 |
| [[support.exception]] | Exception handling | `<exception>` |
|
| 112 |
| [[support.initlist]] | Initializer lists | `<initializer_list>` |
|
| 113 |
-
| [[support.runtime]]
|
| 114 |
| [[meta]] | Type traits | `<type_traits>` |
|
| 115 |
| [[atomics]] | Atomics | `<atomic>` |
|
|
|
|
| 116 |
|
| 117 |
|
| 118 |
The supplied version of the header `<cstdlib>` shall declare at least
|
| 119 |
the functions `abort`, `atexit`, `at_quick_exit`, `exit`, and
|
| 120 |
`quick_exit` ([[support.start.term]]). The other headers listed in this
|
|
|
|
| 1 |
### Library contents and organization <a id="organization">[[organization]]</a>
|
| 2 |
|
| 3 |
+
[[contents]] describes the entities and macros defined in the
|
| 4 |
+
C++standard library. [[headers]] lists the standard library headers and
|
| 5 |
+
some constraints on those headers. [[compliance]] lists requirements for
|
| 6 |
+
a freestanding implementation of the C++ standard library.
|
| 7 |
|
| 8 |
#### Library contents <a id="contents">[[contents]]</a>
|
| 9 |
|
| 10 |
+
The C++standard library provides definitions for the entities and macros
|
| 11 |
+
described in the synopses of the C++standard library headers (
|
| 12 |
+
[[headers]]).
|
| 13 |
|
| 14 |
+
All library entities except `operator new` and `operator delete` are
|
| 15 |
+
defined within the namespace `std` or namespaces nested within namespace
|
| 16 |
+
`std`.[^12] It is unspecified whether names declared in a specific
|
| 17 |
+
namespace are declared directly in that namespace or in an inline
|
| 18 |
+
namespace inside that namespace.[^13]
|
| 19 |
|
| 20 |
Whenever a name `x` defined in the standard library is mentioned, the
|
| 21 |
name `x` is assumed to be fully qualified as `::std::x`, unless
|
| 22 |
+
explicitly described otherwise. For example, if the *Effects:* section
|
| 23 |
+
for library function `F` is described as calling library function `G`,
|
| 24 |
+
the function `::std::G` is meant.
|
| 25 |
|
| 26 |
#### Headers <a id="headers">[[headers]]</a>
|
| 27 |
|
| 28 |
Each element of the C++standard library is declared or defined (as
|
| 29 |
+
appropriate) in a *header*.[^14]
|
| 30 |
|
| 31 |
+
The C++standard library provides the *C++library headers*, shown in
|
| 32 |
Table [[tab:cpp.library.headers]].
|
| 33 |
|
| 34 |
**Table: C++library headers** <a id="tab:cpp.library.headers">[tab:cpp.library.headers]</a>
|
| 35 |
|
| 36 |
+
| | | | |
|
| 37 |
+
| ---------------------- | -------------------- | -------------------- | ----------------- |
|
| 38 |
+
| `<algorithm>` | `<future>` | `<numeric>` | `<strstream>` |
|
| 39 |
+
| `<any>` | `<initializer_list>` | `<optional>` | `<system_error>` |
|
| 40 |
+
| `<array>` | `<iomanip>` | `<ostream>` | `<thread>` |
|
| 41 |
+
| `<atomic>` | `<ios>` | `<queue>` | `<tuple>` |
|
| 42 |
+
| `<bitset>` | `<iosfwd>` | `<random>` | `<type_traits>` |
|
| 43 |
+
| `<chrono>` | `<iostream>` | `<ratio>` | `<typeindex>` |
|
| 44 |
+
| `<codecvt>` | `<istream>` | `<regex>` | `<typeinfo>` |
|
| 45 |
+
| `<complex>` | `<iterator>` | `<scoped_allocator>` | `<unordered_map>` |
|
| 46 |
+
| `<condition_variable>` | `<limits>` | `<set>` | `<unordered_set>` |
|
| 47 |
+
| `<deque>` | `<list>` | `<shared_mutex>` | `<utility>` |
|
| 48 |
+
| `<exception>` | `<locale>` | `<sstream>` | `<valarray>` |
|
| 49 |
+
| `<execution>` | `<map>` | `<stack>` | `<variant>` |
|
| 50 |
+
| `<filesystem>` | `<memory>` | `<stdexcept>` | `<vector>` |
|
| 51 |
+
| `<forward_list>` | `<memory_resource>` | `<streambuf>` | |
|
| 52 |
+
| `<fstream>` | `<mutex>` | `<string>` | |
|
| 53 |
+
| `<functional>` | `<new>` | `<string_view>` | |
|
| 54 |
|
| 55 |
|
| 56 |
+
The facilities of the C standard library are provided in the additional
|
| 57 |
+
headers shown in Table [[tab:cpp.c.headers]]. [^15]
|
| 58 |
|
| 59 |
**Table: C++headers for C library facilities** <a id="tab:cpp.c.headers">[tab:cpp.c.headers]</a>
|
| 60 |
|
| 61 |
| | | | | |
|
| 62 |
| ------------ | ------------- | ------------- | ----------- | ----------- |
|
|
|
|
| 66 |
| `<cerrno>` | `<clocale>` | `<cstdbool>` | `<ctgmath>` | |
|
| 67 |
| `<cfenv>` | `<cmath>` | `<cstddef>` | `<ctime>` | |
|
| 68 |
| `<cfloat>` | `<csetjmp>` | `<cstdint>` | `<cuchar>` | |
|
| 69 |
|
| 70 |
|
| 71 |
+
Except as noted in Clauses [[library]] through [[thread]] and Annex
|
| 72 |
+
[[depr]], the contents of each header `cname` is the same as that of the
|
| 73 |
+
corresponding header `name.h` as specified in the C standard library
|
| 74 |
+
(Clause [[intro.refs]]). In the C++standard library, however, the
|
|
|
|
| 75 |
declarations (except for names which are defined as macros in C) are
|
| 76 |
within namespace scope ([[basic.scope.namespace]]) of the namespace
|
| 77 |
+
`std`. It is unspecified whether these names (including any overloads
|
| 78 |
+
added in Clauses [[language.support]] through [[thread]] and Annex
|
| 79 |
+
[[depr]]) are first declared within the global namespace scope and are
|
| 80 |
+
then injected into namespace `std` by explicit *using-declaration*s (
|
| 81 |
+
[[namespace.udecl]]).
|
| 82 |
|
| 83 |
Names which are defined as macros in C shall be defined as macros in the
|
| 84 |
C++ standard library, even if C grants license for implementation as
|
| 85 |
+
functions.
|
| 86 |
+
|
| 87 |
+
[*Note 1*: The names defined as macros in C include the following:
|
| 88 |
+
`assert`, `offsetof`, `setjmp`, `va_arg`, `va_end`, and
|
| 89 |
+
`va_start`. — *end note*]
|
| 90 |
|
| 91 |
Names that are defined as functions in C shall be defined as functions
|
| 92 |
+
in the C++standard library.[^16]
|
| 93 |
|
| 94 |
Identifiers that are keywords or operators in C++shall not be defined as
|
| 95 |
+
macros in C++standard library headers.[^17]
|
| 96 |
|
| 97 |
[[depr.c.headers]], C standard library headers, describes the effects of
|
| 98 |
+
using the `name.h` (C header) form in a C++program.[^18]
|
| 99 |
+
|
| 100 |
+
Annex K of the C standard describes a large number of functions, with
|
| 101 |
+
associated types and macros, which “promote safer, more secure
|
| 102 |
+
programming” than many of the traditional C library functions. The names
|
| 103 |
+
of the functions have a suffix of `_s`; most of them provide the same
|
| 104 |
+
service as the C library function with the unsuffixed name, but
|
| 105 |
+
generally take an additional argument whose value is the size of the
|
| 106 |
+
result array. If any C++header is included, it is
|
| 107 |
+
*implementation-defined* whether any of these names is declared in the
|
| 108 |
+
global namespace. (None of them is declared in namespace `std`.)
|
| 109 |
+
|
| 110 |
+
Table [[tab:c.annex.k.names]] lists the Annex K names that may be
|
| 111 |
+
declared in some header. These names are also subject to the
|
| 112 |
+
restrictions of [[macro.names]].
|
| 113 |
+
|
| 114 |
+
**Table: C standard Annex K names** <a id="tab:c.annex.k.names">[tab:c.annex.k.names]</a>
|
| 115 |
+
|
| 116 |
+
| | | | |
|
| 117 |
+
| ---------------------- | -------------------------- | -------------- | ------------- |
|
| 118 |
+
| `abort_handler_s` | `mbstowcs_s` | `strncat_s` | `vswscanf_s` |
|
| 119 |
+
| `asctime_s` | `memcpy_s` | `strncpy_s` | `vwprintf_s` |
|
| 120 |
+
| `bsearch_s` | `memmove_s` | `strtok_s` | `vwscanf_s` |
|
| 121 |
+
| `constraint_handler_t` | `memset_s` | `swprintf_s` | `wcrtomb_s` |
|
| 122 |
+
| `ctime_s` | `printf_s` | `swscanf_s` | `wcscat_s` |
|
| 123 |
+
| `errno_t` | `qsort_s` | `tmpfile_s` | `wcscpy_s` |
|
| 124 |
+
| `fopen_s` | `RSIZE_MAX` | `TMP_MAX_S` | `wcsncat_s` |
|
| 125 |
+
| `fprintf_s` | `rsize_t` | `tmpnam_s` | `wcsncpy_s` |
|
| 126 |
+
| `freopen_s` | `scanf_s` | `vfprintf_s` | `wcsnlen_s` |
|
| 127 |
+
| `fscanf_s` | `set_constraint_handler_s` | `vfscanf_s` | `wcsrtombs_s` |
|
| 128 |
+
| `fwprintf_s` | `snprintf_s` | `vfwprintf_s` | `wcstok_s` |
|
| 129 |
+
| `fwscanf_s` | `snwprintf_s` | `vfwscanf_s` | `wcstombs_s` |
|
| 130 |
+
| `getenv_s` | `sprintf_s` | `vprintf_s` | `wctomb_s` |
|
| 131 |
+
| `gets_s` | `sscanf_s` | `vscanf_s` | `wmemcpy_s` |
|
| 132 |
+
| `gmtime_s` | `strcat_s` | `vsnprintf_s` | `wmemmove_s` |
|
| 133 |
+
| `ignore_handler_s` | `strcpy_s` | `vsnwprintf_s` | `wprintf_s` |
|
| 134 |
+
| `L_tmpnam_s` | `strerror_s` | `vsprintf_s` | `wscanf_s` |
|
| 135 |
+
| `localtime_s` | `strerrorlen_s` | `vsscanf_s` | |
|
| 136 |
+
| `mbsrtowcs_s` | `strlen_s` | `vswprintf_s` | |
|
| 137 |
+
|
| 138 |
|
| 139 |
#### Freestanding implementations <a id="compliance">[[compliance]]</a>
|
| 140 |
|
| 141 |
Two kinds of implementations are defined: *hosted* and *freestanding* (
|
| 142 |
[[intro.compliance]]). For a hosted implementation, this International
|
|
|
|
| 147 |
[[tab:cpp.headers.freestanding]].
|
| 148 |
|
| 149 |
**Table: C++headers for freestanding implementations** <a id="tab:cpp.headers.freestanding">[tab:cpp.headers.freestanding]</a>
|
| 150 |
|
| 151 |
| Subclause | | Header |
|
| 152 |
+
| --------------------------------------------- | ------------------------- | --------------------------------- |
|
| 153 |
| | | `<ciso646>` |
|
| 154 |
| [[support.types]] | Types | `<cstddef>` |
|
| 155 |
| [[support.limits]] | Implementation properties | `<cfloat>` `<limits>` `<climits>` |
|
| 156 |
| [[cstdint]] | Integer types | `<cstdint>` |
|
| 157 |
| [[support.start.term]] | Start and termination | `<cstdlib>` |
|
| 158 |
| [[support.dynamic]] | Dynamic memory management | `<new>` |
|
| 159 |
| [[support.rtti]] | Type identification | `<typeinfo>` |
|
| 160 |
| [[support.exception]] | Exception handling | `<exception>` |
|
| 161 |
| [[support.initlist]] | Initializer lists | `<initializer_list>` |
|
| 162 |
+
| [[support.runtime]] | Other runtime support | `<cstdarg>` |
|
| 163 |
| [[meta]] | Type traits | `<type_traits>` |
|
| 164 |
| [[atomics]] | Atomics | `<atomic>` |
|
| 165 |
+
| [[depr.cstdalign.syn]], [[depr.cstdbool.syn]] | Deprecated headers | `<cstdalign>` `<cstdbool>` |
|
| 166 |
|
| 167 |
|
| 168 |
The supplied version of the header `<cstdlib>` shall declare at least
|
| 169 |
the functions `abort`, `atexit`, `at_quick_exit`, `exit`, and
|
| 170 |
`quick_exit` ([[support.start.term]]). The other headers listed in this
|