Namespaces
Variants
Views
Actions

Difference between revisions of "cpp/header"

From cppreference.com
< cpp
(+ <format>: since <charconv>, is in /cpp/utility, this will go there, too)
(Rearranged the headers according to N4993.)
 
(39 intermediate revisions by 16 users not shown)
Line 6: Line 6:
 
{{dsc begin}}
 
{{dsc begin}}
  
{{dsc h1|Concepts library}}
+
{{dsc h1|Multi-purpose headers}}
 +
{{dsc inc|cpp/header/dsc cstdlib}}
 +
{{dsc inc|cpp/header/dsc execution}}
  
{{dsc|{{ttb|{{header|concepts}}}} {{mark since c++20}} | [[cpp/concepts|Fundamental library concepts]] }}
+
{{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 csetjmp}}
 +
{{dsc inc|cpp/header/dsc csignal}}
 +
{{dsc inc|cpp/header/dsc cstdarg}}
 +
{{dsc inc|cpp/header/dsc cstddef}}
 +
{{dsc inc|cpp/header/dsc cstdint}}
 +
{{dsc inc|cpp/header/dsc exception}}
 +
{{dsc inc|cpp/header/dsc initializer_list}}
 +
{{dsc inc|cpp/header/dsc limits}}
 +
{{dsc inc|cpp/header/dsc new}}
 +
{{dsc inc|cpp/header/dsc source_location}}
 +
{{dsc inc|cpp/header/dsc stdfloat}}
 +
{{dsc inc|cpp/header/dsc typeindex}}
 +
{{dsc inc|cpp/header/dsc typeinfo}}
 +
{{dsc inc|cpp/header/dsc version}}
  
{{dsc h1|Coroutines library}}
+
{{dsc h1|Concepts library}}
 +
{{dsc inc|cpp/header/dsc concepts}}
  
{{dsc|{{ttb|{{header|coroutine}}}} {{mark since c++20}} | [[cpp/coroutine|Coroutine support library]] }}
+
{{dsc h1|Diagnostics library}}
 +
{{dsc inc|cpp/header/dsc cassert}}
 +
{{dsc inc|cpp/header/dsc cerrno}}
 +
{{dsc inc|cpp/header/dsc debugging}}
 +
{{dsc inc|cpp/header/dsc stacktrace}}
 +
{{dsc inc|cpp/header/dsc stdexcept}}
 +
{{dsc inc|cpp/header/dsc system_error}}
  
{{dsc h1|Utilities library}}
+
{{dsc h1|Memory management library}}
 +
{{dsc inc|cpp/header/dsc memory}}
 +
{{dsc inc|cpp/header/dsc memory_resource}}
 +
{{dsc inc|cpp/header/dsc scoped_allocator}}
  
{{dsc|{{ttb|{{header|cstdlib}}}} |General purpose utilities: [[cpp/utility/program | program control]], [[cpp/memory/c | dynamic memory allocation]], [[cpp/numeric/random | random numbers]], [[cpp/algorithm | sort and search]] }}
+
{{dsc h1|Metaprogramming library}}
{{dsc|{{ttb|{{header|csignal}}}} |[[cpp/utility/program | Functions and macro constants for signal management]]}}
+
{{dsc inc|cpp/header/dsc ratio}}
{{dsc|{{ttb|{{header|csetjmp}}}} |[[cpp/utility/program/setjmp | Macro (and function) that saves (and jumps) to an execution context]]}}
+
{{dsc inc|cpp/header/dsc type_traits}}
{{dsc|{{ttb|{{header|cstdarg}}}} |[[cpp/utility/variadic | Handling of variable length argument lists]]}}
+
{{dsc|{{ttb|{{header|typeinfo}}}} |[[cpp/types | Runtime type information utilities]]}}
+
{{dsc|{{ttb|{{header|typeindex}}}} {{mark since c++11}}|{{lc|std::type_index}} }}
+
{{dsc|{{ttb|{{header|type_traits}}}} {{mark since c++11}}|[[cpp/types|Compile-time type information]] }}
+
{{dsc|{{ttb|{{header|bitset}}}} |{{lc|std::bitset}} class template }}
+
{{dsc|{{ttb|{{header|functional}}}} |[[cpp/utility/functional | Function objects, Function invocations, Bind operations and Reference wrappers]] }}
+
{{dsc|{{ttb|{{header|utility}}}} |Various [[cpp/utility | utility components]]}}
+
{{dsc|{{ttb|{{header|ctime}}}} |[[cpp/chrono/c | C-style time/date utilites]] }}
+
{{dsc|{{ttb|{{header|chrono}}}} {{mark since c++11}}|[[cpp/chrono | C++ time utilites]] }}
+
{{dsc|{{ttb|{{header|cstddef}}}} |[[cpp/types | standard macros and typedefs]] }}
+
{{dsc|{{ttb|{{header|initializer_list}}}} {{mark since c++11}}|{{lc|std::initializer_list}} class template }}
+
{{dsc|{{ttb|{{header|tuple}}}} {{mark since c++11}}|{{lc|std::tuple}} class template }}
+
{{dsc|{{ttb|{{header|any}}}} {{mark since c++17}}|{{lc|std::any}} class }}
+
{{dsc|{{ttb|{{header|optional}}}} {{mark since c++17}}|{{lc|std::optional}} class template }}
+
{{dsc|{{ttb|{{header|variant}}}} {{mark since c++17}}|{{lc|std::variant}} class template }}
+
{{dsc|{{ttb|{{header|compare}}}} {{mark since c++20}}| [[cpp/language/operator_comparison#Three-way_comparison|Three-way comparison operator]] support}}
+
{{dsc|{{ttb|{{header|version}}}} {{mark since c++20}}| supplies implementation-dependent library information}}
+
{{dsc|{{ttb|{{header|source_location}}}} {{mark since c++20}}| supplies means to obtain [[cpp/utility/source_location|source code location]] }}
+
  
{{dsc h2|Dynamic memory management}}
+
{{dsc h1|General utilities library}}
 
+
{{dsc inc|cpp/header/dsc any}}
{{dsc|{{ttb|{{header|new}}}} |[[cpp/memory/new | Low-level memory management utilities]]}}
+
{{dsc inc|cpp/header/dsc bit}}
{{dsc|{{ttb|{{header|memory}}}} |[[cpp/memory | Higher level memory management utilities]] }}
+
{{dsc inc|cpp/header/dsc bitset}}
{{dsc|{{ttb|{{header|scoped_allocator}}}} {{mark since c++11}}|[[cpp/memory/scoped_allocator_adaptor | Nested allocator class ]] }}
+
{{dsc inc|cpp/header/dsc expected}}
{{dsc|{{ttb|{{header|memory_resource}}}} {{mark since c++17}}|[[cpp/memory/memory_resource | Polymorphic allocators and memory resources ]] }}
+
{{dsc inc|cpp/header/dsc functional}}
 
+
{{dsc inc|cpp/header/dsc optional}}
{{dsc h2|Numeric limits}}
+
{{dsc inc|cpp/header/dsc tuple}}
 
+
{{dsc inc|cpp/header/dsc utility}}
{{dsc|{{ttb|{{header|climits}}}} |[[cpp/types/climits | limits of integral types]]}}
+
{{dsc inc|cpp/header/dsc variant}}
{{dsc|{{ttb|{{header|cfloat}}}} |[[cpp/types/climits | limits of float types]]}}
+
{{dsc|{{ttb|{{header|cstdint}}}} {{mark since c++11}}| [[cpp/types/integer | fixed-size types]] and [[cpp/types/climits | limits of other types]]}}
+
{{dsc|{{ttb|{{header|cinttypes}}}} {{mark since c++11}} | [[cpp/types/integer | formatting macros ]], {{tt|intmax_t}} and {{tt|uintmax_t}} math and conversions }}
+
{{dsc|{{ttb|{{header|limits}}}} |[[cpp/types/numeric_limits | standardized way to query properties of arithmetic types]]}}
+
 
+
{{dsc h2|Error handling}}
+
 
+
{{dsc|{{ttb|{{header|exception}}}} |[[cpp/error | Exception handling utilities]]}}
+
{{dsc|{{ttb|{{header|stdexcept}}}} |[[cpp/error | Standard exception objects]] }}
+
{{dsc|{{ttb|{{header|cassert}}}} |[[cpp/error/assert | Conditionally compiled macro that compares its argument to zero]]}}
+
{{dsc|{{ttb|{{header|system_error}}}} {{mark since c++11}} |[[cpp/error/error_code | defines {{tt|std::error_code}}, a platform-dependent error code]]}}
+
{{dsc|{{ttb|{{header|cerrno}}}} |[[cpp/error | Macro containing the last error number]]}}
+
 
+
{{dsc h1|Strings library}}
+
 
+
{{dsc|{{ttb|{{header|cctype}}}} |[[cpp/string/byte | Functions to determine the type contained in character data]] }}
+
{{dsc|{{ttb|{{header|cwctype}}}} |[[cpp/string/wide | Functions to determine the type contained in wide character data]]}}
+
{{dsc|{{ttb|{{header|cstring}}}} |various [[cpp/string/byte | narrow character string handling functions]] }}
+
{{dsc|{{ttb|{{header|cwchar}}}} |various [[cpp/string/wide | wide ]] and [[cpp/string/multibyte | multibyte]] string handling functions }}
+
{{dsc|{{ttb|{{header|cuchar}}}} {{mark since c++11}}|C-style [[cpp/string/multibyte | Unicode character conversion functions]] }}
+
{{dsc|{{ttb|{{header|string}}}} |{{lc|std::basic_string}} class template }}
+
{{dsc|{{ttb|{{header|string_view}}}} {{mark since c++17}}|{{lc|std::basic_string_view}} class template }}
+
{{dsc|{{ttb|{{header|charconv}}}} {{mark since c++17}}|{{lc|std::to_chars}} and {{lc|std::from_chars}} }}
+
{{dsc|{{ttb|{{header|format}}}} {{mark since c++20}}| {{lc|std::format}} }}
+
  
 
{{dsc h1|Containers library}}
 
{{dsc h1|Containers library}}
 
+
{{dsc inc|cpp/header/dsc array}}
{{dsc|{{ttb|{{header|array}}}} {{mark since c++11}}|{{lc|std::array}} container }}
+
{{dsc inc|cpp/header/dsc deque}}
{{dsc|{{ttb|{{header|vector}}}} |{{lc|std::vector}} container }}
+
{{dsc inc|cpp/header/dsc flat_map}}
{{dsc|{{ttb|{{header|deque}}}} |{{lc|std::deque}} container }}
+
{{dsc inc|cpp/header/dsc flat_set}}
{{dsc|{{ttb|{{header|list}}}} |{{lc|std::list}} container }}
+
{{dsc inc|cpp/header/dsc forward_list}}
{{dsc|{{ttb|{{header|forward_list}}}} {{mark since c++11}}|{{lc|std::forward_list}} container }}
+
{{dsc inc|cpp/header/dsc inplace_vector}}
{{dsc|{{ttb|{{header|set}}}} |{{lc|std::set}} and {{lc|std::multiset}} associative containers }}
+
{{dsc inc|cpp/header/dsc list}}
{{dsc|{{ttb|{{header|map}}}} |{{lc|std::map}} and {{lc|std::multimap}} associative containers }}
+
{{dsc inc|cpp/header/dsc map}}
{{dsc|{{ttb|{{header|unordered_set}}}} {{mark since c++11}} |{{lc|std::unordered_set}} and {{lc|std::unordered_multiset}} unordered associative containers }}
+
{{dsc inc|cpp/header/dsc mdspan}}
{{dsc|{{ttb|{{header|unordered_map}}}} {{mark since c++11}}|{{lc|std::unordered_map}} and {{lc|std::unordered_multimap}} unordered associative containers }}
+
{{dsc inc|cpp/header/dsc queue}}
{{dsc|{{ttb|{{header|stack}}}} |{{lc|std::stack}} container adaptor }}
+
{{dsc inc|cpp/header/dsc set}}
{{dsc|{{ttb|{{header|queue}}}} |{{lc|std::queue}} and {{lc|std::priority_queue}} container adaptors }}
+
{{dsc inc|cpp/header/dsc span}}
{{dsc|{{ttb|{{header|span}}}} {{mark since c++20}} |{{lc|std::span}} view}}
+
{{dsc inc|cpp/header/dsc stack}}
 +
{{dsc inc|cpp/header/dsc unordered_map}}
 +
{{dsc inc|cpp/header/dsc unordered_set}}
 +
{{dsc inc|cpp/header/dsc vector}}
  
 
{{dsc h1|Iterators library}}
 
{{dsc h1|Iterators library}}
 
+
{{dsc inc|cpp/header/dsc iterator}}
{{dsc|{{ttb|{{header|iterator}}}} |[[cpp/iterator | Range iterators]] }}
+
  
 
{{dsc h1|Ranges library}}
 
{{dsc h1|Ranges library}}
 
+
{{dsc inc|cpp/header/dsc generator}}
{{dsc|{{ttb|{{header|ranges}}}} {{mark since c++20}}|[[cpp/ranges | Range access, primitives, requirements, utilities and adaptors]]}}
+
{{dsc inc|cpp/header/dsc ranges}}
  
 
{{dsc h1|Algorithms library}}
 
{{dsc h1|Algorithms library}}
 +
{{dsc inc|cpp/header/dsc algorithm}}
 +
{{dsc inc|cpp/header/dsc numeric}}
  
{{dsc|{{ttb|{{header|algorithm}}}} |[[cpp/algorithm | Algorithms that operate on ranges]] }}
+
{{dsc h1|Strings library}}
{{dsc|{{ttb|{{header|execution}}}} {{mark since c++17}}|Predefined execution policies for parallel versions of the algorithms }}
+
{{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 cmath}}
 +
{{dsc inc|cpp/header/dsc complex}}
 +
{{dsc inc|cpp/header/dsc linalg}}
 +
{{dsc inc|cpp/header/dsc numbers}}
 +
{{dsc inc|cpp/header/dsc random}}
 +
{{dsc inc|cpp/header/dsc valarray}}
  
{{dsc|{{ttb|{{header|cmath}}}} |[[cpp/numeric/math | Common mathematics functions]] }}
+
{{dsc h1|Time library}}
{{dsc|{{ttb|{{header|complex}}}} |[[cpp/numeric/complex | Complex number type]] }}
+
{{dsc inc|cpp/header/dsc chrono}}
{{dsc|{{ttb|{{header|valarray}}}} |[[cpp/numeric/valarray | Class for representing and manipulating arrays of values]] }}
+
{{dsc inc|cpp/header/dsc ctime}}
{{dsc|{{ttb|{{header|random}}}} {{mark since c++11}} |[[cpp/numeric/random | Random number generators and distributions]] }}
+
{{dsc|{{ttb|{{header|numeric}}}} |[[cpp/numeric | Numeric operations on values in containers]] }}
+
{{dsc|{{ttb|{{header|ratio}}}} {{mark since c++11}}|[[cpp/numeric/ratio | Compile-time rational arithmetic]] }}
+
{{dsc|{{ttb|{{header|cfenv}}}} {{mark since c++11}}|[[cpp/numeric/fenv | Floating-point environment]] access functions }}
+
{{dsc|{{ttb|{{header|bit}}}} {{mark since c++20}}|[[cpp/numeric#Bit manipulation (since C++20)| Bit manipulation]] functions }}
+
  
 
{{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 filesystem}}
 +
{{dsc inc|cpp/header/dsc fstream}}
 +
{{dsc inc|cpp/header/dsc iomanip}}
 +
{{dsc inc|cpp/header/dsc ios}}
 +
{{dsc inc|cpp/header/dsc iosfwd}}
 +
{{dsc inc|cpp/header/dsc iostream}}
 +
{{dsc inc|cpp/header/dsc istream}}
 +
{{dsc inc|cpp/header/dsc ostream}}
 +
{{dsc inc|cpp/header/dsc print}}
 +
{{dsc inc|cpp/header/dsc spanstream}}
 +
{{dsc inc|cpp/header/dsc sstream}}
 +
{{dsc inc|cpp/header/dsc streambuf}}
 +
{{dsc inc|cpp/header/dsc strstream}}
 +
{{dsc inc|cpp/header/dsc syncstream}}
  
{{dsc|{{ttb|{{header|iosfwd}}}} |forward declarations of all classes in the input/output library }}
+
{{dsc h1|Concurrency support library}}
{{dsc|{{ttb|{{header|ios}}}} |{{lc|std::ios_base}} class, {{lc|std::basic_ios}} class template and several typedefs }}
+
{{dsc inc|cpp/header/dsc atomic}}
{{dsc|{{ttb|{{header|istream}}}} |{{lc|std::basic_istream}} class template and several typedefs }}
+
{{dsc inc|cpp/header/dsc barrier}}
{{dsc|{{ttb|{{header|ostream}}}} |{{lc|std::basic_ostream}}, {{lc|std::basic_iostream}} class templates and several typedefs }}
+
{{dsc inc|cpp/header/dsc condition_variable}}
{{dsc|{{ttb|{{header|iostream}}}} |several standard stream objects  }}
+
{{dsc inc|cpp/header/dsc future}}
{{dsc|{{ttb|{{header|fstream}}}} |{{lc|std::basic_fstream}}, {{lc|std::basic_ifstream}}, {{lc|std::basic_ofstream}} class templates and several typedefs }}
+
{{dsc inc|cpp/header/dsc hazard_pointer}}
{{dsc|{{ttb|{{header|sstream}}}} |{{lc|std::basic_stringstream}}, {{lc|std::basic_istringstream}}, {{lc|std::basic_ostringstream}} class templates and several typedefs }}
+
{{dsc inc|cpp/header/dsc latch}}
{{dsc|{{ttb|{{header|syncstream}}}} {{mark since c++20}} |{{lc|std::basic_osyncstream}}, {{lc|std::basic_syncbuf}}, and typedefs}}
+
{{dsc inc|cpp/header/dsc mutex}}
{{dsc|{{ttb|{{header|strstream}}}} {{mark deprecated c++98}}|{{c|std::strstream}}, {{c|std::istrstream}}, {{c|std::ostrstream}} }}
+
{{dsc inc|cpp/header/dsc rcu}}
{{dsc|{{ttb|{{header|iomanip}}}} |[[cpp/io/manip | Helper functions to control the format of input and output]] }}
+
{{dsc inc|cpp/header/dsc semaphore}}
{{dsc|{{ttb|{{header|streambuf}}}} |{{lc|std::basic_streambuf}} class template}}
+
{{dsc inc|cpp/header/dsc shared_mutex}}
{{dsc|{{ttb|{{header|cstdio}}}} |[[cpp/io/c | C-style input-output functions]] }}
+
{{dsc inc|cpp/header/dsc stop_token}}
 +
{{dsc inc|cpp/header/dsc thread}}
 +
{{dsc end}}
  
{{dsc h1|Localization library}}
+
===C compatibility headers===
 +
For some of the C standard library headers of the form {{tt|''xxx''.h}}, the C++ standard library both includes an identically-named header and another header of the form {{tt|c''xxx''}} (all meaningful {{tt|c''xxx''}} headers are listed above). The intended use of headers of form {{tt|''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.
  
{{dsc|{{ttb|{{header|locale}}}} |[[cpp/locale | Localization utilities]] }}
+
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.
{{dsc|{{ttb|{{header|clocale}}}} |[[cpp/locale | C localization utilities]] }}
+
{{dsc|{{ttb|{{header|codecvt}}}} {{mark life|since=c++11|deprecated=c++17}} |[[cpp/locale | Unicode conversion facilities]] }}
+
  
{{dsc h1|Regular Expressions library}}
+
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.
  
{{dsc|{{ttb|{{header|regex}}}} {{mark since c++11}}|[[cpp/regex | Classes, algorithms and iterators to support regular expression processing  ]]}}
+
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.
  
{{dsc h1|Atomic Operations library}}
+
{{dsc begin}}
 
+
{{dsc inc|cpp/header/dsc assert.h}}
{{dsc|{{ttb|{{header|atomic}}}} {{mark since c++11}}|[[cpp/atomic | Atomic operations library]] }}
+
{{dsc inc|cpp/header/dsc ctype.h}}
 
+
{{dsc inc|cpp/header/dsc errno.h}}
{{dsc h1|Thread support library}}
+
{{dsc inc|cpp/header/dsc fenv.h}}
 
+
{{dsc inc|cpp/header/dsc float.h}}
{{dsc|{{ttb|{{header|thread}}}} {{mark since c++11}}|{{lc|std::thread}} class and [[cpp/thread | supporting functions]] }}
+
{{dsc inc|cpp/header/dsc inttypes.h}}
{{dsc|{{ttb|{{header|stop_token}}}} {{mark since c++20}}|Stop tokens for {{lc|std::jthread}} }}
+
{{dsc inc|cpp/header/dsc limits.h}}
{{dsc|{{ttb|{{header|mutex}}}} {{mark since c++11}}|[[cpp/thread | mutual exclusion primitives]] }}
+
{{dsc inc|cpp/header/dsc locale.h}}
{{dsc|{{ttb|{{header|shared_mutex}}}} {{mark since c++14}}|[[cpp/thread | shared mutual exclusion primitives]] }}
+
{{dsc inc|cpp/header/dsc math.h}}
{{dsc|{{ttb|{{header|future}}}} {{mark since c++11}}|[[cpp/thread | primitives for asynchronous computations]]}}
+
{{dsc inc|cpp/header/dsc setjmp.h}}
{{dsc|{{ttb|{{header|condition_variable}}}} {{mark since c++11}}|[[cpp/thread|thread waiting conditions]]}}
+
{{dsc inc|cpp/header/dsc signal.h}}
{{dsc|{{ttb|{{header|semaphore}}}} {{mark since c++20}}|[[cpp/thread|semaphores]]}}
+
{{dsc inc|cpp/header/dsc stdarg.h}}
{{dsc|{{ttb|{{header|latch}}}} {{mark since c++20}}|[[cpp/thread|latches]]}}
+
{{dsc inc|cpp/header/dsc stddef.h}}
{{dsc|{{ttb|{{header|barrier}}}} {{mark since c++20}}|[[cpp/thread|barriers]]}}
+
{{dsc inc|cpp/header/dsc stdint.h}}
 
+
{{dsc inc|cpp/header/dsc stdio.h}}
{{dsc h1|Filesystem library}}
+
{{dsc inc|cpp/header/dsc stdlib.h}}
{{dsc|{{ttb|{{header|filesystem}}}} {{mark since c++17}}|{{lc|std::path}} class and [[cpp/filesystem | supporting functions]] }}
+
{{dsc inc|cpp/header/dsc string.h}}
 +
{{dsc inc|cpp/header/dsc time.h}}
 +
{{dsc inc|cpp/header/dsc uchar.h}}
 +
{{dsc inc|cpp/header/dsc wchar.h}}
 +
{{dsc inc|cpp/header/dsc wctype.h}}
 
{{dsc end}}
 
{{dsc end}}
  
===C compatibility headers===
+
====Special C compatibility headers====
For some of the C standard library headers of the form {{c|xxx.h}}, the C++ standard library both includes an identically-named header and another header of the form {{c|cxxx}} (all meaningful {{c|cxxx}} headers are listed above).
+
The header {{header|stdatomic.h|lang=c}} declares names which are also provided in the C standard library, and defines the {{tt|_Atomic}} macro which is a [[c/keyword/_Atomic|keyword]] in C. Unlike other {{tt|''xxx''.h}} headers, corresponding {{tt|<cstdatomic>}} is not provided.
 
+
With the exception of {{c|complex.h}}{{mark unreviewed dr|LWG}}<!--LWG 551/2536-->, each {{c|xxx.h}} header included in the C++ standard library places in the global namespace each name that the corresponding {{c|cxxx}} 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 {{c|cxxx}} headers are allowed to also declare the same names in the global namespace: including <cstdlib> definitely provides {{c|std::malloc}} and may also provide {{c|::malloc}}. Including <stdlib.h> definitely provides {{c|::malloc}} and may also provide {{c|std::malloc}}. This applies even to functions and function overloads that are not part of C standard library.
+
  
 
{{dsc begin}}
 
{{dsc begin}}
{{dsc|{{ttb|&lt;assert.h&gt;}} {{mark deprecated}} | behaves as if each name from {{header|cassert}} is placed in global namespace }}
+
{{dsc inc|cpp/header/dsc stdatomic.h}}
{{dsc|{{ttb|&lt;ctype.h&gt;}} {{mark deprecated}} | behaves as if each name from {{header|cctype}} is placed in global namespace }}
+
{{dsc|{{ttb|&lt;errno.h&gt;}} {{mark deprecated}} | behaves as if each name from {{header|cerrno}} is placed in global namespace }}
+
{{dsc|{{ttb|&lt;fenv.h&gt;}} {{mark deprecated}} | behaves as if each name from {{header|cfenv}} is placed in global namespace }}
+
{{dsc|{{ttb|&lt;float.h&gt;}} {{mark deprecated}} | behaves as if each name from {{header|cfloat}} is placed in global namespace }}
+
{{dsc|{{ttb|&lt;inttypes.h&gt;}} {{mark deprecated}} | behaves as if each name from {{header|cinttypes}} is placed in global namespace }}
+
{{dsc|{{ttb|&lt;limits.h&gt;}} {{mark deprecated}} | behaves as if each name from {{header|climits}} is placed in global namespace }}
+
{{dsc|{{ttb|&lt;locale.h&gt;}} {{mark deprecated}} | behaves as if each name from {{header|clocale}} is placed in global namespace }}
+
{{dsc|{{ttb|&lt;math.h&gt;}} {{mark deprecated}} | behaves as if each name from {{header|cmath}} is placed in global namespace<br />except for names of [[cpp/numeric/special_math|mathematical special functions]] }}
+
{{dsc|{{ttb|&lt;setjmp.h&gt;}} {{mark deprecated}} | behaves as if each name from {{header|csetjmp}} is placed in global namespace }}
+
{{dsc|{{ttb|&lt;signal.h&gt;}} {{mark deprecated}} | behaves as if each name from {{header|csignal}} is placed in global namespace }}
+
{{dsc|{{ttb|&lt;stdarg.h&gt;}} {{mark deprecated}} | behaves as if each name from {{header|cstdarg}} is placed in global namespace }}
+
{{dsc|{{ttb|&lt;stddef.h&gt;}} {{mark deprecated}} | behaves as if each name from {{header|cstddef}} is placed in global namespace<br />except for names of [[cpp/types/byte|{{tt|std::byte}} and related functions]] }}
+
{{dsc|{{ttb|&lt;stdint.h&gt;}} {{mark deprecated}} | behaves as if each name from {{header|cstdint}} is placed in global namespace }}
+
{{dsc|{{ttb|&lt;stdio.h&gt;}} {{mark deprecated}} | behaves as if each name from {{header|cstdio}} is placed in global namespace }}
+
{{dsc|{{ttb|&lt;stdlib.h&gt;}} {{mark deprecated}} | behaves as if each name from {{header|cstdlib}} is placed in global namespace }}
+
{{dsc|{{ttb|&lt;string.h&gt;}} {{mark deprecated}} | behaves as if each name from {{header|cstring}} is placed in global namespace }}
+
{{dsc|{{ttb|&lt;time.h&gt;}} {{mark deprecated}} | behaves as if each name from {{header|ctime}} is placed in global namespace }}
+
{{dsc|{{ttb|&lt;uchar.h&gt;}} {{mark deprecated}} | behaves as if each name from {{header|cuchar}} is placed in global namespace }}
+
{{dsc|{{ttb|&lt;wchar.h&gt;}} {{mark deprecated}} | behaves as if each name from {{header|cwchar}} is placed in global namespace }}
+
{{dsc|{{ttb|&lt;wctype.h&gt;}} {{mark deprecated}} | behaves as if each name from {{header|cwctype}} is placed in global namespace }}
+
 
{{dsc end}}
 
{{dsc end}}
  
 
====Empty C headers====
 
====Empty C headers====
The headers {{tt|<complex.h>}}, {{tt|<ccomplex>}}, {{tt|<tgmath.h>}}, and {{tt|<ctgmath>}} do not contain any content from the C standard library and instead merely include other headers from the C++ standard library. The use of all these headers is deprecated in C++.
+
The headers {{header|complex.h|lang=c}}, {{header|ccomplex}}, {{header|tgmath.h|lang=c}}, and {{header|ctgmath}} do not contain any content from the C standard library and instead merely include other headers from the C++ standard library.
  
 
{{dsc begin}}
 
{{dsc begin}}
{{dsc|{{ttb|{{header|ccomplex}}}} {{mark life|since=c++11|deprecated=c++17|removed=c++20}} | simply includes the header {{header|complex}} }}
+
{{dsc inc|cpp/header/dsc ccomplex}}
{{dsc|{{ttb|&lt;complex.h&gt;}} {{mark deprecated}} | simply includes the header {{header|complex}}{{mark unreviewed dr|LWG}}<!--LWG 551/2536-->}}
+
{{dsc inc|cpp/header/dsc complex.h}}
{{dsc|{{ttb|{{header|ctgmath}}}} {{mark life|since=c++11|deprecated=c++17|removed=c++20}} | simply includes the headers {{header|complex}} and {{header|cmath}}: the overloads equivalent to the contents of the C header {{tt|tgmath.h}} are already provided by those headers }}
+
{{dsc inc|cpp/header/dsc ctgmath}}
{{dsc|{{ttb|&lt;tgmath.h&gt;}} {{mark deprecated}} | simply includes the headers {{header|complex}} and {{header|cmath}} {{mark unreviewed dr|LWG|2835}}}}
+
{{dsc inc|cpp/header/dsc tgmath.h}}
 
{{dsc end}}
 
{{dsc end}}
  
 
====Meaningless C headers====
 
====Meaningless C headers====
The headers {{tt|<ciso646>}}, {{tt|<cstdalign>}}, and {{tt|<cstdbool>}} are meaningless in C++ because the macros they provide in C are language keywords in C++.
+
The headers {{header|ciso646}}, {{header|cstdalign}}, and {{header|cstdbool}} are meaningless in C++ because the macros they provide in C are language keywords in C++.
  
 
{{dsc begin}}
 
{{dsc begin}}
{{dsc|{{ttb|{{header|ciso646}}}} {{mark until c++20|removed=yes}}| empty header. The macros that appear in {{tt|iso646.h}} in C are keywords in C++ }}
+
{{dsc inc|cpp/header/dsc ciso646}}
{{dsc|{{ttb|&lt;iso646.h&gt;}} {{mark deprecated}} | has no effect }}
+
{{dsc inc|cpp/header/dsc cstdalign}}
{{dsc|{{ttb|{{header|cstdalign}}}} {{mark life|since=c++11|deprecated=c++17|removed=c++20}} | defines one [[cpp/types |compatibility macro constant ]] }}
+
{{dsc inc|cpp/header/dsc cstdbool}}
{{dsc|{{ttb|&lt;stdalign.h&gt;}} {{mark deprecated}} |  defines one [[cpp/types |compatibility macro constant ]] }}
+
{{dsc inc|cpp/header/dsc iso646.h}}
{{dsc|{{ttb|{{header|cstdbool}}}} {{mark life|since=c++11|deprecated=c++17|removed=c++20}} | defines one [[cpp/types |compatibility macro constant ]] }}
+
{{dsc inc|cpp/header/dsc stdalign.h}}
{{dsc|{{ttb|&lt;stdbool.h&gt;}} {{mark deprecated}} | defines one [[cpp/types |compatibility macro constant ]]}}
+
{{dsc inc|cpp/header/dsc stdbool.h}}
 
{{dsc end}}
 
{{dsc end}}
  
 
====Unsupported C headers====
 
====Unsupported C headers====
The C headers {{tt|<stdatomic.h>}}, {{tt|<stdnoreturn.h>}}, and {{tt|<threads.h>}} are not included in C++ and have no {{c|cxxx}} equivalents.
+
The C headers {{rev inl|until=c++23|{{header|stdatomic.h|lang=c}},}} {{header|stdnoreturn.h|lang=c}}, and {{header|threads.h|lang=c}} are not included in C++ and have no {{tt|c''xxx''}} equivalents.
  
 
==={{rl|experimental|Experimental libraries}}===
 
==={{rl|experimental|Experimental libraries}}===
Line 218: Line 224:
 
===See also===
 
===See also===
 
{{dsc begin}}
 
{{dsc begin}}
{{dsc see c | c/header | C Standard Library headers}}
+
{{dsc see c|c/header|C Standard Library headers|nomono=true}}
 
{{dsc end}}
 
{{dsc end}}
  
 
{{langlinks|ar|de|es|fr|it|ja|pt|ru|zh}}
 
{{langlinks|ar|de|es|fr|it|ja|pt|ru|zh}}

Latest revision as of 18:43, 16 October 2024

 
 
Standard library headers
 

The interface of C++ standard library is defined by the following collection of headers.

Contents

Multi-purpose headers

General purpose utilities: program control, dynamic memory allocation, random numbers, sort and search[edit]
Predefined execution policies for parallel versions of the algorithms and execution control components(since C++26)[edit]

Language support library

Limits of floating-point types[edit]
Limits of integral types[edit]
(C++20)
Three-way comparison operator support[edit]
Coroutine support library[edit]
Macro (and function) that saves (and jumps) to an execution context[edit]
Functions and macro constants for signal management[edit]
Handling of variable length argument lists[edit]
Standard macros and typedefs[edit]
(C++11)
Fixed-width integer types and limits of other types[edit]
Exception handling utilities[edit]
std::initializer_list class template[edit]
Query properties of arithmetic types[edit]
Low-level memory management utilities[edit]
Supplies means to obtain source code location[edit]
Fixed-width floating-point types[edit]
std::type_index[edit]
Runtime type information utilities[edit]
(C++20)
Supplies macros for verifying implementation status of library[edit]

Concepts library

Fundamental library concepts[edit]

Diagnostics library

Conditionally compiled macro that compares its argument to zero[edit]
Macro containing the last error number[edit]
Debugging library[edit]
Stacktrace library[edit]
Standard exception types[edit]
Defines std::error_code, a platform-dependent error code[edit]

Memory management library

High-level memory management utilities[edit]
Polymorphic allocators and memory resources[edit]
Nested allocator class[edit]

Metaprogramming library

(C++11)
Compile-time rational arithmetic[edit]
Compile-time type information utilities[edit]

General utilities library

(C++17)
std::any class[edit]
(C++20)
Bit manipulation functions[edit]
std::bitset class template[edit]
std::expected class template[edit]
Function objects, Function invocations, Bind operations and Reference wrappers[edit]
std::optional class template[edit]
(C++11)
std::tuple class template[edit]
Various utility components[edit]
(C++17)
std::variant class template[edit]

Containers library

(C++11)
std::array container[edit]
std::deque container[edit]
std::flat_map and std::flat_multimap container adaptors[edit]
std::flat_set and std::flat_multiset container adaptors[edit]
std::forward_list container[edit]
std::inplace_vector container[edit]
std::list container[edit]
std::map and std::multimap associative containers[edit]
(C++23)
std::mdspan view[edit]
std::queue and std::priority_queue container adaptors[edit]
std::set and std::multiset associative containers[edit]
(C++20)
std::span view[edit]
std::stack container adaptor[edit]
std::unordered_map and std::unordered_multimap unordered associative containers[edit]
std::unordered_set and std::unordered_multiset unordered associative containers[edit]
std::vector container[edit]

Iterators library

Range iterators[edit]

Ranges library

std::generator class template[edit]
(C++20)
Range access, primitives, requirements, utilities and adaptors[edit]

Algorithms library

Algorithms that operate on ranges[edit]
Numeric operations on values in ranges[edit]

Strings library

Various narrow character string handling functions[edit]
std::basic_string class template[edit]
std::basic_string_view class template[edit]

Text processing library

Functions to determine the category of narrow characters[edit]
std::to_chars and std::from_chars[edit]
C localization utilities[edit]
(C++11)(deprecated in C++17)(removed in C++26)
Unicode conversion facilities[edit]
(C++11)
C-style Unicode character conversion functions[edit]
Various wide and multibyte string handling functions[edit]
Functions to determine the category of wide characters[edit]
(C++20)
Formatting library including std::format[edit]
Localization utilities[edit]
(C++11)
Classes, algorithms and iterators to support regular expression processing[edit]
Text encoding identifications[edit]

Numerics library

(C++11)
Floating-point environment access functions[edit]
Common mathematics functions[edit]
Complex number type[edit]
(C++26)
Basic linear algebra algorithms[edit]
(C++20)
Math constants[edit]
(C++11)
Random number generators and distributions[edit]
Class for representing and manipulating arrays of values[edit]

Time library

(C++11)
C++ time utilities[edit]
C-style time/date utilities[edit]

Input/output library

Formatting macros, intmax_t and uintmax_t math and conversions[edit]
C-style input-output functions[edit]
std::filesystem::path class and supporting functions[edit]
std::basic_fstream, std::basic_ifstream, std::basic_ofstream class templates and typedefs[edit]
Helper functions to control the format of input and output[edit]
std::ios_base class, std::basic_ios class template and typedefs[edit]
Forward declarations of all classes in the input/output library[edit]
Several standard stream objects[edit]
std::basic_istream class template and typedefs[edit]
std::basic_ostream, std::basic_iostream class templates and typedefs[edit]
(C++23)
Formatted output library including std::print[edit]
std::basic_spanstream, std::basic_ispanstream, std::basic_ospanstream class templates and typedefs[edit]
std::basic_stringstream, std::basic_istringstream, std::basic_ostringstream class templates and typedefs[edit]
std::basic_streambuf class template[edit]
(deprecated in C++98)(removed in C++26)
std::strstream, std::istrstream, std::ostrstream[edit]
std::basic_osyncstream, std::basic_syncbuf and typedefs[edit]

Concurrency support library

(C++11)
Atomic operations library[edit]
(C++20)
Barriers[edit]
Thread waiting conditions[edit]
(C++11)
Primitives for asynchronous computations[edit]
Hazard pointers[edit]
(C++20)
Latches[edit]
(C++11)
Mutual exclusion primitives[edit]
(C++26)
Read-copy update mechanisms[edit]
Semaphores[edit]
Shared mutual exclusion primitives[edit]
Stop tokens for std::jthread[edit]
(C++11)
std::thread class and supporting functions[edit]

[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>[edit]
Behaves as if each name from <cctype> is placed in global namespace[edit]
Behaves same as <cerrno>[edit]
(C++11)
Behaves as if each name from <cfenv> is placed in global namespace[edit]
Behaves same as <cfloat>[edit]
Behaves as if each name from <cinttypes> is placed in global namespace[edit]
Behaves same as <climits>[edit]
Behaves as if each name from <clocale> is placed in global namespace[edit]
Behaves as if each name from <cmath> is placed in global namespace,
except for names of mathematical special functions[edit]
Behaves as if each name from <csetjmp> is placed in global namespace[edit]
Behaves as if each name from <csignal> is placed in global namespace[edit]
Behaves as if each name from <cstdarg> is placed in global namespace[edit]
Behaves as if each name from <cstddef> is placed in global namespace,
except for names of std::byte and related functions[edit]
Behaves as if each name from <cstdint> is placed in global namespace[edit]
Behaves as if each name from <cstdio> is placed in global namespace[edit]
Behaves as if each name from <cstdlib> is placed in global namespace[edit]
Behaves as if each name from <cstring> is placed in global namespace[edit]
Behaves as if each name from <ctime> is placed in global namespace[edit]
(C++11)
Behaves as if each name from <cuchar> is placed in global namespace[edit]
Behaves as if each name from <cwchar> is placed in global namespace[edit]
Behaves as if each name from <cwctype> is placed in global namespace[edit]

[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.

Defines _Atomic and provides corresponding components in the C standard library[edit]

[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>[edit]
Simply includes the header <complex>[edit]
(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[edit]
Simply includes the headers <complex> and <cmath>[edit]

[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++[edit]
(C++11)(deprecated in C++17)(removed in C++20)
Defines one compatibility macro constant[edit]
(C++11)(deprecated in C++17)(removed in C++20)
Defines one compatibility macro constant[edit]
Has no effect[edit]
Defines one compatibility macro constant[edit]
Defines one compatibility macro constant[edit]

[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