# std::basic_osyncstream<CharT,Traits,Allocator>::get_wrapped

From cppreference.com
< cpp‎ | io‎ | basic osyncstream

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.

### Parameters

(none)

### Example

wrapped buffer can be safely wrapped again in a different synchronized output stream

Run this code

    #include <syncstream>
    #include <iostream>
    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!

### See also

(destructor) | destroys the `basic_osyncstream` and emits its internal buffer (public member function)
get_wrapped | retrieves the wrapped streambuf pointer (public member function of `std::basic_syncbuf<CharT,Traits,Allocator>`)

Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/io/basic_osyncstream/get_wrapped&oldid=144224"