The predefined Standard Iostream objects std::cin, std::cout, std::cerr, and std::clog , and their wide character counterparts, std::wcin, std::wcout, std::wcerr, and std::wclog, are examples of synchronized streams:
std::cin is tied to std::cout; that is, before each input operation on std::cin, the output stream std::cout is forced to flush its buffer.
std::cerr is synchronized using the std::ios_base::unitbuf format flag; that is, after each output to std::cerr, its buffer is flushed.
std::clog is connected to the same output channel and thus behaves like std::cerr, except that it is not synchronized with any of the other standard streams; that is, it does not have the std::ios_base::unitbuf flag set.