C++ 標準庫頭文件

C++ 標準庫的接口由下列頭文件的聚集定義。html

概念庫

<concepts>ios

(C++20)正則表達式

基礎庫概念算法

協程庫

<coroutine>api

(C++20)數組

協程支持庫dom

工具庫

<cstdlib>異步

通用工具:程序控制動態內存分配隨機數排序與搜索ide

<csignal>函數

信號管理的函數與宏常量

<csetjmp>

保存(及跳轉)到執行環境的宏(與函數)

<cstdarg>

變長實參列表的處理

<typeinfo>

運行時類型信息工具

<typeindex>

(C++11)

std::type_index

<type_traits>

(C++11)

編譯時類型信息

<bitset>

std::bitset 類模板

<functional>

函數對象、函數調用、綁定操做及引用包裝

<utility>

多種工具組件

<ctime>

C 風格日期/時間工具

<chrono>

(C++11)

C++ 時間工具

<cstddef>

標準宏與 typedef

<initializer_list>

(C++11)

std::initializer_list 類模板

<tuple>

(C++11)

std::tuple 類模板

<any>

(C++17)

std::any

<optional>

(C++17)

std::optional 類模板

<variant>

(C++17)

std::variant 類模板

<compare>

(C++20)

三路比較運算符支持

<version>

(C++20)

提供依賴實現的庫信息

<source_location>

(C++20)

提供得到源碼位置的手段

動態內存管理

<new>

低層內存管理工具

<memory>

高層內存管理工具

<scoped_allocator>

(C++11)

嵌套分配器類

<memory_resource>

(C++17)

多態分配器與內存資源

數值極限

<climits>

整數類型的極限

<cfloat>

浮點類型的極限

<cstdint>

(C++11)

定寬整數類型其餘類型的極限

<cinttypes>

(C++11)

格式化宏intmax_tuintmax_t 數學與轉換

<limits>

查詢算術類型屬性的一致方式

錯誤處理

<exception>

異常處理工具

<stdexcept>

標準異常對象

<cassert>

比較其實參與零的條件編譯宏

<system_error>

(C++11)

定義 std::error_code ,依賴平臺的錯誤碼

<cerrno>

含有最後一次錯誤號的宏

字符串庫

<cctype>

肯定窄字符類別的函數

<cwctype>

肯定寬字符的類別的函數

<cstring>

多種窄字符串處理函數

<cwchar>

多種多字節字符串處理函數

<cuchar>

(C++11)

C 風格 Unicode 字符轉換函數

<string>

std::basic_string 類模板

<string_view>

(C++17)

std::basic_string_view 類模板

<charconv>

(C++17)

std::to_chars 與 std::from_chars

<format>

(C++20)

格式化庫,包括 std::format

容器庫

<array>

(C++11)

std::array 容器

<vector>

std::vector 容器

<deque>

std::deque 容器

<list>

std::list 容器

<forward_list>

(C++11)

std::forward_list 容器

<set>

std::setstd::multiset 關聯容器

<map>

std::mapstd::multimap 關聯容器

<unordered_set>

(C++11)

std::unordered_setstd::unordered_multiset 無序關聯容器

<unordered_map>

(C++11)

std::unordered_mapstd::unordered_multimap 無序關聯容器

<stack>

std::stack 容器適配器

<queue>

std::queuestd::priority_queue 容器適配器

<span>

(C++20)

std::span 視圖

迭代器庫

<iterator>

範圍迭代器

範圍庫

<ranges>

(C++20)

範圍訪問、元件、要求、工具及適配器

算法庫

<algorithm>

在範圍上操做的算法

<execution>

(C++17)

並行版本算法的預約義執行策略

數值庫

<cmath>

經常使用數學函數

<complex>

複數類型

<valarray>

表示和操縱值的數組的類

<random>

(C++11)

隨機數生成器與分佈

<numeric>

範圍中的值上的數值運算

<ratio>

(C++11)

編譯時有理數算術

<cfenv>

(C++11)

浮點環境訪問函數

<bit>

(C++20)

位操縱函數

<numbers>

(C++20)

數學常數

本地化庫

<locale>

本地化工具

<clocale>

C 本地化工具

<codecvt>

(C++11)(C++17 中棄用)

Unicode 轉換設施

輸入/輸出庫

<iosfwd>

輸入/輸出庫中全部類的前置聲明

<ios>

std::ios_base 類、 std::basic_ios 類模板與數個 typedef

<istream>

std::basic_istream 類模板與數個 typedef

<ostream>

std::basic_ostreamstd::basic_iostream 類模板與數個 typedef

<iostream>

數個標準流對象

<fstream>

std::basic_fstreamstd::basic_ifstreamstd::basic_ofstream 類模板及數個 typedef

<sstream>

std::basic_stringstreamstd::basic_istringstreamstd::basic_ostringstream 類模板與數個 typedef

<syncstream>

(C++20)

std::basic_osyncstream 、 std::basic_syncbuf 及 typedef

<strstream>

(C++98 中棄用)

std::strstreamstd::istrstreamstd::ostrstream

<iomanip>

格式化輸入與輸出的輔助函數

<streambuf>

std::basic_streambuf 類模板

<cstdio>

C 風格輸入輸出函數

文件系統庫

<filesystem>

(C++17)

std::path 類與支持函數

正則表達式庫

<regex>

(C++11)

支持正則表達式處理的類、算法及迭代器

原子操做庫

<atomic>

(C++11)

原子操做庫

線程支持庫

<thread>

(C++11)

std::thread 類與支持函數

<stop_token>

(C++20)

std::jthread 的中止記號

<mutex>

(C++11)

互斥元件

<shared_mutex>

(C++14)

共享互斥元件

<future>

(C++11)

異步計算元件

<condition_variable>

(C++11)

線程等待條件

<semaphore>

(C++20)

信號量

<latch>

(C++20)

<barrier>

(C++20)

屏障

C 兼容頭文件

對於一些形式爲 xxx.h 的 C 標準庫頭文件,C++ 標準庫同時包含同名的頭文件和擁有形式 cxxx 的頭文件(全部有意義的 cxxx 頭文件列於上方)。

除了 complex.h 這一例外,C++ 標準庫中包含的每一個 xxx.h 頭文件都將其對應的 cxxx 中本應置於 std 命名空間中的每一個名字放在全局命名空間中。

容許這些頭文件也在 std 命名空間中聲明一樣的名字,並且容許對應的 cxxx 頭文件也在全局命名空間中聲明一樣的名字:包含 <cstdlib> 確定會提供 std::malloc,亦可提供 ::malloc。包含 <stdlib.h> 確定會提供 ::malloc,亦可提供 std::malloc。這甚至適用於並不是 C 標準庫一部分的函數和函數重載。

<assert.h>

(棄用)

表現同 <cassert>

<ctype.h>

(棄用)

表現如同將每一個來自 <cctype> 的名字置於全局命名空間

<errno.h>

(棄用)

表現同 <cerrno>

<fenv.h>

(C++11)(棄用)

表現如同將每一個來自 <cfenv> 的名字置於全局命名空間

<float.h>

(棄用)

表現同 <cfloat>

<inttypes.h>

(C++11)(棄用)

表現如同將每一個來自 <cinttypes> 的名字置於全局命名空間

<limits.h>

(棄用)

表現同 <climits>

<locale.h>

(棄用)

表現如同將每一個來自 <clocale> 的名字置於全局命名空間

<math.h>

(棄用)

表現如同將每一個來自 <cmath> 的名字置於全局命名空間,
除了數學特殊函數的名字

<setjmp.h>

(棄用)

表現如同將每一個來自 <csetjmp> 的名字置於全局命名空間

<signal.h>

(棄用)

表現如同將每一個來自 <csignal> 的名字置於全局命名空間

<stdarg.h>

(棄用)

表現如同將每一個來自 <cstdarg> 的名字置於全局命名空間

<stddef.h>

(棄用)

表現如同將每一個來自 <cstddef> 的名字置於全局命名空間,
除了 std::byte 與相關函數的名字

<stdint.h>

(C++11)(棄用)

表現如同將每一個來自 <cstdint> 的名字置於全局命名空間

<stdio.h>

(棄用)

表現如同將每一個來自 <cstdio> 的名字置於全局命名空間

<stdlib.h>

(棄用)

表現如同將每一個來自 <cstdlib> 的名字置於全局命名空間

<string.h>

(棄用)

表現如同將每一個來自 <cstring> 的名字置於全局命名空間

<time.h>

(棄用)

表現如同將每一個來自 <ctime> 的名字置於全局命名空間

<uchar.h>

(C++11)(棄用)

表現如同將每一個來自 <cuchar> 的名字置於全局命名空間

<wchar.h>

(棄用)

表現如同將每一個來自 <cwchar> 的名字置於全局命名空間

<wctype.h>

(棄用)

表現如同將每一個來自 <cwctype> 的名字置於全局命名空間

空 C 頭文件

頭文件 <complex.h><ccomplex><tgmath.h><ctgmath> 不含有任何來自 C 標準庫的內容,並且不過是包含其餘來自 C++ 標準庫的頭文件。C++ 中這些頭文件的使用均已被棄用。

<ccomplex>

(C++11)(C++17 中棄用)(C++20 中移除)

簡單地包含頭文件 <complex>

<complex.h>

(C++11)(棄用)

簡單地包含頭文件 <complex>

<ctgmath>

(C++11)(C++17 中棄用)(C++20 中移除)

簡單地包含頭文件 <complex><cmath> :等價於 C 頭文件 tgmath.h 的重載已於前述頭文件提供

<tgmath.h>

(C++11)(棄用)

簡單地包含頭文件 <complex><cmath>

無心義的 C 頭文件

頭文件 <ciso646><cstdalign><cstdbool> 在 C++ 中無心義,由於它們在 C 中提供的宏是 C++ 的關鍵詞。

<ciso646>

(C++20 中移除)

空頭文件。 C 中 iso646.h 中出現的宏C++ 中的關鍵詞

<iso646.h>

(棄用)

無效果

<cstdalign>

(C++11)(C++17 中棄用)(C++20 中移除)

定義一個兼容性宏常量

<stdalign.h>

(C++11)(棄用)

定義一個兼容性宏常量

<cstdbool>

(C++11)(C++17 中棄用)(C++20 中移除)

定義一個兼容性宏常量

<stdbool.h>

(C++11)(棄用)

定義一個兼容性宏常量

不受支持的 C 頭文件

C++ 不包含 C 頭文件 <stdatomic.h><stdnoreturn.h><threads.h> 並且它們無 cxxx 等價版本。

實驗性庫

C++ TR/TS 亦定義數個頭文件的聚集。

相關文章
相關標籤/搜索