std::cout, std::wcout
Min standard notice:
Header: <iostream>
The global objects std::cout and std::wcout control output to a stream buffer of implementation-defined type (derived from std::streambuf), associated with the standard C output stream stdout.
# Declarations
extern std::ostream cout;
extern std::wostream wcout;
# Notes
The ‘c’ in the name refers to “character” (stroustrup.com FAQ); cout means “character output” and wcout means “wide character output”.
Because dynamic initialization of templated variables are unordered, it is not guaranteed that std::cout has been initialized to a usable state before the initialization of such variables begins, unless an object of type std::ios_base::Init has been constructed.
# Example
#include <iostream>
struct Foo
{
int n;
Foo()
{
std::cout << "static constructor\n";
}
~Foo()
{
std::cout << "static destructor\n";
}
};
Foo f; // static object
int main()
{
std::cout << "main function\n";
}