C++ Standard Library headers

From cppreference.com
< cpp
 
 
Standard library headers
 

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

Multi-purpose headers

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

Language support library

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

Concepts library

Fundamental library concepts

Diagnostics library

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

Memory management library

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

Metaprogramming library

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

General utilities library

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

Containers library

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

Iterators library

Range iterators

Ranges library

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

Algorithms library

Algorithms that operate on ranges
Numeric operations on values in ranges

Strings library

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

Text processing library

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

Numerics library

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

Time library

(C++11)
C++ time utilities
C-style time/date utilities

Input/output library

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

Concurrency support library

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

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

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

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>
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
Simply includes the headers <complex> and <cmath>

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
Defines one compatibility macro constant
Defines one compatibility macro constant

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.

Experimental libraries

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

See also

C documentation for C Standard Library headers