std::basic_osyncstream<CharT,Traits,Allocator>::get_wrapped
来自 cppreference.cn
< cpp | io | basic osyncstream
streambuf_type* get_wrapped() const noexcept; |
||
返回指向被包装的 std::basic_streambuf 的指针,该指针通过在底层 std::basic_syncbuf 上调用 get_wrapped() 获得。
[编辑] 参数
(无)
[编辑] 示例
被包装的缓冲区可以安全地在不同的同步输出流中再次包装。
运行此代码
#include <iostream> #include <syncstream> int main() { std::osyncstream bout1(std::cout); bout1 << "Hello, "; { std::osyncstream(bout1.get_wrapped()) << "Goodbye, " << "Planet!" << '\n'; } // emits the contents of the temporary buffer bout1 << "World!" << '\n'; } // emits the contents of bout1
输出
Goodbye, Planet! Hello, World!
[编辑] 参见
销毁 basic_osyncstream 并发出其内部缓冲区(公共成员函数) | |
检索被包装的 streambuf 指针 (std::basic_syncbuf<CharT,Traits,Allocator> 的公共成员函数) |