void emit();
{
osyncstream bout(cout);
bout << "Hello," << '\n'; // no flush
bout.emit(); // characters transferred; cout not flushed
bout << "World!" << endl; // flush noted; cout not flushed
bout.emit(); // characters transferred; cout flushed
bout << "Greetings." << '\n'; // no flush
} // characters transferred; cout not flushed
streambuf_type* get_wrapped() const noexcept;
{
osyncstream bout1(cout);
bout1 << "Hello, ";
{
osyncstream(bout1.get_wrapped()) << "Goodbye, " << "Planet!" << '\n';
}
bout1 << "World!" << '\n';
}
produces the uninterleaved output