std::ios_base::Init (3) - Linux Man Pages

std::ios_base::Init: std::ios_base::Init

NAME

std::ios_base::Init - std::ios_base::Init

Synopsis


class Init;


This class is used to ensure that the default C++ streams (std::cin, std::cout, etc.) are properly initialized and destructed. The class tracks how many instances of it are created and initializes the C++ streams when the first instance is constructed as well as flushes the output streams when the last instance is destructed.
The header <iostream> behaves as if it defines (directly or indirectly) an instance of std::ios_base::Init with static storage duration: this makes it safe to access the standard I/O streams in the constructors and destructors of static objects with ordered_initialization (as long as #include <iostream> is included in the translation unit before these objects were defined)

Member functions


              if *this is the first instance created, initializes the default C++ streams
constructor (public member function)
              if *this is the last instance destroyed, flushes the default C++ streams
destructor (public member function)

See also


      reads from the standard C input stream stdin
cin (global object)
wcin
      writes to the standard C output stream stdout
cout (global object)
wcout
      writes to the standard C error stream stderr, unbuffered
cerr (global object)
wcerr
      writes to the standard C error stream stderr
clog (global object)
wclog