std::basic_osyncstream<CharT,Traits,Allocator>:: get_wrapped
From cppreference.net
<
cpp
|
io
|
basic osyncstream
C++
Input/output library
| I/O manipulators | ||||
| Print functions (C++23) | ||||
| C-style I/O | ||||
| Buffers | ||||
|
(C++23)
|
||||
|
(
C++98/26*
)
|
||||
|
(C++20)
|
||||
| Streams | ||||
| Abstractions | ||||
| File I/O | ||||
| String I/O | ||||
| Array I/O | ||||
|
(C++23)
|
||||
|
(C++23)
|
||||
|
(C++23)
|
||||
|
(
C++98/26*
)
|
||||
|
(
C++98/26*
)
|
||||
|
(
C++98/26*
)
|
||||
| Synchronized Output | ||||
|
(C++20)
|
||||
| Types | ||||
| Error category interface | ||||
|
(C++11)
|
||||
|
(C++11)
|
std::basic_osyncstream
| Public member functions | ||||
|
(C++20)
|
||||
|
(C++20)
|
||||
|
basic_osyncstream::get_wrapped
(C++20)
|
||||
|
(C++20)
|
|
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'; } // 释放临时缓冲区内容 bout1 << "World!" << '\n'; } // 释放bout1的内容
输出:
Goodbye, Planet! Hello, World!
参见
销毁
basic_osyncstream
并发送其内部缓冲区
(公开成员函数) |
|
|
获取被包装的流缓冲区指针
(
std::basic_syncbuf<CharT,Traits,Allocator>
的公开成员函数)
|