std::basic_ios::init
来自cppreference.com
该页由英文版wiki使用Google Translate机器翻译而来。
该翻译可能存在错误或用词不当。鼠标停留在文本上可以看到原版本。你可以帮助我们修正错误或改进翻译。参见说明请点击这里. |
protected: void init( std::basic_streambuf<CharT,Traits>* sb ); |
||
设置相关的数据流缓冲
sb
并初始化内部状态.原文:
Sets the associated stream buffer to
sb
and initializes the internal state.后置条件如下:
Element | Value |
---|---|
rdbuf() |
sb
|
tie() |
NULL |
rdstate() |
goodbit if sb is not NULL, otherwise badbit
|
exceptions() |
goodbit
|
flags() | skipws | dec |
width() | 0 |
precision() | 6 |
fill() |
widen(' ') |
getloc() | a copy of the value returned by std::locale() |
这个成员函数是被保护的,它被称为派生的流类的构造函数被称为std::basic_istreamstd::basic_ostream后,相关的数据流缓冲。这个函数被调用之前,的默认构造std::basic_ios的每一个成员函数,(以外的析构函数)调用未定义的行为。需要注意的是
basic_ios
是一个虚基类,因此它的构造函数不调用的构造函数直接派生类,这就是为什么两个阶段的初始化是必要的.原文:
This member function is protected: it is called by the constructors of the derived stream classes std::basic_istream and std::basic_ostream once the associated stream buffer is known. Until this function is called, every member function (other than the destructor) of the default-constructed std::basic_ios invokes undefined behavior. Note that
basic_ios
is a virtual base class, and therefore its constructor is not called by the constructors of those directly derived classes, which is why two-stage initialization is necessary.[编辑] 参数
sb | - | 关联到流缓存器
|
[编辑] 另请参阅
构造对象 (公共成员函数) |