Init
This commit is contained in:
503
cppdraft/organization.md
Normal file
503
cppdraft/organization.md
Normal file
@@ -0,0 +1,503 @@
|
||||
[organization]
|
||||
|
||||
# 16 Library introduction [[library]](./#library)
|
||||
|
||||
## 16.4 Library-wide requirements [[requirements]](requirements#organization)
|
||||
|
||||
### 16.4.2 Library contents and organization [organization]
|
||||
|
||||
#### [16.4.2.1](#general) General [[organization.general]](organization.general)
|
||||
|
||||
[1](#general-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L1109)
|
||||
|
||||
[[contents]](#contents "16.4.2.2 Library contents") describes the entities and macros defined in the C++ standard library[.](#general-1.sentence-1)
|
||||
|
||||
[[headers]](#headers "16.4.2.3 Headers") lists the standard library headers and some constraints on those headers[.](#general-1.sentence-2)
|
||||
|
||||
[[compliance]](#compliance "16.4.2.5 Freestanding implementations") lists requirements for a freestanding implementation of the C++
|
||||
standard library[.](#general-1.sentence-3)
|
||||
|
||||
#### [16.4.2.2](#contents) Library contents [[contents]](contents)
|
||||
|
||||
[1](#contents-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L1117)
|
||||
|
||||
The C++ standard library provides definitions
|
||||
for the entities and macros described in the synopses
|
||||
of the C++ standard library headers ([[headers]](#headers "16.4.2.3 Headers")),
|
||||
unless otherwise specified[.](#contents-1.sentence-1)
|
||||
|
||||
[2](#contents-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L1123)
|
||||
|
||||
All library entities exceptoperator new andoperator delete are defined within the namespacestd or namespaces nested within namespacestd[.](#contents-2.sentence-1)[142](#footnote-142 "The C standard library headers ([support.c.headers]) also define names within the global namespace, while the C++ headers for C library facilities ([headers]) can also define names within the global namespace.")
|
||||
|
||||
It is unspecified whether names declared in a specific namespace are declared
|
||||
directly in that namespace or in an inline namespace inside that
|
||||
namespace[.](#contents-2.sentence-2)[143](#footnote-143 "This gives implementers freedom to use inline namespaces to support multiple configurations of the library.")
|
||||
|
||||
[3](#contents-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L1146)
|
||||
|
||||
Whenever an unqualified name other thanswap, make_error_code, make_error_condition,from_stream, orsubmdspan_mapping is used in the specification of a declaration D in [[support]](support "17 Language support library") through [[exec]](exec "33 Execution control library") or [[depr]](depr "Annex D (normative) Compatibility features"),
|
||||
its meaning is established
|
||||
as-if by performing unqualified name lookup ([[basic.lookup.unqual]](basic.lookup.unqual "6.5.3 Unqualified name lookup"))
|
||||
in the context of D[.](#contents-3.sentence-1)
|
||||
|
||||
[*Note [1](#contents-note-1)*:
|
||||
|
||||
Argument-dependent lookup is not performed[.](#contents-3.sentence-2)
|
||||
|
||||
â *end note*]
|
||||
|
||||
Similarly, the meaning of a [*qualified-id*](expr.prim.id.qual#nt:qualified-id "7.5.5.3 Qualified names [expr.prim.id.qual]") is established
|
||||
as-if by performing qualified name lookup ([[basic.lookup.qual]](basic.lookup.qual "6.5.5 Qualified name lookup"))
|
||||
in the context of D[.](#contents-3.sentence-3)
|
||||
|
||||
[*Example [1](#contents-example-1)*:
|
||||
|
||||
The reference to is_array_v in the specification of std::to_array ([[array.creation]](array.creation "23.3.3.6 Array creation functions")) refers to ::std::is_array_v[.](#contents-3.sentence-4)
|
||||
|
||||
â *end example*]
|
||||
|
||||
[*Note [2](#contents-note-2)*:
|
||||
|
||||
Operators in expressions ([[over.match.oper]](over.match.oper "12.2.2.3 Operators in expressions")) are not so constrained;
|
||||
see [[global.functions]](global.functions "16.4.6.4 Non-member functions")[.](#contents-3.sentence-5)
|
||||
|
||||
â *end note*]
|
||||
|
||||
The meaning of the unqualified name swap is established
|
||||
in an overload resolution context
|
||||
for swappable values ([[swappable.requirements]](swappable.requirements "16.4.4.3 Swappable requirements"))[.](#contents-3.sentence-6)
|
||||
|
||||
The meanings of the unqualified namesmake_error_code, make_error_condition,from_stream, andsubmdspan_mapping are established
|
||||
as-if by performing argument-dependent lookup ([[basic.lookup.argdep]](basic.lookup.argdep "6.5.4 Argument-dependent name lookup"))[.](#contents-3.sentence-7)
|
||||
|
||||
[142)](#footnote-142)[142)](#footnoteref-142)
|
||||
|
||||
The C standard library headers ([[support.c.headers]](support.c.headers "17.15 C headers")) also define
|
||||
names within the global namespace, while the C++ headers for C library
|
||||
facilities ([[headers]](#headers "16.4.2.3 Headers")) can also define names within the global namespace[.](#footnote-142.sentence-1)
|
||||
|
||||
[143)](#footnote-143)[143)](#footnoteref-143)
|
||||
|
||||
This gives implementers freedom to use inline namespaces to
|
||||
support multiple configurations of the library[.](#footnote-143.sentence-1)
|
||||
|
||||
#### [16.4.2.3](#headers) Headers [[headers]](headers)
|
||||
|
||||
[1](#headers-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L1182)
|
||||
|
||||
Each element of the C++ standard library is declared or defined (as appropriate) in a[*header*](#def:header "16.4.2.3 Headers [headers]")[.](#headers-1.sentence-1)[144](#footnote-144 "A header is not necessarily a source file, nor are the sequences delimited by < and > in header names necessarily valid source file names ([cpp.include]).")
|
||||
|
||||
[2](#headers-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L1191)
|
||||
|
||||
The C++ standard library provides the[*C++ library headers*](#def:header,C++_library "16.4.2.3 Headers [headers]"),
|
||||
shown in Table [24](#tab:headers.cpp "Table 24: C++ library headers")[.](#headers-2.sentence-1)
|
||||
|
||||
Table [24](#tab:headers.cpp) — C++ library headers [[tab:headers.cpp]](./tab:headers.cpp)
|
||||
|
||||
| [ð](#tab:headers.cpp-row-1)<br><algorithm> | <forward_list> | <meta> | <stack> |
|
||||
| --- | --- | --- | --- |
|
||||
| [ð](#tab:headers.cpp-row-2)<br><any> | <fstream> | <mutex> | <stacktrace> |
|
||||
| [ð](#tab:headers.cpp-row-3)<br><array> | <functional> | <new> | <stdexcept> |
|
||||
| [ð](#tab:headers.cpp-row-4)<br><atomic> | <future> | <numbers> | <stdfloat> |
|
||||
| [ð](#tab:headers.cpp-row-5)<br><barrier> | <generator> | <numeric> | <stop_token> |
|
||||
| [ð](#tab:headers.cpp-row-6)<br><bit> | <hazard_pointer> | <optional> | <streambuf> |
|
||||
| [ð](#tab:headers.cpp-row-7)<br><bitset> | <hive> | <ostream> | <string> |
|
||||
| [ð](#tab:headers.cpp-row-8)<br><charconv> | <initializer_list> | <print> | <string_view> |
|
||||
| [ð](#tab:headers.cpp-row-9)<br><chrono> | <inplace_vector> | <queue> | <syncstream> |
|
||||
| [ð](#tab:headers.cpp-row-10)<br><compare> | <iomanip> | <random> | <system_error> |
|
||||
| [ð](#tab:headers.cpp-row-11)<br><complex> | <ios> | <ranges> | <text_encoding> |
|
||||
| [ð](#tab:headers.cpp-row-12)<br><concepts> | <iosfwd> | <ratio> | <thread> |
|
||||
| [ð](#tab:headers.cpp-row-13)<br><condition_variable> | <iostream> | <rcu> | <tuple> |
|
||||
| [ð](#tab:headers.cpp-row-14)<br><contracts> | <istream> | <regex> | <type_traits> |
|
||||
| [ð](#tab:headers.cpp-row-15)<br><coroutine> | <iterator> | <scoped_allocator> | <typeindex> |
|
||||
| [ð](#tab:headers.cpp-row-16)<br><debugging> | <latch> | <semaphore> | <typeinfo> |
|
||||
| [ð](#tab:headers.cpp-row-17)<br><deque> | <limits> | <set> | <unordered_map> |
|
||||
| [ð](#tab:headers.cpp-row-18)<br><exception> | <linalg> | <shared_mutex> | <unordered_set> |
|
||||
| [ð](#tab:headers.cpp-row-19)<br><execution> | <list> | <simd> | <utility> |
|
||||
| [ð](#tab:headers.cpp-row-20)<br><expected> | <locale> | <source_location> | <valarray> |
|
||||
| [ð](#tab:headers.cpp-row-21)<br><filesystem> | <map> | <span> | <variant> |
|
||||
| [ð](#tab:headers.cpp-row-22)<br><flat_map> | <mdspan> | <spanstream> | <vector> |
|
||||
| [ð](#tab:headers.cpp-row-23)<br><flat_set> | <memory> | <sstream> | <version> |
|
||||
| [ð](#tab:headers.cpp-row-24)<br><format> | <memory_resource> | | |
|
||||
|
||||
[3](#headers-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L1297)
|
||||
|
||||
The facilities of the C standard library are provided in theadditional headers shown in Table [25](#tab:headers.cpp.c "Table 25: C++ headers for C library facilities")[.](#headers-3.sentence-1)[145](#footnote-145 "It is intentional that there is no C++ header for any of these C headers: <stdnoreturn.h>, <threads.h>.")
|
||||
|
||||
Table [25](#tab:headers.cpp.c) — C++ headers for C library facilities [[tab:headers.cpp.c]](./tab:headers.cpp.c)
|
||||
|
||||
| [ð](#tab:headers.cpp.c-row-1)<br><cassert> | <cfenv> | <climits> | <csetjmp> | <cstddef> | <cstdlib> | <cuchar> |
|
||||
| --- | --- | --- | --- | --- | --- | --- |
|
||||
| [ð](#tab:headers.cpp.c-row-2)<br><cctype> | <cfloat> | <clocale> | <csignal> | <cstdint> | <cstring> | <cwchar> |
|
||||
| [ð](#tab:headers.cpp.c-row-3)<br><cerrno> | <cinttypes> | <cmath> | <cstdarg> | <cstdio> | <ctime> | <cwctype> |
|
||||
|
||||
[4](#headers-4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L1339)
|
||||
|
||||
The headers listed in Table [24](#tab:headers.cpp "Table 24: C++ library headers"), or,
|
||||
for a freestanding implementation,
|
||||
the subset of such headers that are provided by the implementation,
|
||||
are collectively known as
|
||||
the [*importable C++ library headers*](#def:C++_library_headers,importable "16.4.2.3 Headers [headers]")[.](#headers-4.sentence-1)
|
||||
|
||||
[*Note [1](#headers-note-1)*:
|
||||
|
||||
Importable C++ library headers can be
|
||||
imported ([[module.import]](module.import "10.3 Import declaration"))[.](#headers-4.sentence-2)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[*Example [1](#headers-example-1)*: import <vector>; // imports the <vector> header unit std::vector<int> vi; // OK â *end example*]
|
||||
|
||||
[5](#headers-5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L1356)
|
||||
|
||||
Except as noted in [[library]](library "16 Library introduction") through [[exec]](exec "33 Execution control library") and [[depr]](depr "Annex D (normative) Compatibility features"), the contents of each header c*name* is
|
||||
the same as that of the corresponding header *name*.h as
|
||||
specified in the [C standard library](intro.refs#def:C,standard_library "2 Normative references [intro.refs]")[.](#headers-5.sentence-1)
|
||||
|
||||
In the C++ standard library, however, the
|
||||
declarations (except for names which are defined as macros in C) are within[namespace scope](basic.scope.namespace "6.4.6 Namespace scope [basic.scope.namespace]") of the namespace std[.](#headers-5.sentence-2)
|
||||
|
||||
It is unspecified whether these names (including any overloads added in[[support]](support "17 Language support library") through [[exec]](exec "33 Execution control library") and [[depr]](depr "Annex D (normative) Compatibility features"))
|
||||
are first declared within the global namespace scope
|
||||
and are then injected into namespace std by explicit[*using-declaration*](namespace.udecl#nt:using-declaration "9.10 The using declaration [namespace.udecl]")*s* ([[namespace.udecl]](namespace.udecl "9.10 The using declaration"))[.](#headers-5.sentence-3)
|
||||
|
||||
[6](#headers-6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L1370)
|
||||
|
||||
Names which are defined as macros in C shall be defined as macros in the C++
|
||||
standard library, even if C grants license for implementation as functions[.](#headers-6.sentence-1)
|
||||
|
||||
[*Note [2](#headers-note-2)*:
|
||||
|
||||
The names defined as macros in C include the following:assert, offsetof, setjmp, va_arg,va_end, and va_start[.](#headers-6.sentence-2)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[7](#headers-7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L1379)
|
||||
|
||||
Names that are defined as functions in C shall be defined as functions in the
|
||||
C++ standard library[.](#headers-7.sentence-1)[146](#footnote-146 "This disallows the practice, allowed in C, of providing a masking macro in addition to the function prototype. The only way to achieve equivalent inline behavior in C++ is to provide a definition as an extern inline function.")
|
||||
|
||||
[8](#headers-8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L1389)
|
||||
|
||||
Identifiers that are keywords or operators in C++ shall not be defined as
|
||||
macros in C++ standard library headers[.](#headers-8.sentence-1)[147](#footnote-147 "In particular, including the standard header <iso646.h> has no effect.")
|
||||
|
||||
[9](#headers-9)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L1397)
|
||||
|
||||
Subclause [[support.c.headers]](support.c.headers "17.15 C headers") describes the effects of using
|
||||
the *name*.h (C header) form in a C++ program[.](#headers-9.sentence-1)[148](#footnote-148 "The ".h" headers dump all their names into the global namespace, whereas the newer forms keep their names in namespace std. Therefore, the newer forms are the preferred forms for all uses except for C++ programs which are intended to be strictly compatible with C.")
|
||||
|
||||
[10](#headers-10)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L1408)
|
||||
|
||||
ISO/IEC 9899:2024, Annex K describes a large number of functions,
|
||||
with associated types and macros,
|
||||
which âpromote safer, more secure programmingâ
|
||||
than many of the traditional C library functions[.](#headers-10.sentence-1)
|
||||
|
||||
The names of the functions have a suffix of _s;
|
||||
most of them provide the same service
|
||||
as the C library function with the unsuffixed name,
|
||||
but generally take an additional argument
|
||||
whose value is the size of the result array[.](#headers-10.sentence-2)
|
||||
|
||||
If any C++ header is included,
|
||||
it is implementation-defined
|
||||
whether any of these names
|
||||
is declared in the global namespace[.](#headers-10.sentence-3)
|
||||
|
||||
(None of them is declared in namespace std[.](#headers-10.sentence-4))
|
||||
|
||||
[11](#headers-11)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L1425)
|
||||
|
||||
Table [26](#tab:c.annex.k.names "Table 26: Names from ISO/IEC 9899:2024, Annex K") lists the Annex K names
|
||||
that may be declared in some header[.](#headers-11.sentence-1)
|
||||
|
||||
These names are also subject to the restrictions of [[macro.names]](macro.names "16.4.5.3.3 Macro names")[.](#headers-11.sentence-2)
|
||||
|
||||
Table [26](#tab:c.annex.k.names) — Names from ISO/IEC 9899:2024, Annex K [[tab:c.annex.k.names]](./tab:c.annex.k.names)
|
||||
|
||||
| [ð](#tab:c.annex.k.names-row-1)<br>abort_handler_s | mbstowcs_s | strncat_s | vswscanf_s |
|
||||
| --- | --- | --- | --- |
|
||||
| [ð](#tab:c.annex.k.names-row-2)<br>asctime_s | memcpy_s | strncpy_s | vwprintf_s |
|
||||
| [ð](#tab:c.annex.k.names-row-3)<br>bsearch_s | memmove_s | strtok_s | vwscanf_s |
|
||||
| [ð](#tab:c.annex.k.names-row-4)<br>constraint_handler_t | memset_s | swprintf_s | wcrtomb_s |
|
||||
| [ð](#tab:c.annex.k.names-row-5)<br>ctime_s | printf_s | swscanf_s | wcscat_s |
|
||||
| [ð](#tab:c.annex.k.names-row-6)<br>errno_t | qsort_s | tmpfile_s | wcscpy_s |
|
||||
| [ð](#tab:c.annex.k.names-row-7)<br>fopen_s | RSIZE_MAX | TMP_MAX_S | wcsncat_s |
|
||||
| [ð](#tab:c.annex.k.names-row-8)<br>fprintf_s | rsize_t | tmpnam_s | wcsncpy_s |
|
||||
| [ð](#tab:c.annex.k.names-row-9)<br>freopen_s | scanf_s | vfprintf_s | wcsnlen_s |
|
||||
| [ð](#tab:c.annex.k.names-row-10)<br>fscanf_s | set_constraint_handler_s | vfscanf_s | wcsrtombs_s |
|
||||
| [ð](#tab:c.annex.k.names-row-11)<br>fwprintf_s | snprintf_s | vfwprintf_s | wcstok_s |
|
||||
| [ð](#tab:c.annex.k.names-row-12)<br>fwscanf_s | snwprintf_s | vfwscanf_s | wcstombs_s |
|
||||
| [ð](#tab:c.annex.k.names-row-13)<br>getenv_s | sprintf_s | vprintf_s | wctomb_s |
|
||||
| [ð](#tab:c.annex.k.names-row-14)<br>gets_s | sscanf_s | vscanf_s | wmemcpy_s |
|
||||
| [ð](#tab:c.annex.k.names-row-15)<br>gmtime_s | strcat_s | vsnprintf_s | wmemmove_s |
|
||||
| [ð](#tab:c.annex.k.names-row-16)<br>ignore_handler_s | strcpy_s | vsnwprintf_s | wprintf_s |
|
||||
| [ð](#tab:c.annex.k.names-row-17)<br>localtime_s | strerrorlen_s | vsprintf_s | wscanf_s |
|
||||
| [ð](#tab:c.annex.k.names-row-18)<br>L_tmpnam_s | strerror_s | vsscanf_s | |
|
||||
| [ð](#tab:c.annex.k.names-row-19)<br>mbsrtowcs_s | strlen_s | vswprintf_s | |
|
||||
|
||||
[144)](#footnote-144)[144)](#footnoteref-144)
|
||||
|
||||
A header is not necessarily a source file, nor are the
|
||||
sequences delimited by < and > in header names necessarily valid source
|
||||
file names ([[cpp.include]](cpp.include "15.3 Source file inclusion"))[.](#footnote-144.sentence-1)
|
||||
|
||||
[145)](#footnote-145)[145)](#footnoteref-145)
|
||||
|
||||
It is intentional that there is no C++ header
|
||||
for any of these C headers:<stdnoreturn.h>,<threads.h>[.](#footnote-145.sentence-1)
|
||||
|
||||
[146)](#footnote-146)[146)](#footnoteref-146)
|
||||
|
||||
This disallows the practice, allowed in C, of
|
||||
providing a masking macro in addition to the function prototype[.](#footnote-146.sentence-1)
|
||||
|
||||
The only way to
|
||||
achieve equivalent inline behavior in C++ is to provide a definition as an
|
||||
extern inline function[.](#footnote-146.sentence-2)
|
||||
|
||||
[147)](#footnote-147)[147)](#footnoteref-147)
|
||||
|
||||
In particular, including the
|
||||
standard header [<iso646.h>](iso646.h.syn#header:%3ciso646.h%3e "17.15.3 Header <iso646.h> synopsis [iso646.h.syn]") has no effect[.](#footnote-147.sentence-1)
|
||||
|
||||
[148)](#footnote-148)[148)](#footnoteref-148)
|
||||
|
||||
The".h" headers dump all their names into the global namespace, whereas the
|
||||
newer forms keep their names in namespace std[.](#footnote-148.sentence-1)
|
||||
|
||||
Therefore, the newer
|
||||
forms are the preferred forms for all uses except for C++ programs which are
|
||||
intended to be strictly compatible with C[.](#footnote-148.sentence-2)
|
||||
|
||||
#### [16.4.2.4](#std.modules) Modules [[std.modules]](std.modules)
|
||||
|
||||
[1](#std.modules-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L1513)
|
||||
|
||||
The C++ standard library provides
|
||||
the following [*C++ library modules*](#def:C++_library_modules "16.4.2.4 Modules [std.modules]")[.](#std.modules-1.sentence-1)
|
||||
|
||||
[2](#std.modules-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L1517)
|
||||
|
||||
The named module std exports declarations in namespace std that are provided by the importable C++ library headers
|
||||
(Table [24](#tab:headers.cpp "Table 24: C++ library headers") or the subset provided by a freestanding implementation)
|
||||
and the C++ headers for C library facilities (Table [25](#tab:headers.cpp.c "Table 25: C++ headers for C library facilities"))[.](#std.modules-2.sentence-1)
|
||||
|
||||
It additionally exports declarations in the global namespace
|
||||
for the storage allocation and deallocation functions
|
||||
that are provided by [<new>](support.dynamic.general#header:%3cnew%3e "17.6.1 General [support.dynamic.general]")[.](#std.modules-2.sentence-2)
|
||||
|
||||
[3](#std.modules-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L1526)
|
||||
|
||||
The named module std.compat exports the same declarations as
|
||||
the named module std, and
|
||||
additionally exports
|
||||
|
||||
- [(3.1)](#std.modules-3.1)
|
||||
|
||||
declarations in the global namespace
|
||||
corresponding to the declarations in namespace std that are provided by
|
||||
the C++ headers for C library facilities (Table [25](#tab:headers.cpp.c "Table 25: C++ headers for C library facilities")),
|
||||
except the explicitly excluded declarations
|
||||
described in [[support.c.headers.other]](support.c.headers.other "17.15.7 Other C headers") and
|
||||
|
||||
- [(3.2)](#std.modules-3.2)
|
||||
|
||||
declarations provided by
|
||||
the headers [<stdbit.h>](stdbit.h.syn#header:%3cstdbit.h%3e "22.12 Header <stdbit.h> synopsis [stdbit.h.syn]") and [<stdckdint.h>](stdckdint.h.syn#header:%3cstdckdint.h%3e "29.11.1 Header <stdckdint.h> synopsis [stdckdint.h.syn]")[.](#std.modules-3.sentence-1)
|
||||
|
||||
[4](#std.modules-4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L1543)
|
||||
|
||||
It is unspecified to which module a declaration in the standard library
|
||||
is attached[.](#std.modules-4.sentence-1)
|
||||
|
||||
[*Note [1](#std.modules-note-1)*:
|
||||
|
||||
Conforming implementations ensure that mixing#include and import does not result in
|
||||
conflicting attachments ([[basic.link]](basic.link "6.7 Program and linkage"))[.](#std.modules-4.sentence-2)
|
||||
|
||||
â *end note*]
|
||||
|
||||
*Recommended practice*: Implementations should ensure such attachments do not preclude
|
||||
further evolution or decomposition of the standard library modules[.](#std.modules-4.sentence-3)
|
||||
|
||||
[5](#std.modules-5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L1555)
|
||||
|
||||
A declaration in the standard library denotes the same entity regardless of
|
||||
whether it was made reachable through
|
||||
including a header,
|
||||
importing a header unit, or
|
||||
importing a C++ library module[.](#std.modules-5.sentence-1)
|
||||
|
||||
[6](#std.modules-6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L1562)
|
||||
|
||||
*Recommended practice*: Implementations should avoid exporting any other declarations
|
||||
from the C++ library modules[.](#std.modules-6.sentence-1)
|
||||
|
||||
[*Note [2](#std.modules-note-2)*:
|
||||
|
||||
Like all named modules, the C++ library modules
|
||||
do not make macros visible ([[module.import]](module.import "10.3 Import declaration")), such asassert ([[cassert.syn]](cassert.syn "19.3.2 Header <cassert> synopsis")),errno ([[cerrno.syn]](cerrno.syn "19.4.2 Header <cerrno> synopsis")),offsetof ([[cstddef.syn]](cstddef.syn "17.2.1 Header <cstddef> synopsis")), andva_arg ([[cstdarg.syn]](cstdarg.syn "17.14.2 Header <cstdarg> synopsis"))[.](#std.modules-6.sentence-2)
|
||||
|
||||
â *end note*]
|
||||
|
||||
#### [16.4.2.5](#compliance) Freestanding implementations [[compliance]](compliance)
|
||||
|
||||
[1](#compliance-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L1579)
|
||||
|
||||
Two kinds of implementations are defined:hosted and freestanding ([[intro.compliance]](intro.compliance "4.1 Implementation compliance"));
|
||||
the kind of the implementation isimplementation-defined[.](#compliance-1.sentence-1)
|
||||
|
||||
For a hosted implementation, this document
|
||||
describes the set of available headers[.](#compliance-1.sentence-2)
|
||||
|
||||
[2](#compliance-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L1588)
|
||||
|
||||
A freestanding implementation has animplementation-defined set of headers[.](#compliance-2.sentence-1)
|
||||
|
||||
This set shall
|
||||
include at least the headers shown in Table [27](#tab:headers.cpp.fs "Table 27: C++ headers for freestanding implementations")[.](#compliance-2.sentence-2)
|
||||
|
||||
Table [27](#tab:headers.cpp.fs) — C++ headers for freestanding implementations [[tab:headers.cpp.fs]](./tab:headers.cpp.fs)
|
||||
|
||||
| [ð](#tab:headers.cpp.fs-row-1) | **Subclause** | **Header** |
|
||||
| --- | --- | --- |
|
||||
| [ð](#tab:headers.cpp.fs-row-2)<br>[[support.types]](support.types "17.2 Common definitions") | Common definitions | <cstddef> |
|
||||
| [ð](#tab:headers.cpp.fs-row-3)<br>[[cstdlib.syn]](cstdlib.syn "17.2.2 Header <cstdlib> synopsis") | C standard library | <cstdlib> |
|
||||
| [ð](#tab:headers.cpp.fs-row-4)<br>[[support.limits]](support.limits "17.3 Implementation properties") | Implementation properties | <cfloat>, <climits>, <limits>, |
|
||||
| [ð](#tab:headers.cpp.fs-row-5) | | <version> |
|
||||
| [ð](#tab:headers.cpp.fs-row-6)<br>[[cstdint.syn]](cstdint.syn "17.4.1 Header <cstdint> synopsis") | Integer types | <cstdint> |
|
||||
| [ð](#tab:headers.cpp.fs-row-7)<br>[[support.dynamic]](support.dynamic "17.6 Dynamic memory management") | Dynamic memory management | <new> |
|
||||
| [ð](#tab:headers.cpp.fs-row-8)<br>[[support.rtti]](support.rtti "17.7 Type identification") | Type identification | <typeinfo> |
|
||||
| [ð](#tab:headers.cpp.fs-row-9)<br>[[support.srcloc]](support.srcloc "17.8 Source location") | Source location | <source_location> |
|
||||
| [ð](#tab:headers.cpp.fs-row-10)<br>[[support.exception]](support.exception "17.9 Exception handling") | Exception handling | <exception> |
|
||||
| [ð](#tab:headers.cpp.fs-row-11)<br>[[support.initlist]](support.initlist "17.11 Initializer lists") | Initializer lists | <initializer_list> |
|
||||
| [ð](#tab:headers.cpp.fs-row-12)<br>[[cmp]](cmp "17.12 Comparisons") | Comparisons | <compare> |
|
||||
| [ð](#tab:headers.cpp.fs-row-13)<br>[[support.contract]](support.contract "17.10 Contract-violation handling") | Contract-violation handling | <contracts> |
|
||||
| [ð](#tab:headers.cpp.fs-row-14)<br>[[support.coroutine]](support.coroutine "17.13 Coroutines") | Coroutines support | <coroutine> |
|
||||
| [ð](#tab:headers.cpp.fs-row-15)<br>[[support.runtime]](support.runtime "17.14 Other runtime support") | Other runtime support | <cstdarg> |
|
||||
| [ð](#tab:headers.cpp.fs-row-16)<br>[[concepts]](concepts "18 Concepts library") | Concepts library | <concepts> |
|
||||
| [ð](#tab:headers.cpp.fs-row-17)<br>[[errno]](errno "19.4 Error numbers") | Error numbers | <cerrno> |
|
||||
| [ð](#tab:headers.cpp.fs-row-18)<br>[[syserr]](syserr "19.5 System error support") | System error support | <system_error> |
|
||||
| [ð](#tab:headers.cpp.fs-row-19)<br>[[debugging]](debugging "19.7 Debugging") | Debugging | <debugging> |
|
||||
| [ð](#tab:headers.cpp.fs-row-20)<br>[[memory]](memory "20.2 Memory") | Memory | <memory> |
|
||||
| [ð](#tab:headers.cpp.fs-row-21)<br>[[type.traits]](type.traits "21.3 Metaprogramming and type traits") | Type traits | <type_traits> |
|
||||
| [ð](#tab:headers.cpp.fs-row-22)<br>[[ratio]](ratio "21.5 Compile-time rational arithmetic") | Compile-time rational arithmetic | <ratio> |
|
||||
| [ð](#tab:headers.cpp.fs-row-23)<br>[[utility]](utility "22.2 Utility components") | Utility components | <utility> |
|
||||
| [ð](#tab:headers.cpp.fs-row-24)<br>[[tuple]](tuple "22.4 Tuples") | Tuples | <tuple> |
|
||||
| [ð](#tab:headers.cpp.fs-row-25)<br>[[optional]](optional "22.5 Optional objects") | Optional objects | <optional> |
|
||||
| [ð](#tab:headers.cpp.fs-row-26)<br>[[variant]](variant "22.6 Variants") | Variants | <variant> |
|
||||
| [ð](#tab:headers.cpp.fs-row-27)<br>[[expected]](expected "22.8 Expected objects") | Expected objects | <expected> |
|
||||
| [ð](#tab:headers.cpp.fs-row-28)<br>[[function.objects]](function.objects "22.10 Function objects") | Function objects | <functional> |
|
||||
| [ð](#tab:headers.cpp.fs-row-29)<br>[[bit]](bit "22.11 Bit manipulation") | Bit manipulation | <bit> |
|
||||
| [ð](#tab:headers.cpp.fs-row-30)<br>[[stdbit.h.syn]](stdbit.h.syn "22.12 Header <stdbit.h> synopsis") | C-compatible bit manipulation | <stdbit.h> |
|
||||
| [ð](#tab:headers.cpp.fs-row-31)<br>[[array]](array "23.3.3 Class template array") | Class template array | <array> |
|
||||
| [ð](#tab:headers.cpp.fs-row-32)<br>[[inplace.vector]](inplace.vector "23.3.16 Class template inplace_vector") | Class template inplace_vector | <inplace_vector> |
|
||||
| [ð](#tab:headers.cpp.fs-row-33)<br>[[views.contiguous]](views.contiguous "23.7.2 Contiguous access") | Contiguous access | <span> |
|
||||
| [ð](#tab:headers.cpp.fs-row-34)<br>[[views.multidim]](views.multidim "23.7.3 Multidimensional access") | Multidimensional access | <mdspan> |
|
||||
| [ð](#tab:headers.cpp.fs-row-35)<br>[[iterators]](iterators "24 Iterators library") | Iterators library | <iterator> |
|
||||
| [ð](#tab:headers.cpp.fs-row-36)<br>[[ranges]](ranges "25 Ranges library") | Ranges library | <ranges> |
|
||||
| [ð](#tab:headers.cpp.fs-row-37)<br>[[algorithms]](algorithms "26 Algorithms library") | Algorithms library | <algorithm>, <numeric> |
|
||||
| [ð](#tab:headers.cpp.fs-row-38)<br>[[execpol]](execpol "26.3.6 Execution policies") | Execution policies | <execution> |
|
||||
| [ð](#tab:headers.cpp.fs-row-39)<br>[[string.view]](string.view "27.3 String view classes") | String view classes | <string_view> |
|
||||
| [ð](#tab:headers.cpp.fs-row-40)<br>[[string.classes]](string.classes "27.4 String classes") | String classes | <string> |
|
||||
| [ð](#tab:headers.cpp.fs-row-41)<br>[[c.strings]](c.strings "27.5 Null-terminated sequence utilities") | Null-terminated sequence utilities | <cstring>, <cwchar> |
|
||||
| [ð](#tab:headers.cpp.fs-row-42)<br>[[charconv]](charconv "28.2 Primitive numeric conversions") | Primitive numeric conversions | <charconv> |
|
||||
| [ð](#tab:headers.cpp.fs-row-43)<br>[[rand]](rand "29.5 Random number generation") | Random number generation | <random> |
|
||||
| [ð](#tab:headers.cpp.fs-row-44)<br>[[c.math]](c.math "29.7 Mathematical functions for floating-point types") | Mathematical functions for floating-point types | <cmath> |
|
||||
| [ð](#tab:headers.cpp.fs-row-45)<br>[[atomics]](atomics "32.5 Atomic operations") | Atomics | <atomic> |
|
||||
| [ð](#tab:headers.cpp.fs-row-46) |
|
||||
|
||||
[3](#compliance-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L1641)
|
||||
|
||||
For each of the headers listed in Table [27](#tab:headers.cpp.fs "Table 27: C++ headers for freestanding implementations"),
|
||||
a freestanding implementation provides at least
|
||||
the freestanding items ([[freestanding.item]](freestanding.item "16.3.3.7 Freestanding items")) declared in the header[.](#compliance-3.sentence-1)
|
||||
|
||||
[4](#compliance-4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L1646)
|
||||
|
||||
The [*hosted library facilities*](#def:library_facilities,hosted "16.4.2.5 Freestanding implementations [compliance]") are
|
||||
the set of facilities described in this document
|
||||
that are required for hosted implementations,
|
||||
but not required for freestanding implementations[.](#compliance-4.sentence-1)
|
||||
|
||||
A freestanding implementation provides
|
||||
a (possibly empty) implementation-defined subset of
|
||||
the hosted library facilities[.](#compliance-4.sentence-2)
|
||||
|
||||
Unless otherwise specified, the requirements on
|
||||
each declaration, entity, [*typedef-name*](dcl.typedef#nt:typedef-name "9.2.4 The typedef specifier [dcl.typedef]"), and macro
|
||||
provided in this way are the same as
|
||||
the corresponding requirements for a hosted implementation,
|
||||
except that not all of the members of the namespaces are required to be present[.](#compliance-4.sentence-3)
|
||||
|
||||
[5](#compliance-5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L1660)
|
||||
|
||||
A freestanding implementation provides
|
||||
deleted definitions ([[dcl.fct.def.delete]](dcl.fct.def.delete "9.6.3 Deleted definitions")) for
|
||||
a (possibly empty) implementation-defined subset of
|
||||
the namespace-scope functions and function templates
|
||||
from the hosted library facilities[.](#compliance-5.sentence-1)
|
||||
|
||||
[*Note [1](#compliance-note-1)*:
|
||||
|
||||
An implementation can provide a deleted definition
|
||||
so that the result of overload resolution does not silently change
|
||||
when migrating a program from a freestanding implementation to
|
||||
a hosted implementation[.](#compliance-5.sentence-2)
|
||||
|
||||
â *end note*]
|
||||
Reference in New Issue
Block a user