标准库标头 <iostream>

来自cppreference.com
< cpp‎ | header


 
 
标准库头
 

此头文件是输入/输出库的一部分。

包含 <iostream> 表现为如同它定义一个 std::ios_base::Init 类型的静态存储期对象:如果它是首个要被构造的 std::ios_base::Init 对象,那么它的构造函数会初始化各个标准流对象,而如果它是最后被销毁的 std::ios_base::Init 对象,那么它的析构函数将会冲洗这些对象(除了 cinwcin)。

目录

包含

(C++11)
std::ios_base 类、 std::basic_ios 类模板与 typedef[编辑]
std::basic_streambuf 类模板[编辑]
(C++11)
std::basic_istream 类模板与 typedef[编辑]
(C++11)
std::basic_ostreamstd::basic_iostream 类模板与 typedef[编辑]

对象

从标准 C 输入流 stdin 读取
(全局对象)[编辑]
写入到标准 C 输出流 stdout
(全局对象)[编辑]
写入到标准 C 错误流 stderr,无缓冲
(全局对象)[编辑]
写入到标准 C 错误流 stderr
(全局对象)[编辑]

[编辑]概要

#include <ios>#include <streambuf>#include <istream>#include <ostream>   namespace std {extern istream cin;extern ostream cout;extern ostream cerr;extern ostream clog;   extern wistream wcin;extern wostream wcout;extern wostream wcerr;extern wostream wclog;}

[编辑]缺陷报告

下列更改行为的缺陷报告追溯地应用于以前出版的 C++ 标准。

缺陷报告 应用于 出版时的行为 正确行为
LWG 155 C++98 定义的静态对象的类型是 std::basic_ios::Init
(严格来说没有错,但是有误导性)
改成 std::ios_base::Init
LWG 1123 C++98 包含 <iostream> 不保证会构造 std::ios_base::Init 对象 保证会构造
close