You know how when you make your own files, you #include "foobar.h"? Well, "ostream" is the literal name of the file in this case. It just doesn't have an extension.
The line of code you are referring to is within the class declaration for basic_ostream, so basic_ostream() is the no-arg constructor. And yes, you as a user cannot do
ostream os;
because the default constructor is protected.
The details are a bit hairy, but you're basically correct:
basic_ostream<typename _CharT, typename _Traits> is a class template that inherits from
basic_ios<_CharT, _Traits>, with _Traits defaulting to char_traits<_CharT>.
ostream is an instantiation of this class template, defined as
typedef basic_ostream<char> ostream;
This is most likely in your
iosfwd file.
I don't know what the init function is specifically, that's just some implementation-defined detail.
_______________________________
This is calling
explicit ostream (streambuf* sb);
http://www.cplusplus.com/reference/ostream/ostream/ostream/
Note:
Objects of class ostream are seldom constructed directly. Generally some derived class is used (like the standard ofstream and ostringstream). |