GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
std::basic_osyncstream::emit(3) C++ Standard Libary std::basic_osyncstream::emit(3)

std::basic_osyncstream::emit - std::basic_osyncstream::emit


void emit();


Emits all buffered output and executes any pending flushes, by calling emit() on the
underlying std::basic_syncbuf.


(none)

// Run this code


#include <syncstream>
#include <iostream>
int main()
{
{
std::osyncstream bout(std::cout);
bout << "Hello," << '\n'; // no flush
bout.emit(); // characters transferred; cout not flushed
bout << "World!" << std::endl; // flush noted; cout not flushed
bout.emit(); // characters transferred; cout flushed
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
}
}


Hello,
World!
Greetings.
Hello, World!


destructor destroys the basic_osyncstream and emits its internal buffer
(public member function)
atomically transmits the entire internal buffer to the wrapped
emit streambuf
(public member function of std::basic_syncbuf<CharT,Traits,Allocator>)

2022.07.31 http://cppreference.com

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.