C++ 標準庫標頭檔案


C++ 標準庫包含不同型別的庫。以下是所有這些型別及其下屬庫的列表。

實用程式庫

<cstdlib> − 通用實用程式,如程式控制、動態記憶體分配、隨機數、排序和搜尋

<csignal>  − 用於訊號管理的函式和宏常量(例如 SIGINT 等)

<csetjmp>  − 儲存(和跳轉)到執行上下文的宏(和函式)

<cstdarg> − 處理可變長度引數列表

<typeinfo> − 執行時型別資訊實用程式

<bitset> − std::bitset 的類模板

<functional> − 函式物件、函式呼叫、繫結操作和引用包裝器

<utility> − 各種實用程式元件

<ctime> − C 樣式的時間/日期實用程式

<cstddef> − 標準宏和型別定義

<typeindex>(自 C++11 起) − 圍繞 type_info 物件的包裝器,可以用作關聯和無序關聯容器中的索引

<type_traits> (自 C++11 起) − 編譯時型別資訊

<chrono> (自 C++11 起) − C++ 時間實用程式

<initializer_list> (自 C++11 起) − 定義輕量級代理物件的庫,該物件提供對型別為 const T 的物件陣列的訪問。

<tuple> (自 C++11 起) − 定義固定大小的異構值集合的庫。它是 std::pair 的泛化。

<any> (自 C++17 起) − any 類描述了一個型別安全的容器,用於儲存任何型別的單個值。

<optional> (自 C++17 起) − std::optional 類模板管理一個可選的包含值,即可能存在也可能不存在的值。

<variant> (自 C++17 起) − std::variant 類模板表示一個型別安全的聯合。std::variant 的例項在任何給定時間都持有其備選型別之一的值,或者在發生錯誤的情況下 - 沒有值。

<compare> (自 C++20 起) − 允許三向比較運算子支援

動態記憶體管理

<new> − 低階記憶體管理實用程式。new 表示式是建立具有動態儲存期的物件或物件陣列的唯一方法,即生命週期不受其建立範圍限制的物件或物件陣列。

<memory> − 更高級別的記憶體管理實用程式

<scoped_allocator> (自 C++11 起) − std::scoped_allocator_adaptor 類模板是一個分配器,可用於多級容器(列表的元組的地圖的集合的向量等)。

<memory_resource> (自 C++17 起) − std::pmr::memory_resource 類是封裝記憶體資源的類的不定集的抽象介面。

數值限制

<climits>  − 整數型別的限制

<cfloat> − 浮點型別的限制

<limits> − 查詢算術型別屬性的標準化方式

<cstdint> (自 C++11 起) − 固定大小的型別和其他型別的限制

<cinttypes> (自 C++11 起) − 提供從 C 位元組和寬字串到 std::intmax_t 和 std::uintmax_t 的轉換,為 std::intmax_t 過載一些數學函式,併為 <cstdint> 中宣告的型別提供 C 樣式的輸入/輸出格式宏。

錯誤處理

<exception> − 異常處理實用程式

<stdexcept>  − 標準異常物件

<cassert> − 條件編譯的宏,將其引數與零進行比較

<cerrno> − 包含最後一個錯誤編號的宏

<system_error> (自 C++11 起) − std::error_code 是一個平臺相關的錯誤程式碼。每個 std::error_code 物件都儲存來自作業系統或某些低階介面的錯誤程式碼,以及指向型別為 std::error_category 的物件的指標,該指標對應於所述介面。

字串庫

<cctype> − 用於確定字元資料中包含的型別的函式

<cwctype> − 用於確定寬字元資料中包含的型別的函式

<cstring> − 各種窄字元字串處理函式

<cwchar> − 各種寬和多位元組字串處理函式

<string> − std::basic_string 類模板

<cuchar> (自 C++11 起) − C 樣式的 Unicode 字元轉換函式

<string_view> (自 C++17 起) − basic_string_view 類模板描述了一個物件,該物件可以引用一個字元型別的常量連續序列,序列的第一個元素位於位置零。

容器庫

<array> (自 C++11 起) − std::array 容器

<vector> − std::vector 容器

<deque> − std::deque 容器

<list> − std::list 容器

<forward_list> (自 C++11 起) − std::forward_list 容器

<set> − std::set 和 std::multiset 關聯容器

<map> − std::map 和 std::multimap 關聯容器

<unordered_set> (自 C++11 起) − std::unordered_set 和 std::unordered_multiset 無序關聯容器

<unordered_map> (自 C++11 起) − std::unordered_map 和 std::unordered_multimap 無序關聯容器

<stack> − std::stack 容器介面卡

<queue> − std::queue 和 std::priority_queue 容器介面卡

演算法庫

<algorithm> − 包含對容器進行操作的演算法

<execution> (C++17) − 演算法並行版本的預定義執行策略

迭代器庫

<iterator> − 容器的迭代器

數值庫

<cmath> − 常用數學函式

<complex> − 複數型別

<valarray> − 用於表示和操作值陣列的類

<random> (自 C++11 起) − 隨機數生成器和分佈

<numeric> − 容器中值的數值運算

<ratio> (自 C++11 起) − 編譯時有理數運算

<cfenv> (自 C++11 起) − 浮點環境訪問函式

輸入/輸出庫

<iosfwd> − 輸入/輸出庫中所有類的前向宣告

<ios> − std::ios_base 類、std::basic_ios 類模板和幾個型別定義

<istream> − std::basic_istream 類模板和幾個型別定義

<ostream> − std::basic_ostream、std::basic_iostream 類模板和幾個型別定義

<iostream> − 若干標準流物件

<fstream> − std::basic_fstream、std::basic_ifstream、std::basic_ofstream 類模板和幾個型別定義

<sstream> − std::basic_stringstream、std::basic_istringstream、std::basic_ostringstream 類模板和幾個型別定義

<syncstream> (自 C++20 起) − std::basic_osyncstream、std::basic_syncbuf 和型別定義

<strstream>(已棄用) − std::strstream、std::istrstream、std::ostrstream

<iomanip> − 用於控制輸入和輸出格式的輔助函式

<streambuf> − std::basic_streambuf 類模板

<cstdio> − C 樣式的輸入輸出函式

本地化庫

<locale> − 本地化實用程式

<clocale> − C 本地化實用程式

<codecvt> (自 C++11 起) (在 C++17 中已棄用) − Unicode 轉換功能

正則表示式庫

<regex> (自 C++11 起)  − 用於支援正則表示式處理的類、演算法和迭代器

原子操作庫

<atomic> (自 C++11 起) − 原子操作庫

執行緒支援庫

<thread> (自 C++11 起) − std::thread 類和支援函式

<mutex> (自 C++11 起) − 互斥原語

<shared_mutex> (自 C++14 起) − 共享互斥原語

<future> (自 C++11 起) − 用於非同步計算的原語

<condition_variable> (自 C++11 起) − 執行緒等待條件

檔案系統庫

<filesystem> (自 C++17 起) − std::path 類和支援函式

更新於: 2020-06-18

1K+ 瀏覽量

開啟你的 職業生涯

透過完成課程獲得認證

開始學習
廣告

© . All rights reserved.