C++ Standard Library headers - cppreference.com (original) (raw)

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

Contents 1 Multi-purpose headers 2 Language support library 3 Concepts library 4 Diagnostics library 5 Memory management library 6 Metaprogramming library 7 General utilities library 8 Containers library 9 Iterators library 10 Ranges library 11 Algorithms library 12 Strings library 13 Text processing library 14 Numerics library 15 Time library 16 Input/output library 17 Concurrency support library 18 C compatibility headers 18.1 Special C compatibility headers 18.2 Empty C headers 18.3 Meaningless C headers 18.4 Unsupported C headers 19 Experimental libraries 20 See also
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]
Three-way comparison operator support[edit]
Contracts support library[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]
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]
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
Compile-time rational arithmetic[edit]
Compile-time type information utilities[edit]
General utilities library
std::any class[edit]
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]
std::tuple class template[edit]
Various utility components[edit]
std::variant class template[edit]
Containers library
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::hive container[edit]
std::inplace_vector container[edit]
std::list container[edit]
std::map and std::multimap associative containers[edit]
std::mdspan view[edit]
std::queue and std::priority_queue container adaptors[edit]
std::set and std::multiset associative containers[edit]
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]
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-style Unicode character conversion functions[edit]
Various wide and multibyte string handling functions[edit]
Functions to determine the category of wide characters[edit]
Formatting library including std::format[edit]
Localization utilities[edit]
Classes, algorithms and iterators to support regular expression processing[edit]
Text encoding identifications[edit]
Numerics library
Floating-point environment access functions[edit]
Common mathematics functions[edit]
Complex number type[edit]
Basic linear algebra algorithms (BLAS)[edit]
Math constants[edit]
Random number generators and distributions[edit]
Data-parallel types and operations on these types[edit]
Class for representing and manipulating arrays of values[edit]
Time library
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]
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
Atomic operations library[edit]
Barriers[edit]
Thread waiting conditions[edit]
Primitives for asynchronous computations[edit]
Hazard pointers[edit]
Latches[edit]
Mutual exclusion primitives[edit]
Read-copy update mechanisms[edit]
Semaphores[edit]
Shared mutual exclusion primitives[edit]
Stop tokens for std::jthread[edit]
std::thread class and supporting functions[edit]

[edit]

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 c_xxx_ (all meaningful c_xxx_ 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 c_xxx_ 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 c_xxx_ headers are allowed to also declare the same names in the global namespace: including 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.

<assert.h> Behaves same as [edit]
<ctype.h> Behaves as if each name from is placed in global namespace[edit]
<errno.h> Behaves same as [edit]
<fenv.h>(C++11) Behaves as if each name from is placed in global namespace[edit]
<float.h> Behaves same as [edit]
<inttypes.h>(C++11) Behaves as if each name from is placed in global namespace[edit]
<limits.h> Behaves same as [edit]
<locale.h> Behaves as if each name from is placed in global namespace[edit]
<math.h> Behaves as if each name from is placed in global namespace,except for names of mathematical special functions[edit]
<setjmp.h> Behaves as if each name from is placed in global namespace[edit]
<signal.h> Behaves as if each name from is placed in global namespace[edit]
<stdarg.h> Behaves as if each name from is placed in global namespace[edit]
<stddef.h> Behaves as if each name from is placed in global namespace,except for names of std::byte and related functions[edit]
<stdint.h>(C++11) Behaves as if each name from is placed in global namespace[edit]
<stdio.h> Behaves as if each name from is placed in global namespace[edit]
<stdlib.h> Behaves as if each name from is placed in global namespace[edit]
<string.h> Behaves as if each name from is placed in global namespace[edit]
<time.h> Behaves as if each name from is placed in global namespace[edit]
<uchar.h>(C++11) Behaves as if each name from is placed in global namespace[edit]
<wchar.h> Behaves as if each name from is placed in global namespace[edit]
<wctype.h> Behaves as if each name from is placed in global namespace[edit]

[edit]

The headers <stdatomic.h>, <stdbit.h>, and <stdckdint.h> declare names which are also provided in the C standard library. The header <stdatomic.h> also defines the _Atomic macro which is a keyword in C. Unlike other <_xxx_.h> headers, corresponding <cstdatomic>, <cstdbit>, and <cstdckdint> are not provided.

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

[edit]

The headers <complex.h>, , <tgmath.h>, and do not contain any content from the C standard library and instead merely include other headers from the C++ standard library.

[edit]

The headers , , and 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 compatibility macro constants __alignas_is_defined and __alignof_is_defined[edit]
(C++11)(deprecated in C++17)(removed in C++20) Defines a compatibility macro constant __bool_true_false_are_defined[edit]
<iso646.h> Has no effect[edit]
<stdalign.h>(C++11) Defines compatibility macro constants __alignas_is_defined and __alignof_is_defined[edit]
<stdbool.h>(C++11) Defines a compatibility macro constant __bool_true_false_are_defined[edit]

[edit]

The C headers <stdatomic.h>,(until C++23) <stdnoreturn.h>, and <threads.h> are not included in C++ and have no c_xxx_ equivalents.

[edit] Experimental libraries

C++ TR's/TS's also define several collections of headers.

[edit] See also