std::basic_osyncstream<CharT,Traits,Allocator>::get_wrapped
From cppreference.com
< cpp | io | basic osyncstream
C++
Feature test macros (C++20)
Concepts library (C++20)
Metaprogramming library (C++11)
Ranges library (C++20)
Filesystem library (C++17)
Concurrency support library (C++11)
Execution control library (C++26)
Input/output library
Print functions (C++23)
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;
Returns a pointer to the wrapped std::basic_streambuf , obtained by calling get_wrapped() on the underlying std::basic_syncbuf.
[edit] Parameters
(none)
[edit] Example
Wrapped buffer can be safely wrapped again in a different synchronized output stream.
Run this code
#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
Output:
Goodbye, Planet! Hello, World!
[edit] See also
retrieves the wrapped streambuf pointer
(public member function of
(public member function of
std::basic_syncbuf<CharT,Traits,Allocator>
) [edit]