Difference between revisions of "cpp/header"
m (added c++26 (2023.06) new headers) |
(Rearranged the headers according to N4993.) |
||
(16 intermediate revisions by 8 users not shown) | |||
Line 6: | Line 6: | ||
{{dsc begin}} | {{dsc begin}} | ||
− | {{dsc h1| | + | {{dsc h1|Multi-purpose headers}} |
− | {{dsc inc|cpp/header/dsc | + | {{dsc inc|cpp/header/dsc cstdlib}} |
+ | {{dsc inc|cpp/header/dsc execution}} | ||
− | {{dsc h1| | + | {{dsc h1|Language support library}} |
+ | {{dsc inc|cpp/header/dsc cfloat}} | ||
+ | {{dsc inc|cpp/header/dsc climits}} | ||
+ | {{dsc inc|cpp/header/dsc compare}} | ||
{{dsc inc|cpp/header/dsc coroutine}} | {{dsc inc|cpp/header/dsc coroutine}} | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
{{dsc inc|cpp/header/dsc csetjmp}} | {{dsc inc|cpp/header/dsc csetjmp}} | ||
{{dsc inc|cpp/header/dsc csignal}} | {{dsc inc|cpp/header/dsc csignal}} | ||
{{dsc inc|cpp/header/dsc cstdarg}} | {{dsc inc|cpp/header/dsc cstdarg}} | ||
{{dsc inc|cpp/header/dsc cstddef}} | {{dsc inc|cpp/header/dsc cstddef}} | ||
− | {{dsc inc|cpp/header/dsc | + | {{dsc inc|cpp/header/dsc cstdint}} |
− | {{dsc inc|cpp/header/dsc | + | {{dsc inc|cpp/header/dsc exception}} |
− | + | ||
− | + | ||
{{dsc inc|cpp/header/dsc initializer_list}} | {{dsc inc|cpp/header/dsc initializer_list}} | ||
− | {{dsc inc|cpp/header/dsc | + | {{dsc inc|cpp/header/dsc limits}} |
+ | {{dsc inc|cpp/header/dsc new}} | ||
{{dsc inc|cpp/header/dsc source_location}} | {{dsc inc|cpp/header/dsc source_location}} | ||
− | {{dsc inc|cpp/header/dsc | + | {{dsc inc|cpp/header/dsc stdfloat}} |
− | + | ||
{{dsc inc|cpp/header/dsc typeindex}} | {{dsc inc|cpp/header/dsc typeindex}} | ||
{{dsc inc|cpp/header/dsc typeinfo}} | {{dsc inc|cpp/header/dsc typeinfo}} | ||
− | |||
− | |||
{{dsc inc|cpp/header/dsc version}} | {{dsc inc|cpp/header/dsc version}} | ||
− | {{dsc | + | {{dsc h1|Concepts library}} |
− | {{dsc inc|cpp/header/dsc | + | {{dsc inc|cpp/header/dsc concepts}} |
− | + | ||
− | + | ||
− | + | ||
− | {{dsc | + | {{dsc h1|Diagnostics library}} |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
{{dsc inc|cpp/header/dsc cassert}} | {{dsc inc|cpp/header/dsc cassert}} | ||
{{dsc inc|cpp/header/dsc cerrno}} | {{dsc inc|cpp/header/dsc cerrno}} | ||
− | {{dsc inc|cpp/header/dsc | + | {{dsc inc|cpp/header/dsc debugging}} |
{{dsc inc|cpp/header/dsc stacktrace}} | {{dsc inc|cpp/header/dsc stacktrace}} | ||
{{dsc inc|cpp/header/dsc stdexcept}} | {{dsc inc|cpp/header/dsc stdexcept}} | ||
{{dsc inc|cpp/header/dsc system_error}} | {{dsc inc|cpp/header/dsc system_error}} | ||
− | {{dsc h1| | + | {{dsc h1|Memory management library}} |
− | {{dsc inc|cpp/header/dsc | + | {{dsc inc|cpp/header/dsc memory}} |
− | {{dsc inc|cpp/header/dsc | + | {{dsc inc|cpp/header/dsc memory_resource}} |
− | {{dsc inc|cpp/header/dsc | + | {{dsc inc|cpp/header/dsc scoped_allocator}} |
− | {{dsc inc|cpp/header/dsc | + | |
− | {{dsc inc|cpp/header/dsc | + | {{dsc h1|Metaprogramming library}} |
− | {{dsc inc|cpp/header/dsc | + | {{dsc inc|cpp/header/dsc ratio}} |
− | {{dsc inc|cpp/header/dsc | + | {{dsc inc|cpp/header/dsc type_traits}} |
− | {{dsc inc|cpp/header/dsc | + | |
− | {{dsc inc|cpp/header/dsc | + | {{dsc h1|General utilities library}} |
+ | {{dsc inc|cpp/header/dsc any}} | ||
+ | {{dsc inc|cpp/header/dsc bit}} | ||
+ | {{dsc inc|cpp/header/dsc bitset}} | ||
+ | {{dsc inc|cpp/header/dsc expected}} | ||
+ | {{dsc inc|cpp/header/dsc functional}} | ||
+ | {{dsc inc|cpp/header/dsc optional}} | ||
+ | {{dsc inc|cpp/header/dsc tuple}} | ||
+ | {{dsc inc|cpp/header/dsc utility}} | ||
+ | {{dsc inc|cpp/header/dsc variant}} | ||
{{dsc h1|Containers library}} | {{dsc h1|Containers library}} | ||
Line 75: | Line 67: | ||
{{dsc inc|cpp/header/dsc flat_set}} | {{dsc inc|cpp/header/dsc flat_set}} | ||
{{dsc inc|cpp/header/dsc forward_list}} | {{dsc inc|cpp/header/dsc forward_list}} | ||
+ | {{dsc inc|cpp/header/dsc inplace_vector}} | ||
{{dsc inc|cpp/header/dsc list}} | {{dsc inc|cpp/header/dsc list}} | ||
{{dsc inc|cpp/header/dsc map}} | {{dsc inc|cpp/header/dsc map}} | ||
Line 95: | Line 88: | ||
{{dsc h1|Algorithms library}} | {{dsc h1|Algorithms library}} | ||
{{dsc inc|cpp/header/dsc algorithm}} | {{dsc inc|cpp/header/dsc algorithm}} | ||
− | {{dsc inc|cpp/header/dsc | + | {{dsc inc|cpp/header/dsc numeric}} |
+ | |||
+ | {{dsc h1|Strings library}} | ||
+ | {{dsc inc|cpp/header/dsc cstring}} | ||
+ | {{dsc inc|cpp/header/dsc string}} | ||
+ | {{dsc inc|cpp/header/dsc string_view}} | ||
+ | |||
+ | {{dsc h1|Text processing library}} | ||
+ | {{dsc inc|cpp/header/dsc cctype}} | ||
+ | {{dsc inc|cpp/header/dsc charconv}} | ||
+ | {{dsc inc|cpp/header/dsc clocale}} | ||
+ | {{dsc inc|cpp/header/dsc codecvt}} | ||
+ | {{dsc inc|cpp/header/dsc cuchar}} | ||
+ | {{dsc inc|cpp/header/dsc cwchar}} | ||
+ | {{dsc inc|cpp/header/dsc cwctype}} | ||
+ | {{dsc inc|cpp/header/dsc format}} | ||
+ | {{dsc inc|cpp/header/dsc locale}} | ||
+ | {{dsc inc|cpp/header/dsc regex}} | ||
+ | {{dsc inc|cpp/header/dsc text_encoding}} | ||
{{dsc h1|Numerics library}} | {{dsc h1|Numerics library}} | ||
− | |||
{{dsc inc|cpp/header/dsc cfenv}} | {{dsc inc|cpp/header/dsc cfenv}} | ||
{{dsc inc|cpp/header/dsc cmath}} | {{dsc inc|cpp/header/dsc cmath}} | ||
{{dsc inc|cpp/header/dsc complex}} | {{dsc inc|cpp/header/dsc complex}} | ||
+ | {{dsc inc|cpp/header/dsc linalg}} | ||
{{dsc inc|cpp/header/dsc numbers}} | {{dsc inc|cpp/header/dsc numbers}} | ||
− | |||
{{dsc inc|cpp/header/dsc random}} | {{dsc inc|cpp/header/dsc random}} | ||
− | |||
{{dsc inc|cpp/header/dsc valarray}} | {{dsc inc|cpp/header/dsc valarray}} | ||
− | {{dsc h1| | + | {{dsc h1|Time library}} |
− | {{dsc inc|cpp/header/dsc | + | {{dsc inc|cpp/header/dsc chrono}} |
− | {{dsc inc|cpp/header/dsc | + | {{dsc inc|cpp/header/dsc ctime}} |
− | + | ||
− | + | ||
{{dsc h1|Input/output library}} | {{dsc h1|Input/output library}} | ||
+ | {{dsc inc|cpp/header/dsc cinttypes}} | ||
{{dsc inc|cpp/header/dsc cstdio}} | {{dsc inc|cpp/header/dsc cstdio}} | ||
+ | {{dsc inc|cpp/header/dsc filesystem}} | ||
{{dsc inc|cpp/header/dsc fstream}} | {{dsc inc|cpp/header/dsc fstream}} | ||
{{dsc inc|cpp/header/dsc iomanip}} | {{dsc inc|cpp/header/dsc iomanip}} | ||
Line 130: | Line 139: | ||
{{dsc inc|cpp/header/dsc syncstream}} | {{dsc inc|cpp/header/dsc syncstream}} | ||
− | {{dsc h1| | + | {{dsc h1|Concurrency support library}} |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
{{dsc inc|cpp/header/dsc atomic}} | {{dsc inc|cpp/header/dsc atomic}} | ||
− | |||
− | |||
{{dsc inc|cpp/header/dsc barrier}} | {{dsc inc|cpp/header/dsc barrier}} | ||
{{dsc inc|cpp/header/dsc condition_variable}} | {{dsc inc|cpp/header/dsc condition_variable}} | ||
Line 158: | Line 159: | ||
With the exception of {{rlt|ccomplex|complex.h}}{{mark unreviewed dr|LWG}}<!--LWG 551/2536-->, each {{tt|''xxx''.h}} header included in the C++ standard library places in the global namespace each name that the corresponding {{tt|c''xxx''}} header would have placed in the {{c|std}} namespace. | With the exception of {{rlt|ccomplex|complex.h}}{{mark unreviewed dr|LWG}}<!--LWG 551/2536-->, each {{tt|''xxx''.h}} header included in the C++ standard library places in the global namespace each name that the corresponding {{tt|c''xxx''}} header would have placed in the {{c|std}} namespace. | ||
− | These headers are allowed to also declare the same names in the {{c|std}} namespace, and the corresponding {{tt|c''xxx''}} headers are allowed to also declare the same names in the global namespace: including {{header|cstdlib}} definitely provides {{ | + | These headers are allowed to also declare the same names in the {{c|std}} namespace, and the corresponding {{tt|c''xxx''}} headers are allowed to also declare the same names in the global namespace: including {{header|cstdlib}} definitely provides {{lc|std::malloc}} and may also provide {{c/core|::malloc}}. Including {{header|stdlib.h|lang=c}} definitely provides {{c/core|::malloc}} and may also provide {{lc|std::malloc}}. This applies even to functions and function overloads that are not part of C standard library. |
Notes: {{tt|''xxx''.h}} headers are deprecated in C++98 and undeprecated in C++23. These headers are discouraged for pure C++ code, but not subject to future removal. | Notes: {{tt|''xxx''.h}} headers are deprecated in C++98 and undeprecated in C++23. These headers are discouraged for pure C++ code, but not subject to future removal. |
Latest revision as of 18:43, 16 October 2024
The interface of C++ standard library is defined by the following collection of headers.
[edit] C compatibility headers
For some of the C standard library headers of the form xxx.h
, the C++ standard library both includes an identically-named header and another header of the form cxxx
(all meaningful cxxx
headers are listed above). The intended use of headers of form xxx.h
is for interoperability only. It is possible that C++ source files need to include one of these headers in order to be valid ISO C. Source files that are not intended to also be valid ISO C should not use any of the C headers.
With the exception of complex.h
, each xxx.h
header included in the C++ standard library places in the global namespace each name that the corresponding cxxx
header would have placed in the std namespace.
These headers are allowed to also declare the same names in the std namespace, and the corresponding cxxx
headers are allowed to also declare the same names in the global namespace: including <cstdlib> definitely provides std::malloc and may also provide ::malloc. Including <stdlib.h> definitely provides ::malloc and may also provide std::malloc. This applies even to functions and function overloads that are not part of C standard library.
Notes: xxx.h
headers are deprecated in C++98 and undeprecated in C++23. These headers are discouraged for pure C++ code, but not subject to future removal.
Behaves same as <cassert> | |
Behaves as if each name from <cctype> is placed in global namespace | |
Behaves same as <cerrno> | |
(C++11) |
Behaves as if each name from <cfenv> is placed in global namespace |
Behaves same as <cfloat> | |
(C++11) |
Behaves as if each name from <cinttypes> is placed in global namespace |
Behaves same as <climits> | |
Behaves as if each name from <clocale> is placed in global namespace | |
Behaves as if each name from <cmath> is placed in global namespace, except for names of mathematical special functions | |
Behaves as if each name from <csetjmp> is placed in global namespace | |
Behaves as if each name from <csignal> is placed in global namespace | |
Behaves as if each name from <cstdarg> is placed in global namespace | |
Behaves as if each name from <cstddef> is placed in global namespace, except for names of std::byte and related functions
| |
(C++11) |
Behaves as if each name from <cstdint> is placed in global namespace |
Behaves as if each name from <cstdio> is placed in global namespace | |
Behaves as if each name from <cstdlib> is placed in global namespace | |
Behaves as if each name from <cstring> is placed in global namespace | |
Behaves as if each name from <ctime> is placed in global namespace | |
(C++11) |
Behaves as if each name from <cuchar> is placed in global namespace |
Behaves as if each name from <cwchar> is placed in global namespace | |
Behaves as if each name from <cwctype> is placed in global namespace |
[edit] Special C compatibility headers
The header <stdatomic.h> declares names which are also provided in the C standard library, and defines the _Atomic
macro which is a keyword in C. Unlike other xxx.h
headers, corresponding <cstdatomic>
is not provided.
(C++23) |
Defines _Atomic and provides corresponding components in the C standard library
|
[edit] Empty C headers
The headers <complex.h>, <ccomplex>, <tgmath.h>, and <ctgmath> do not contain any content from the C standard library and instead merely include other headers from the C++ standard library.
(C++11)(deprecated in C++17)(removed in C++20) |
Simply includes the header <complex> |
(C++11) |
Simply includes the header <complex> |
(C++11)(deprecated in C++17)(removed in C++20) |
Simply includes the headers <complex> and <cmath>: the overloads equivalent to the contents of the C header tgmath.h are already provided by those headers
|
(C++11) |
Simply includes the headers <complex> and <cmath> |
[edit] Meaningless C headers
The headers <ciso646>, <cstdalign>, and <cstdbool> are meaningless in C++ because the macros they provide in C are language keywords in C++.
(removed in C++20) |
Empty header. The macros that appear in iso646.h in C are keywords in C++
|
(C++11)(deprecated in C++17)(removed in C++20) |
Defines one compatibility macro constant |
(C++11)(deprecated in C++17)(removed in C++20) |
Defines one compatibility macro constant |
Has no effect | |
(C++11) |
Defines one compatibility macro constant |
(C++11) |
Defines one compatibility macro constant |
[edit] Unsupported C headers
The C headers <stdatomic.h>,(until C++23) <stdnoreturn.h>, and <threads.h> are not included in C++ and have no cxxx
equivalents.
[edit] Experimental libraries
C++ TR's/TS's also define several collections of headers.
[edit] See also
C documentation for C Standard Library headers
|