C++ Standard Library headers

From cppreference.com
< cpp
 
 
Standard library headers
Language support
Concepts
<concepts> (C++20)
Diagnostics
<system_error> (C++11)

Memory management
<memory_resource> (C++17)  
Metaprogramming
<type_traits> (C++11)
<ratio> (C++11)
General utilities
<utility>
<tuple> (C++11)
<optional> (C++17)
<variant> (C++17)
<any> (C++17)
<expected> (C++23)
<bitset>

<charconv> (C++17)
<format> (C++20)
<bit> (C++20)

Strings
<cuchar> (C++11)

Containers
<flat_set> (C++23)
<span> (C++20)
<mdspan> (C++23)

Iterators
<iterator>
Ranges
<ranges> (C++20)
<generator> (C++23)
Algorithms
Numerics
<cfenv> (C++11)
<complex>
<numbers> (C++20)

Time
<chrono> (C++11)
Localization
<codecvt> (C++11/17*)
Input/output
<filesystem> (C++17)
<cstdio>
<cinttypes> (C++11)
<strstream> (C++98*)
Regular expressions
<regex> (C++11)
Concurrency support
<stop_token> (C++20)
<thread> (C++11)
<atomic> (C++11)
<stdatomic.h> (C++23)
<mutex> (C++11)
<shared_mutex> (C++14)
<condition_variable> (C++11)  
<semaphore> (C++20)
<latch> (C++20)
<barrier> (C++20)
<future> (C++11)

C compatibility
<cstdbool> (C++11/17/20*)  
<ccomplex> (C++11/17/20*)
<ctgmath> (C++11/17/20*)

<cstdalign> (C++11/17/20*)

<ciso646> (until C++20)

 

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

Concepts library

Fundamental library concepts

Coroutines library

Coroutine support library

Utilities library

(C++17)
std::any class
std::bitset class template
(C++11)
C++ time utilities
(C++20)
Three-way comparison operator support
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
General purpose utilities: program control, dynamic memory allocation, random numbers, sort and search
C-style time/date utilities
std::expected class template
Function objects, Function invocations, Bind operations and Reference wrappers
std::initializer_list class template
std::optional class template
Supplies means to obtain source code location
(C++11)
std::tuple class template
Compile-time type information
std::type_index
Runtime type information utilities
Various utility components
(C++17)
std::variant class template
(C++20)
Supplies implementation-dependent library information
Dynamic memory management
High-level memory management utilities
Polymorphic allocators and memory resources
Low-level memory management utilities
Nested allocator class
Numeric limits
Limits of floating-point types
Formatting macros, intmax_t and uintmax_t math and conversions
Limits of integral types
(C++11)
Fixed-width integer types and limits of other types
Uniform way to query properties of arithmetic types
Optional extended floating-point types
Error handling
Conditionally compiled macro that compares its argument to zero
Macro containing the last error number
Exception handling utilities
Stacktrace library
Standard exception objects
Defines std::error_code, a platform-dependent error code

Strings library

Functions to determine the category of narrow characters
std::to_chars and std::from_chars
Various narrow character string handling functions
(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
std::basic_string class template
std::basic_string_view 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::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
Predefined execution policies for parallel versions of the algorithms

Numerics library

(C++20)
Bit manipulation functions
(C++11)
Floating-point environment access functions
Common mathematics functions
Complex number type
(C++20)
Math constants
Numeric operations on values in ranges
(C++11)
Random number generators and distributions
(C++11)
Compile-time rational arithmetic
Class for representing and manipulating arrays of values

Localization library

C localization utilities
(C++11)(deprecated in C++17)
Unicode conversion facilities
Localization utilities
Text encoding identifications

Input/output library

C-style input-output functions
std::basic_fstream, std::basic_ifstream, std::basic_ofstream class templates and several typedefs
Helper functions to control the format of input and output
std::ios_base class, std::basic_ios class template and several typedefs
Forward declarations of all classes in the input/output library
Several standard stream objects
std::basic_istream class template and several typedefs
std::basic_ostream, std::basic_iostream class templates and several 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 several typedefs
std::basic_streambuf class template
(deprecated in C++98)
std::strstream, std::istrstream, std::ostrstream
std::basic_osyncstream, std::basic_syncbuf, and typedefs

Filesystem library

std::path class and supporting functions

Regular Expressions library

(C++11)
Classes, algorithms and iterators to support regular expression processing

Atomic Operations library

(C++11)
Atomic operations library

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