13.28 <iosfwd>

The <iosfwd> header provides forward declarations of the various I/O-related classes and templates. The forward declarations are incomplete type declarations. (Read about complete and incomplete types in Chapter 6.) By using <iosfwd> you can sometimes avoid including the complete definitions of the I/O classes, and thereby save some compilation time.

It is always safe to include <iosfwd> and any of the other I/O headers, even if they both declare the same type.

Because <iosfwd> does not provide any complete type declarations, this section contains only Table 13-18, which lists each type name with a reference to the header (if any) that is required for the complete type.

Table 13-18. Forward type declarations in <iosfwd>

Type declaration

Header

template<typename T> class allocator

<memory>

template<typename charT, typename traits=char_traits<charT> > class basic_filebuf

<fstream>

template<typename charT, typename traits=char_traits<charT> > class basic_fstream

<fstream>

template<typename charT, typename traits=char_traits<charT> > class basic_ifstream

<fstream>

template<typename charT, typename traits=char_traits<charT> > class basic_ios

<ios>

template<typename charT, typename traits=char_traits<charT> > class basic_iostream

<istream>

template<typename charT, typename traits=char_traits<charT> > class basic_istream

<istream>

template<typename charT, typename traits=char_traits<charT>, typename Alloc = allocator<charT> > class basic_istringstream

<sstream>

template<typename charT, typename traits=char_traits<charT> > class basic_ofstream

<fstream>

template<typename charT, typename traits=char_traits<charT> > class basic_ostream

<ostream>

template<typename charT, typename traits=char_traits<charT>, typename Alloc = allocator<charT> > class basic_ostringstream

<sstream>

template<typename charT, typename traits=char_traits<charT> > class basic_streambuf

<streambuf>

template<typename charT, typename traits=char_traits<charT>, typename Alloc = allocator<charT> > class basic_stringbuf

<sstream>

template<typename charT, typename traits=char_traits<charT>, typename Alloc = allocator<charT> > class basic_stringstream

<sstream>

template<typename charT> class char_traits

<string>

template<> class char_traits<char>

<string>

template<> class char_traits<wchar_t>

<string>

typedef basic_filebuf<char> filebuf

<fstream>

template <typename state> class fpos

<ios>

typedef basic_fstream<char> fstream

<fstream>

typedef basic_ifstream<char> ifstream

<fstream>

typedef basic_ios<char> ios

<ios>

typedef basic_iostream<char> iostream

<istream>

typedef basic_istream<char> istream

<istream>

template<typename charT, typename traits=char_traits<charT> > class istreambuf_iterator

<iterator>

typedef basic_istringstream<char> istringstream

<sstream>

typedef basic_ofstream<char> ofstream

<fstream>

typedef basic_ostream<char> ostream

<ostream>

template<typename charT, typename traits=char_traits<charT> > class ostreambuf_iterator

<iterator>

typedef basic_ostringstream<char> ostringstream

<sstream>

typedef basic_streambuf<char> streambuf

<streambuf>

typedef fpos<char_traits<char>::state_type> streampos

N/A

typedef basic_stringbuf<char> stringbuf

<sstream>

typedef basic_stringstream<char> stringstream

<sstream>

typedef basic_filebuf<wchar_t> wfilebuf

<fstream>

typedef basic_fstream<wchar_t> wfstream

<fstream>

typedef basic_ifstream<wchar_t> wifstream

<fstream>

typedef basic_ios<wchar_t> wios

<ios>

typedef basic_iostream<wchar_t> wiostream

<istream>

typedef basic_istream<wchar_t> wistream

<istream>

typedef basic_istringstream<wchar_t> wistringstream

<sstream>

typedef basic_ofstream<wchar_t> wofstream

<fstream>

typedef basic_ostream<wchar_t> wostream

<ostream>

typedef basic_ostringstream<wchar_t> wostringstream

<sstream>

typedef basic_streambuf<wchar_t> wstreambuf

<streambuf>

typedef fpos<char_traits<wchar_t>::state_type> wstreampos

N/A

typedef basic_stringbuf<wchar_t> wstringbuf

<sstream>

typedef basic_stringstream<wchar_t> wstringstream

<sstream>