std::basic_osyncstream<CharT,Traits,Allocator>::emit (3) - Linux Manuals
std::basic_osyncstream<CharT,Traits,Allocator>::emit: std::basic_osyncstream<CharT,Traits,Allocator>::emit
Command to display std::basic_osyncstream<CharT,Traits,Allocator>::emit
manual in Linux: $ man 3 std::basic_osyncstream<CharT,Traits,Allocator>::emit
NAME
std::basic_osyncstream<CharT,Traits,Allocator>::emit - std::basic_osyncstream<CharT,Traits,Allocator>::emit
Synopsis
void emit();
Emits all buffered output and executes any pending flushes, by calling emit() on the underlying std::basic_syncbuf.
Parameters
(none)
Example
// Run this code
#include <syncstream>
#include <iostream>
int main()
{
{
std::osyncstream bout(std::cout);
std::bout << "Hello," << '\n'; // no flush
std::bout.emit(); // characters transferred; cout not flushed
std::bout << "World!" << std::endl; // flush noted; cout not flushed
std::bout.emit(); // characters transferred; cout flushed
std::bout << "Greetings." << '\n'; // no flush
} // destructor calls emit(): characters transferred; cout not flushed
// emit can be used for local exception-handling on the wrapped stream
std::osyncstream bout(std::cout);
bout << "Hello, " << "World!" << '\n';
try {
bout.emit();
} catch (...) {
// handle exceptions
}
}
Output:
Hello,
World!
Greetings.
Hello, World!
See also
destroys the basic_osyncstream and emits its internal buffer
destructor (public member function)
atomically transmits the entire internal buffer to the wrapped streambuf
emit (public member function of std::basic_syncbuf<CharT,Traits,Allocator>)
Pages related to std::basic_osyncstream<CharT,Traits,Allocator>::emit
- std::basic_osyncstream<CharT,Traits,Allocator>::basic_osyncstream (3) - std::basic_osyncstream<CharT,Traits,Allocator>::basic_osyncstream
- std::basic_osyncstream<CharT,Traits,Allocator>::get_wrapped (3) - std::basic_osyncstream<CharT,Traits,Allocator>::get_wrapped
- std::basic_osyncstream<CharT,Traits,Allocator>::operator= (3) - std::basic_osyncstream<CharT,Traits,Allocator>::operator=
- std::basic_osyncstream<CharT,Traits,Allocator>::rdbuf (3) - std::basic_osyncstream<CharT,Traits,Allocator>::rdbuf
- std::basic_osyncstream<CharT,Traits,Allocator>::~basic_osyncstream (3) - std::basic_osyncstream<CharT,Traits,Allocator>::~basic_osyncstream
- std::basic_osyncstream (3) - std::basic_osyncstream
- std::basic_ostream (3) - std::basic_ostream
- std::basic_ostream<CharT,Traits>::basic_ostream (3) - std::basic_ostream<CharT,Traits>::basic_ostream
- std::basic_ostream<CharT,Traits>::flush (3) - std::basic_ostream<CharT,Traits>::flush
- std::basic_ostream<CharT,Traits>::operator<< (3) - std::basic_ostream<CharT,Traits>::operator<<
- std::basic_ostream<CharT,Traits>::operator= (3) - std::basic_ostream<CharT,Traits>::operator=
- std::basic_ostream<CharT,Traits>::put (3) - std::basic_ostream<CharT,Traits>::put
- std::basic_ostream<CharT,Traits>::seekp (3) - std::basic_ostream<CharT,Traits>::seekp
- std::basic_ostream<CharT,Traits>::sentry (3) - std::basic_ostream<CharT,Traits>::sentry
- std::basic_ostream<CharT,Traits>::swap (3) - std::basic_ostream<CharT,Traits>::swap
- std::basic_ostream<CharT,Traits>::tellp (3) - std::basic_ostream<CharT,Traits>::tellp
- std::basic_ostream<CharT,Traits>::write (3) - std::basic_ostream<CharT,Traits>::write