std::basic_...tream::emit(3)
β¨ NAME β¨
std::basic_osyncstream::emit β okay so the NAME is literally std::basic_osyncstream::emit, and the page is also std::basic_osyncstream::emit. We love a name section that ate and left no crumbs π
This is the C++ Standard Libary manual, page std::basic_...tream::emit(3) β yes bestie, that spelling is staying, no cap.
π Synopsis
void emit();
It emits all buffered output and executes any pending flushes, by calling emit() on the underlying std::basic_syncbuf. That's the whole vibe: flush-adjacent behavior, but routed through the syncbuf. Periodt π
ποΈ Parameters
Parameters: (none) β literally no parameters, bestie. Zero. Zilch. The function signature said βIβm enoughβ and honestly? She is π«Ά
π» Example
// Run this code
#include <iostream>
#include <syncstream>
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
}
}
π¨οΈ Output
Hello,
World!
Greetings.
Hello, World!
π See also
- destructor β destroys the
basic_osyncstreamand emits its internal buffer (public member function) emitβ atomically transmits the entire internal buffer to the wrappedstreambuf(public member function ofstd::basic_syncbuf<CharT,Traits,Allocator>)
π source/version/date sign-off: http://cppreference.com Β· 2024.06.10 Β· std::basic_...tream::emit(3) β byeee, slay responsibly π«Άβ¨
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms