tmp/tmpnn88o2pc/{from.md → to.md}
RENAMED
|
@@ -19,15 +19,15 @@ defined within the namespace `std` or namespaces nested within namespace
|
|
| 19 |
|
| 20 |
It is unspecified whether names declared in a specific namespace are
|
| 21 |
declared directly in that namespace or in an inline namespace inside
|
| 22 |
that namespace.[^13]
|
| 23 |
|
| 24 |
-
Whenever an unqualified name other than `swap`, `make_error_code`,
|
| 25 |
-
`make_error_condition`
|
| 26 |
-
in [[support]] through [[
|
| 27 |
-
established as-if by performing unqualified
|
| 28 |
-
[[basic.lookup.unqual]] in the context of `D`.
|
| 29 |
|
| 30 |
[*Note 1*: Argument-dependent lookup is not performed. — *end note*]
|
| 31 |
|
| 32 |
Similarly, the meaning of a *qualified-id* is established as-if by
|
| 33 |
performing qualified name lookup [[basic.lookup.qual]] in the context of
|
|
@@ -40,13 +40,14 @@ performing qualified name lookup [[basic.lookup.qual]] in the context of
|
|
| 40 |
[*Note 2*: Operators in expressions [[over.match.oper]] are not so
|
| 41 |
constrained; see [[global.functions]]. — *end note*]
|
| 42 |
|
| 43 |
The meaning of the unqualified name `swap` is established in an overload
|
| 44 |
resolution context for swappable values [[swappable.requirements]]. The
|
| 45 |
-
meanings of the unqualified names `make_error_code`
|
| 46 |
-
`make_error_condition`
|
| 47 |
-
argument-dependent lookup
|
|
|
|
| 48 |
|
| 49 |
#### Headers <a id="headers">[[headers]]</a>
|
| 50 |
|
| 51 |
Each element of the C++ standard library is declared or defined (as
|
| 52 |
appropriate) in a *header*.[^14]
|
|
@@ -72,18 +73,18 @@ import <vector>; // imports the <vector> header unit
|
|
| 72 |
std::vector<int> vi; // OK
|
| 73 |
```
|
| 74 |
|
| 75 |
— *end example*]
|
| 76 |
|
| 77 |
-
Except as noted in [[library]] through [[
|
| 78 |
contents of each header `cname` is the same as that of the corresponding
|
| 79 |
header `name.h` as specified in the C standard library [[intro.refs]].
|
| 80 |
In the C++ standard library, however, the declarations (except for names
|
| 81 |
which are defined as macros in C) are within namespace scope
|
| 82 |
[[basic.scope.namespace]] of the namespace `std`. It is unspecified
|
| 83 |
whether these names (including any overloads added in [[support]]
|
| 84 |
-
through [[
|
| 85 |
namespace scope and are then injected into namespace `std` by explicit
|
| 86 |
*using-declaration*s [[namespace.udecl]].
|
| 87 |
|
| 88 |
Names which are defined as macros in C shall be defined as macros in the
|
| 89 |
C++ standard library, even if C grants license for implementation as
|
|
@@ -97,15 +98,15 @@ Names that are defined as functions in C shall be defined as functions
|
|
| 97 |
in the C++ standard library.[^16]
|
| 98 |
|
| 99 |
Identifiers that are keywords or operators in C++ shall not be defined
|
| 100 |
as macros in C++ standard library headers.[^17]
|
| 101 |
|
| 102 |
-
[[support.c.headers]]
|
| 103 |
-
|
| 104 |
|
| 105 |
-
|
| 106 |
-
associated types and macros, which “promote safer, more secure
|
| 107 |
programming” than many of the traditional C library functions. The names
|
| 108 |
of the functions have a suffix of `_s`; most of them provide the same
|
| 109 |
service as the C library function with the unsuffixed name, but
|
| 110 |
generally take an additional argument whose value is the size of the
|
| 111 |
result array. If any C++ header is included, it is
|
|
@@ -126,21 +127,23 @@ subset provided by a freestanding implementation) and the C++ headers
|
|
| 126 |
for C library facilities ([[headers.cpp.c]]). It additionally exports
|
| 127 |
declarations in the global namespace for the storage allocation and
|
| 128 |
deallocation functions that are provided by `<new>`.
|
| 129 |
|
| 130 |
The named module `std.compat` exports the same declarations as the named
|
| 131 |
-
module `std`, and additionally exports
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
|
|
|
|
|
|
| 136 |
|
| 137 |
It is unspecified to which module a declaration in the standard library
|
| 138 |
is attached.
|
| 139 |
|
| 140 |
-
[*Note 1*:
|
| 141 |
-
`
|
| 142 |
[[basic.link]]. — *end note*]
|
| 143 |
|
| 144 |
*Recommended practice:* Implementations should ensure such attachments
|
| 145 |
do not preclude further evolution or decomposition of the standard
|
| 146 |
library modules.
|
|
@@ -169,35 +172,75 @@ headers. This set shall include at least the headers shown in
|
|
| 169 |
[[headers.cpp.fs]].
|
| 170 |
|
| 171 |
**Table: C++ headers for freestanding implementations** <a id="headers.cpp.fs">[headers.cpp.fs]</a>
|
| 172 |
|
| 173 |
| Subclause | | Header |
|
| 174 |
-
| ---------------------
|
| 175 |
| [[support.types]] | Common definitions | `<cstddef>` |
|
| 176 |
-
| [[
|
|
|
|
|
|
|
| 177 |
| [[cstdint.syn]] | Integer types | `<cstdint>` |
|
| 178 |
-
| [[support.start.term]] | Start and termination | `<cstdlib>` |
|
| 179 |
| [[support.dynamic]] | Dynamic memory management | `<new>` |
|
| 180 |
| [[support.rtti]] | Type identification | `<typeinfo>` |
|
| 181 |
| [[support.srcloc]] | Source location | `<source_location>` |
|
| 182 |
| [[support.exception]] | Exception handling | `<exception>` |
|
| 183 |
| [[support.initlist]] | Initializer lists | `<initializer_list>` |
|
| 184 |
| [[cmp]] | Comparisons | `<compare>` |
|
|
|
|
| 185 |
| [[support.coroutine]] | Coroutines support | `<coroutine>` |
|
| 186 |
| [[support.runtime]] | Other runtime support | `<cstdarg>` |
|
| 187 |
| [[concepts]] | Concepts library | `<concepts>` |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 188 |
| [[type.traits]] | Type traits | `<type_traits>` |
|
| 189 |
-
| [[
|
| 190 |
-
| [[atomics]] | Atomics | `<atomic>` |
|
| 191 |
| [[utility]] | Utility components | `<utility>` |
|
| 192 |
| [[tuple]] | Tuples | `<tuple>` |
|
| 193 |
-
| [[
|
|
|
|
|
|
|
| 194 |
| [[function.objects]] | Function objects | `<functional>` |
|
| 195 |
-
| [[
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 196 |
| [[iterators]] | Iterators library | `<iterator>` |
|
| 197 |
| [[ranges]] | Ranges library | `<ranges>` |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 198 |
|
| 199 |
|
| 200 |
For each of the headers listed in [[headers.cpp.fs]], a freestanding
|
| 201 |
implementation provides at least the freestanding items
|
| 202 |
[[freestanding.item]] declared in the header.
|
| 203 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
It is unspecified whether names declared in a specific namespace are
|
| 21 |
declared directly in that namespace or in an inline namespace inside
|
| 22 |
that namespace.[^13]
|
| 23 |
|
| 24 |
+
Whenever an unqualified name other than `swap`, `make_error_code`,
|
| 25 |
+
`make_error_condition`, `from_stream`, or `submdspan_mapping` is used in
|
| 26 |
+
the specification of a declaration `D` in [[support]] through [[exec]]
|
| 27 |
+
or [[depr]], its meaning is established as-if by performing unqualified
|
| 28 |
+
name lookup [[basic.lookup.unqual]] in the context of `D`.
|
| 29 |
|
| 30 |
[*Note 1*: Argument-dependent lookup is not performed. — *end note*]
|
| 31 |
|
| 32 |
Similarly, the meaning of a *qualified-id* is established as-if by
|
| 33 |
performing qualified name lookup [[basic.lookup.qual]] in the context of
|
|
|
|
| 40 |
[*Note 2*: Operators in expressions [[over.match.oper]] are not so
|
| 41 |
constrained; see [[global.functions]]. — *end note*]
|
| 42 |
|
| 43 |
The meaning of the unqualified name `swap` is established in an overload
|
| 44 |
resolution context for swappable values [[swappable.requirements]]. The
|
| 45 |
+
meanings of the unqualified names `make_error_code`,
|
| 46 |
+
`make_error_condition`, `from_stream`, and `submdspan_mapping` are
|
| 47 |
+
established as-if by performing argument-dependent lookup
|
| 48 |
+
[[basic.lookup.argdep]].
|
| 49 |
|
| 50 |
#### Headers <a id="headers">[[headers]]</a>
|
| 51 |
|
| 52 |
Each element of the C++ standard library is declared or defined (as
|
| 53 |
appropriate) in a *header*.[^14]
|
|
|
|
| 73 |
std::vector<int> vi; // OK
|
| 74 |
```
|
| 75 |
|
| 76 |
— *end example*]
|
| 77 |
|
| 78 |
+
Except as noted in [[library]] through [[exec]] and [[depr]], the
|
| 79 |
contents of each header `cname` is the same as that of the corresponding
|
| 80 |
header `name.h` as specified in the C standard library [[intro.refs]].
|
| 81 |
In the C++ standard library, however, the declarations (except for names
|
| 82 |
which are defined as macros in C) are within namespace scope
|
| 83 |
[[basic.scope.namespace]] of the namespace `std`. It is unspecified
|
| 84 |
whether these names (including any overloads added in [[support]]
|
| 85 |
+
through [[exec]] and [[depr]]) are first declared within the global
|
| 86 |
namespace scope and are then injected into namespace `std` by explicit
|
| 87 |
*using-declaration*s [[namespace.udecl]].
|
| 88 |
|
| 89 |
Names which are defined as macros in C shall be defined as macros in the
|
| 90 |
C++ standard library, even if C grants license for implementation as
|
|
|
|
| 98 |
in the C++ standard library.[^16]
|
| 99 |
|
| 100 |
Identifiers that are keywords or operators in C++ shall not be defined
|
| 101 |
as macros in C++ standard library headers.[^17]
|
| 102 |
|
| 103 |
+
Subclause [[support.c.headers]] describes the effects of using the
|
| 104 |
+
`name.h` (C header) form in a C++ program.[^18]
|
| 105 |
|
| 106 |
+
ISO/IEC 9899:2018 (C), Annex K describes a large number of functions,
|
| 107 |
+
with associated types and macros, which “promote safer, more secure
|
| 108 |
programming” than many of the traditional C library functions. The names
|
| 109 |
of the functions have a suffix of `_s`; most of them provide the same
|
| 110 |
service as the C library function with the unsuffixed name, but
|
| 111 |
generally take an additional argument whose value is the size of the
|
| 112 |
result array. If any C++ header is included, it is
|
|
|
|
| 127 |
for C library facilities ([[headers.cpp.c]]). It additionally exports
|
| 128 |
declarations in the global namespace for the storage allocation and
|
| 129 |
deallocation functions that are provided by `<new>`.
|
| 130 |
|
| 131 |
The named module `std.compat` exports the same declarations as the named
|
| 132 |
+
module `std`, and additionally exports
|
| 133 |
+
|
| 134 |
+
- declarations in the global namespace corresponding to the declarations
|
| 135 |
+
in namespace `std` that are provided by the C++ headers for C library
|
| 136 |
+
facilities ([[headers.cpp.c]]), except the explicitly excluded
|
| 137 |
+
declarations described in [[support.c.headers.other]] and
|
| 138 |
+
- declarations provided by the headers `<stdbit.h>` and `<stdckdint.h>`.
|
| 139 |
|
| 140 |
It is unspecified to which module a declaration in the standard library
|
| 141 |
is attached.
|
| 142 |
|
| 143 |
+
[*Note 1*: Conforming implementations ensure that mixing `#include` and
|
| 144 |
+
`import` does not result in conflicting attachments
|
| 145 |
[[basic.link]]. — *end note*]
|
| 146 |
|
| 147 |
*Recommended practice:* Implementations should ensure such attachments
|
| 148 |
do not preclude further evolution or decomposition of the standard
|
| 149 |
library modules.
|
|
|
|
| 172 |
[[headers.cpp.fs]].
|
| 173 |
|
| 174 |
**Table: C++ headers for freestanding implementations** <a id="headers.cpp.fs">[headers.cpp.fs]</a>
|
| 175 |
|
| 176 |
| Subclause | | Header |
|
| 177 |
+
| --------------------- | ----------------------------------------------- | ------------------------------------ |
|
| 178 |
| [[support.types]] | Common definitions | `<cstddef>` |
|
| 179 |
+
| [[cstdlib.syn]] | C standard library | `<cstdlib>` |
|
| 180 |
+
| [[support.limits]] | Implementation properties | `<cfloat>`, `<climits>`, `<limits>`, |
|
| 181 |
+
| | | `<version>` |
|
| 182 |
| [[cstdint.syn]] | Integer types | `<cstdint>` |
|
|
|
|
| 183 |
| [[support.dynamic]] | Dynamic memory management | `<new>` |
|
| 184 |
| [[support.rtti]] | Type identification | `<typeinfo>` |
|
| 185 |
| [[support.srcloc]] | Source location | `<source_location>` |
|
| 186 |
| [[support.exception]] | Exception handling | `<exception>` |
|
| 187 |
| [[support.initlist]] | Initializer lists | `<initializer_list>` |
|
| 188 |
| [[cmp]] | Comparisons | `<compare>` |
|
| 189 |
+
| [[support.contract]] | Contract-violation handling | `<contracts>` |
|
| 190 |
| [[support.coroutine]] | Coroutines support | `<coroutine>` |
|
| 191 |
| [[support.runtime]] | Other runtime support | `<cstdarg>` |
|
| 192 |
| [[concepts]] | Concepts library | `<concepts>` |
|
| 193 |
+
| [[errno]] | Error numbers | `<cerrno>` |
|
| 194 |
+
| [[syserr]] | System error support | `<system_error>` |
|
| 195 |
+
| [[debugging]] | Debugging | `<debugging>` |
|
| 196 |
+
| [[memory]] | Memory | `<memory>` |
|
| 197 |
| [[type.traits]] | Type traits | `<type_traits>` |
|
| 198 |
+
| [[ratio]] | Compile-time rational arithmetic | `<ratio>` |
|
|
|
|
| 199 |
| [[utility]] | Utility components | `<utility>` |
|
| 200 |
| [[tuple]] | Tuples | `<tuple>` |
|
| 201 |
+
| [[optional]] | Optional objects | `<optional>` |
|
| 202 |
+
| [[variant]] | Variants | `<variant>` |
|
| 203 |
+
| [[expected]] | Expected objects | `<expected>` |
|
| 204 |
| [[function.objects]] | Function objects | `<functional>` |
|
| 205 |
+
| [[bit]] | Bit manipulation | `<bit>` |
|
| 206 |
+
| [[stdbit.h.syn]] | C-compatible bit manipulation | `<stdbit.h>` |
|
| 207 |
+
| [[array]] | Class template `array` | `<array>` |
|
| 208 |
+
| [[inplace.vector]] | Class template `inplace_vector` | `<inplace_vector>` |
|
| 209 |
+
| [[views.contiguous]] | Contiguous access | `<span>` |
|
| 210 |
+
| [[views.multidim]] | Multidimensional access | `<mdspan>` |
|
| 211 |
| [[iterators]] | Iterators library | `<iterator>` |
|
| 212 |
| [[ranges]] | Ranges library | `<ranges>` |
|
| 213 |
+
| [[algorithms]] | Algorithms library | `<algorithm>`, `<numeric>` |
|
| 214 |
+
| [[execpol]] | Execution policies | `<execution>` |
|
| 215 |
+
| [[string.view]] | String view classes | `<string_view>` |
|
| 216 |
+
| [[string.classes]] | String classes | `<string>` |
|
| 217 |
+
| [[c.strings]] | Null-terminated sequence utilities | `<cstring>`, `<cwchar>` |
|
| 218 |
+
| [[charconv]] | Primitive numeric conversions | `<charconv>` |
|
| 219 |
+
| [[rand]] | Random number generation | `<random>` |
|
| 220 |
+
| [[c.math]] | Mathematical functions for floating-point types | `<cmath>` |
|
| 221 |
+
| [[atomics]] | Atomics | `<atomic>` |
|
| 222 |
|
| 223 |
|
| 224 |
For each of the headers listed in [[headers.cpp.fs]], a freestanding
|
| 225 |
implementation provides at least the freestanding items
|
| 226 |
[[freestanding.item]] declared in the header.
|
| 227 |
|
| 228 |
+
The *hosted library facilities* are the set of facilities described in
|
| 229 |
+
this document that are required for hosted implementations, but not
|
| 230 |
+
required for freestanding implementations. A freestanding implementation
|
| 231 |
+
provides a (possibly empty) implementation-defined subset of the hosted
|
| 232 |
+
library facilities. Unless otherwise specified, the requirements on each
|
| 233 |
+
declaration, entity, and macro provided in this way are the same as the
|
| 234 |
+
corresponding requirements for a hosted implementation, except that not
|
| 235 |
+
all of the members of the namespaces are required to be present.
|
| 236 |
+
|
| 237 |
+
A freestanding implementation provides deleted definitions
|
| 238 |
+
[[dcl.fct.def.delete]] for a (possibly empty) implementation-defined
|
| 239 |
+
subset of the namespace-scope functions and function templates from the
|
| 240 |
+
hosted library facilities.
|
| 241 |
+
|
| 242 |
+
[*Note 1*: An implementation can provide a deleted definition so that
|
| 243 |
+
the result of overload resolution does not silently change when
|
| 244 |
+
migrating a program from a freestanding implementation to a hosted
|
| 245 |
+
implementation. — *end note*]
|
| 246 |
+
|