# C++ Standard Library headers

> C++ Atlas: `cppatlas.com/w/cpp/header` | Source: https://en.cppreference.com/w/cpp/header | Domain: Standard headers | Standards: C++98, C++11, C++14, C++17, C++20, C++23, C++26

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

## Official Specification Summary (cppreference)

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

**Multi-purpose headers**

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

**Language support library**

- `<cfloat>`: Limits of floating-point types
- `<climits>`: Limits of integral types
- `<compare>` (C++20): Three-way comparison operator support
- `<coroutine>` (C++20): Coroutine support library
- `<csetjmp>`: Macro (and function) that saves (and jumps) to an execution context
- `<csignal>`: Functions and macro constants for signal management
- `<cstdarg>`: Handling of variable length argument lists
- `<cstddef>`: Standard macros and typedefs
- `<cstdint>` (C++11): Fixed-width integer types and limits of other types
- `<exception>`: Exception handling utilities
- `<initializer_list>` (C++11): `std::initializer_list` class template
- `<limits>`: Query properties of arithmetic types
- `<new>`: Low-level memory management utilities
- `<source_location>` (C++20): Supplies means to obtain source code location
- `<stdfloat>` (C++23): Fixed-width floating-point types
- `<typeindex>` (C++11): `std::type_index`
- `<typeinfo>`: Runtime type information utilities
- `<version>` (C++20): Supplies macros for verifying implementation status of library

**Concepts library**

- `<concepts>` (C++20): Fundamental library concepts

**Diagnostics library**

- `<cassert>`: Conditionally compiled macro that compares its argument to zero
- `<cerrno>`: Macro containing the last error number
- `<debugging>` (C++26): Debugging library
- `<stacktrace>` (C++23): Stacktrace library
- `<stdexcept>`: Standard exception types
- `<system_error>` (C++11): Defines `std::error_code`, a platform-dependent error code

**Memory management library**

- `<memory>`: High-level memory management utilities
- `<memory_resource>` (C++17): Polymorphic allocators and memory resources
- `<scoped_allocator>` (C++11): Nested allocator class

**Metaprogramming library**

- `<ratio>` (C++11): Compile-time rational arithmetic
- `<type_traits>` (C++11): Compile-time type information utilities

**General utilities library**

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

**Containers library**

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

**Iterators library**

- `<iterator>`: Range iterators

**Ranges library**

- `<generator>` (C++23): `std::generator` class template
- `<ranges>` (C++20): Range access, primitives, requirements, utilities and adaptors

**Algorithms library**

- `<algorithm>`: Algorithms that operate on ranges
- `<numeric>`: Numeric operations on values in ranges

**Strings library**

- `<cstring>`: Various narrow character string handling functions
- `<string>`: `std::basic_string` class template
- `<string_view>` (C++17): `std::basic_string_view` class template

**Text processing library**

- `<cctype>`: Functions to determine the category of narrow characters
- `<charconv>` (C++17): `std::to_chars` and `std::from_chars`
- `<clocale>`: C localization utilities
- `<codecvt>` (C++11): Unicode conversion facilities
- `<cuchar>` (C++11): C-style Unicode character conversion functions
- `<cwchar>`: Various wide and multibyte string handling functions
- `<cwctype>`: Functions to determine the category of wide characters
- `<format>` (C++20): Formatting library including `std::format`
- `<locale>`: Localization utilities
- `<regex>` (C++11): Classes, algorithms and iterators to support regular expression processing
- `<text_encoding>` (C++26): Text encoding identifications

**Numerics library**

- `<cfenv>` (C++11): Floating-point environment access functions
- `<cmath>`: Common mathematics functions
- `<complex>`: Complex number type
- `<linalg>` (C++26): Basic linear algebra algorithms (BLAS)
- `<numbers>` (C++20): Math constants
- `<random>` (C++11): Random number generators and distributions
- `<simd>` (C++26): Data-parallel types and operations on these types
- `<valarray>`: Class for representing and manipulating arrays of values

**Time library**

- `<chrono>` (C++11): C++ time utilities
- `<ctime>`: C-style time/date utilities

**Input/output library**

- `<cinttypes>` (C++11): Formatting macros, `intmax_t` and `uintmax_t` math and conversions
- `<cstdio>`: C-style input-output functions
- `<filesystem>` (C++17): `std::filesystem::path` class and supporting functions
- `<fstream>`: `std::basic_fstream`, `std::basic_ifstream`, `std::basic_ofstream` class templates and typedefs
- `<iomanip>`: Helper functions to control the format of input and output
- `<ios>`: `std::ios_base` class, `std::basic_ios` class template and typedefs
- `<iosfwd>`: Forward declarations of all classes in the input/output library
- `<iostream>`: Several standard stream objects
- `<istream>`: `std::basic_istream` class template and typedefs
- `<ostream>`: `std::basic_ostream`, `std::basic_iostream` class templates and typedefs
- `<print>` (C++23): Formatted output library including `std::print`
- `<spanstream>` (C++23): `std::basic_spanstream`, `std::basic_ispanstream`, `std::basic_ospanstream` class templates and typedefs
- `<sstream>`: `std::basic_stringstream`, `std::basic_istringstream`, `std::basic_ostringstream` class templates and typedefs
- `<streambuf>`: `std::basic_streambuf` class template
- `<strstream>` (deprecated in C++98): `std::strstream`, `std::istrstream`, `std::ostrstream`
- `<syncstream>` (C++20): `std::basic_osyncstream`, `std::basic_syncbuf` and typedefs

**Concurrency support library**

- `<atomic>` (C++11): Atomic operations library
- `<barrier>` (C++20): Barriers
- `<condition_variable>` (C++11): Thread waiting conditions
- `<future>` (C++11): Primitives for asynchronous computations
- `<hazard_pointer>` (C++26): Hazard pointers
- `<latch>` (C++20): Latches
- `<mutex>` (C++11): Mutual exclusion primitives
- `<rcu>` (C++26): Read-copy update mechanisms
- `<semaphore>` (C++20): Semaphores
- `<shared_mutex>` (C++14): Shared mutual exclusion primitives
- `<stop_token>` (C++20): Stop tokens for `std::jthread`
- `<thread>` (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.

- `<assert.h>`: Behaves same as `<cassert>`
- `<ctype.h>`: Behaves as if each name from `<cctype>` is placed in global namespace
- `<errno.h>`: Behaves same as `<cerrno>`
- `<fenv.h>` (C++11): Behaves as if each name from `<cfenv>` is placed in global namespace
- `<float.h>`: Behaves same as `<cfloat>`
- `<inttypes.h>` (C++11): Behaves as if each name from `<cinttypes>` is placed in global namespace
- `<limits.h>`: Behaves same as `<climits>`
- `<locale.h>`: Behaves as if each name from `<clocale>` is placed in global namespace
- `<math.h>`: Behaves as if each name from `<cmath>` is placed in global namespace, except for names of mathematical special functions
- `<setjmp.h>`: Behaves as if each name from `<csetjmp>` is placed in global namespace
- `<signal.h>`: Behaves as if each name from `<csignal>` is placed in global namespace
- `<stdarg.h>`: Behaves as if each name from `<cstdarg>` is placed in global namespace
- `<stddef.h>`: Behaves as if each name from `<cstddef>` is placed in global namespace, except for names of `std::byte` and related functions
- `<stdint.h>` (C++11): Behaves as if each name from `<cstdint>` is placed in global namespace
- `<stdio.h>`: Behaves as if each name from `<cstdio>` is placed in global namespace
- `<stdlib.h>`: Behaves as if each name from `<cstdlib>` is placed in global namespace
- `<string.h>`: Behaves as if each name from `<cstring>` is placed in global namespace
- `<time.h>`: Behaves as if each name from `<ctime>` is placed in global namespace
- `<uchar.h>` (C++11): Behaves as if each name from `<cuchar>` is placed in global namespace
- `<wchar.h>`: Behaves as if each name from `<cwchar>` is placed in global namespace
- `<wctype.h>`: 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.

- `<stdatomic.h>` (C++23): 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.

- `<ccomplex>` (C++11): Simply includes the header `<complex>`
- `<complex.h>` (C++11): Simply includes the header `<complex>`
- `<ctgmath>` (C++11): 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
- `<tgmath.h>` (C++11): 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++.

- `<ciso646>` (removed in C++20): Empty header. The macros that appear in `iso646.h` in C are keywords in C++
- `<cstdalign>` (C++11): Defines one compatibility macro constant
- `<cstdbool>` (C++11): Defines one compatibility macro constant
- `<iso646.h>`: Has no effect
- `<stdalign.h>` (C++11): Defines one compatibility macro constant
- `<stdbool.h>` (C++11): 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](https://en.cppreference.com/w/c/header)

---
Attribution: content from https://en.cppreference.com/w/cpp/header (cppreference.com), licensed under CC-BY-SA 3.0 and GFDL. Modified: converted to markdown, study notes added. Offline snapshot of 9 February 2025.