29 Input/output library [input.output]

29.5 Iostreams base classes [iostreams.base]

29.5.3 Class ios_­base [ios.base]

29.5.3.1 Types [ios.types]

29.5.3.1.6 Class ios_­base​::​Init [ios.init]

namespace std {
  class ios_base::Init {
  public:
    Init();
    Init(const Init&) = default;
    ~Init();
    Init& operator=(const Init&) = default;
  private:
    static int init_cnt;        // exposition only
  };
}
The class Init describes an object whose construction ensures the construction of the eight objects declared in <iostream> ([iostream.objects]) that associate file stream buffers with the standard C streams provided for by the functions declared in <cstdio> ([cstdio.syn]).
For the sake of exposition, the maintained data is presented here as:
  • static int init_­cnt, counts the number of constructor and destructor calls for class Init, initialized to zero.
Init();
Effects: Constructs and initializes the objects cin, cout, cerr, clog, wcin, wcout, wcerr, and wclog if they have not already been constructed and initialized.
~Init();
Effects: If there are no other instances of the class still in existence, calls cout.flush(), cerr.flush(), clog.flush(), wcout.flush(), wcerr.flush(), wclog.flush().