cppannotations/yo/iostreams/headers.yo
Frank B. Brokken 9c29b8b8ff 8.1.0 Ready
git-svn-id: https://cppannotations.svn.sourceforge.net/svnroot/cppannotations/trunk@437 f6dd340e-d3f9-0310-b409-bdd246841980
2010-03-01 08:18:00 +00:00

37 lines
1.8 KiB
Text

Several iostream related i(header file)s are available. Depending on
the situation at hand, the following header files should be used:
itemization(
iti(iosfwd): sources should include this header file if only a declaration
of the stream classes is required. For example, if a function defines a
reference parameter to an tt(ostream) then the compiler doesn not need to know
exactly what an tt(ostream) is. When declaring such a function
the tt(ostream) class merely needs to be be declared. One cannot use
verb(
class std::ostream; // erroneous declaration
void someFunction(std::ostream &str);
)
but, instead, one should use:
verb(
#include <iosfwd> // correctly declares class ostream
void someFunction(std::ostream &str);
)
ithi(streambuf): sources should include this header file when using
tt(streambuf) or ti(filebuf) classes. See sections ref(STREAMBUF) and
ref(FILEBUF).
ithi(istream): sources should include this preprocessor directive when
using the class tt(istream) or when using classes that do both input and
output. See section ref(ISTREAM).
ithi(ostream): sources should include this header file when using the class
ti(ostream) class or when using classes that do both input and output. See
section ref(OSTREAM).
ithi(iostream): sources should include this header file when using the
global stream objects (like ti(cin) and ti(cout)).
ithi(fstream): sources should include this header file when using the file
stream classes. See sections ref(OFSTREAM), ref(IFSTREAM), and ref(FSTREAM).
ithi(sstream): sources should include this header file when using the
string stream classes. See sections ref(OSTRINGSTREAM) and ref(ISTRINGSTREAM).
ithi(iomanip): sources should include this header file when using
parameterized manipulators. See section ref(IOFORMAT).
)