std::basic_streambuf<CharT,Traits>::basic_streambuf

来自cppreference.com
< cpp‎ | io‎ | basic streambuf
 
 
 
 
protected:
basic_streambuf();
(1)
protected:
basic_streambuf(const basic_streambuf& rhs);
(2) (C++11 起)
1) 构造 basic_streambuf 对象,初始化六个成员(eback()gptr()egptr()pbase()pptr()epptr())为空指针值,本地环境成员为 std::locale(),其为构造时的全局 C++ 本地环境的副本。
2)rhs 复制构造,初始化六个指针和本地环境对象为 rhs 所保有值的副本。注意这是浅复制:新构造的 basic_streambuf 的指针指向的字符数组与 rhs 的相同。

两个构造函数均为受保护,而且仅被具体的 streambuf 类,如 std::basic_filebufstd::basic_stringbufstd::strstreambuf 调用。

参数

rhs - 要复制的 streambuf 对象

注解

C++11 前,basic_streambuf 或其任何派生类是否为可复制构造 (CopyConstructible) 是未指定的(LWG 问题 421),而不同的 C++ 库实现提供不同的选项。

示例

参阅

构造 basic_filebuf 对象
(std::basic_filebuf<CharT,Traits> 的公开成员函数)
构造一个 basic_stringbuf 对象
(std::basic_stringbuf<CharT,Traits,Allocator> 的公开成员函数)
构造 strstreambuf 对象
(std::strstreambuf 的公开成员函数)