For faster navigation, this Iframe is preloading the Wikiwand page for C++标准函式库.

C++标准函式库

C++中的标准程序库Standard Library)是函数的集合,其使用核心语言写成。标准程序库提供若干泛型容器、函数物件、泛型字符串和流(包含交互和文件I/O),支持部分语言特性和常用的函数,如开平方根。C++标准程序库也吸收了ISO C90 C标准程序库。标准程序库的特性宣告于std命名空间之中。

C++标准程序库大量参考了并基于标准模板程序库(STL)所建立的习惯用法,包含容器、算法、迭代器、函数物件等。此一部分占去标准库相当大的比重,因而有些人错误地使用“STL”指称整个C++标准程序库。但这并非为正确的概念,C++标准程序库和STL共有了许多特性,但都不是彼此的超集。

使用C++标准程序库时,不必加上“.h”。

标准头文件

以下文件包含标准库的声明。

容器

  • <bitset>
  • <deque>
  • <list>
  • <map>
  • <queue>
  • <set>
  • <stack>
  • <vector>

一般

  • <algorithm>
  • <functional>
  • <iterator>
  • <locale>
  • <memory>
  • <stdexcept>
  • <utility>

字符串

输入/输出流

  • <fstream>
  • <ios>
  • <iostream>
  • <iosfwd>
  • <iomanip>
  • <istream>
  • <ostream>
  • <sstream>
  • <streambuf>

数值

  • <complex>
  • <numeric>
  • <valarray>

语言支持

  • <exception>
  • <limits>
  • <new>
  • <typeinfo>

C标准库

来自C标准库的所有头文件,以另一个名称包含在C++标准中。将原名称移去“.h”并在开头处加上“c”作为新的名称。例如“time.h”改成“ctime”。C++标准库的头文件与C标准库的头文件的唯一区别是,函数位于std::命名空间(虽然很少编译器严格遵守,通常的做法是同时放在全局与 std 内,例如 printf 和 std::printf 两者均有)。

参见

参考

外部链接

{{bottomLinkPreText}} {{bottomLinkText}}
C++标准函式库
Listen to this article

This browser is not supported by Wikiwand :(
Wikiwand requires a browser with modern capabilities in order to provide you with the best reading experience.
Please download and use one of the following browsers:

This article was just edited, click to reload
This article has been deleted on Wikipedia (Why?)

Back to homepage

Please click Add in the dialog above
Please click Allow in the top-left corner,
then click Install Now in the dialog
Please click Open in the download dialog,
then click Install
Please click the "Downloads" icon in the Safari toolbar, open the first download in the list,
then click Install
{{::$root.activation.text}}

Install Wikiwand

Install on Chrome Install on Firefox
Don't forget to rate us

Tell your friends about Wikiwand!

Gmail Facebook Twitter Link

Enjoying Wikiwand?

Tell your friends and spread the love:
Share on Gmail Share on Facebook Share on Twitter Share on Buffer

Our magic isn't perfect

You can help our automatic cover photo selection by reporting an unsuitable photo.

This photo is visually disturbing This photo is not a good choice

Thank you for helping!


Your input will affect cover photo selection, along with input from other users.

X

Get ready for Wikiwand 2.0 🎉! the new version arrives on September 1st! Don't want to wait?