C++
输入/输出 | Input/output

std::ios_base::Init

科技促进发展:监督办[医]基础::INIT

class Init;

此类用于确保默认的C++流%28std::cin,,,std::cout等。%29被正确初始化和销毁。该类跟踪创建了多少个实例,并在构造第一个实例时初始化C++流,并在最后一个实例被销毁时刷新输出流。

标头<iostream>的行为,就好像它直接或间接地定义了%28,%29是std::ios_base::Init具有静态存储持续时间:这样可以安全地访问静态对象的构造函数和析构函数中的标准I/O流。有序初始化%28#include <iostream>在定义这些对象之前,在翻译单元中包含。

成员函数

(constructor)if *this is the first instance created, initializes the default C++ streams (public member function)
(destructor)if *this is the last instance destroyed, flushes the default C++ streams (public member function)

另见

cinwcinreads from the standard C input stream stdin (global object)
coutwcoutwrites to the standard C output stream stdout(global object)
cerrwcerrwrites to the standard C error stream stderr, unbuffered(global object)
clogwclogwrites to the standard C error stream stderr(global object)

© cppreference.com

在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。

http://en.cppreference.com/w/cpp/io/IOS[医]基础/INIT