C++ Standard Library Headers

 C++
Compiler support
Freestanding and hosted
Language
Standard library
Standard library headers
Named requirements
Feature test macros (C++20)
Language support library
Concepts library (C++20)
Metaprogramming library (C++11)
Diagnostics library
General utilities library
Strings library
Containers library
Iterators library
Ranges library (C++20)
Algorithms library
Numerics library
Localizations library
Input/output library
Filesystem library (C++17)
Regular expressions library (C++11)
Concurrency support library (C++11)
Execution support library (C++26)
Technical specifications
Symbols index
External libraries
[edit] Standard library headers
Language support
<cfloat>
<climits>
<compare> (C++20)
<coroutine> (C++20)
<csetjmp>
<csignal>
<cstdarg>
<cstddef>
<cstdint> (C++11)
<cstdlib>
<exception>
<initializer_list> (C++11)   
<limits>
<new>
<source_location> (C++20)
<stdfloat> (C++23)
<typeinfo>
<version> (C++20)
Concepts
<concepts> (C++20)
Diagnostics
<cassert>
<cerrno>
<debugging> (C++26)
<stacktrace> (C++23)
<stdexcept>
<system_error> (C++11)
Memory management
<memory>
<memory_resource> (C++17)
<scoped_allocator> (C++11)
Metaprogramming
<type_traits> (C++11)
<ratio> (C++11)
General utilities
<any> (C++17)
<bitset>
<bit> (C++20)
<charconv> (C++17)
<expected> (C++23)
<format> (C++20)
<functional>
<optional> (C++17)
<tuple> (C++11)
<typeindex> (C++11)
<utility>
<variant> (C++17)
Containers
<array> (C++11)
<deque>
<flat_map> (C++23)
<flat_set> (C++23)
<forward_list> (C++11)
<inplace_vector> (C++26)   
<list>
<map>
<mdspan> (C++23)
<queue>
<set>
<span> (C++20)
<stack>
<unordered_map> (C++11)
<unordered_set> (C++11)
<vector>
Iterators
<iterator>
Ranges
<generator> (C++23)
<ranges> (C++20)
Algorithms
<algorithm>
<numeric>
Strings
<cctype>
<cstring>
<cuchar> (C++11)
<cwchar>
<cwctype>
<string_view> (C++17)
<string>
Text processing
<clocale>
<codecvt> (C++11/17/26*)
<locale>
<regex> (C++11)
<text_encoding> (C++26)   
Numerics
<cfenv> (C++11)
<cmath>
<complex>
<linalg> (C++26)
<numbers> (C++20)
<random> (C++11)
<simd> (C++26)
<valarray>
Time
<chrono> (C++11)
<ctime>
C compatibility
<ccomplex> (C++11/17/20*)
<ciso646> (until C++20)
<cstdalign> (C++11/17/20*)
<cstdbool> (C++11/17/20*)
<ctgmath> (C++11/17/20*)
Input/output
<cinttypes> (C++11)
<cstdio>
<filesystem> (C++17)
<fstream>
<iomanip>
<iosfwd>
<iostream>
<ios>
<istream>
<ostream>
<print> (C++23)
<spanstream> (C++23)
<sstream>
<streambuf>
<strstream> (C++98/26*)
<syncstream> (C++20)
Concurrency support
<atomic> (C++11)
<barrier> (C++20)
<condition_variable> (C++11)
<future> (C++11)
<hazard_pointer> (C++26)
<latch> (C++20)
<mutex> (C++11)
<rcu> (C++26)
<semaphore> (C++20)
<shared_mutex> (C++14)
<stdatomic.h> (C++23)
<stop_token> (C++20)
<thread> (C++11)
Execution support
<execution> (C++17)
[edit] 

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

Multi-purpose headers

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

Language support library

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

Concepts library

<concepts>(C++20) Fundamental library concepts[edit]

Diagnostics library

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

Memory management library

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

Metaprogramming library

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

General utilities library

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

Containers library

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

Iterators library

<iterator> Range iterators[edit]

Ranges library

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

Algorithms library

<algorithm> Algorithms that operate on ranges[edit]
<numeric> Numeric operations on values in ranges[edit]

Strings library

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

Text processing library

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

Numerics library

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

Time library

<chrono>(C++11) C++ time utilities[edit]
<ctime> C-style time/date utilities[edit]

Input/output library

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

Concurrency support library

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

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

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

<ccomplex>(C++11)(deprecated in C++17)(removed in C++20) Simply includes the header <complex>[edit]
<complex.h>(C++11) Simply includes the header <complex>[edit]
<ctgmath>(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]
<tgmath.h>(C++11) 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++.

<ciso646>(removed in C++20) Empty header. The macros that appear in iso646.h in C are keywords in C++[edit]
<cstdalign>(C++11)(deprecated in C++17)(removed in C++20) Defines one compatibility macro constant[edit]
<cstdbool>(C++11)(deprecated in C++17)(removed in C++20) Defines one compatibility macro constant[edit]
<iso646.h> Has no effect[edit]
<stdalign.h>(C++11) Defines one compatibility macro constant[edit]
<stdbool.h>(C++11) 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

Từ khóa » Thư Viện Errno.h