[iostream.forward.overview]

# 31 Input/output library [[input.output]](./#input.output)

## 31.3 Forward declarations [[iostream.forward]](iostream.forward#overview)

### 31.3.2 Overview [iostream.forward.overview]

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L340)

The
class template specializationbasic_ios<charT, traits> serves as a virtual base class for the
class templatesbasic_istream,basic_ostream,
and
class templates
derived from them[.](#1.sentence-1)

basic_iostream is a class
template
derived from bothbasic_istream<charT, traits> andbasic_ostream<charT, traits>[.](#1.sentence-2)

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L359)

The
class template specializationbasic_streambuf<charT, traits> serves as a base class for class templatesbasic_stringbuf,basic_filebuf,
andbasic_syncbuf[.](#2.sentence-1)

[3](#3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L369)

The
class template specializationbasic_istream<charT, traits> serves as a base class for class templatesbasic_istringstream andbasic_ifstream[.](#3.sentence-1)

[4](#4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L378)

The
class template specializationbasic_ostream<charT, traits> serves as a base class for class templatesbasic_ostringstream,basic_ofstream,
andbasic_osyncstream[.](#4.sentence-1)

[5](#5)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L388)

The
class template specializationbasic_iostream<charT, traits> serves as a base class for class templatesbasic_stringstream andbasic_fstream[.](#5.sentence-1)

[6](#6)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L397)

[*Note [1](#note-1)*:

For each of the class templates above,
the program is ill-formed iftraits​::​char_type is not the same type ascharT ([[char.traits]](char.traits "27.2 Character traits"))[.](#6.sentence-1)

â *end note*]

[7](#7)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L406)

Other [*typedef-name*](dcl.typedef#nt:typedef-name "9.2.4 The typedef specifier [dcl.typedef]")*s* define instances of
class templates
specialized forchar orwchar_t types[.](#7.sentence-1)

[8](#8)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L415)

Specializations of the class templatefpos are
used for specifying file position information[.](#8.sentence-1)

[*Example [1](#example-1)*:

The typesstreampos andwstreampos are used for positioning streams specialized onchar andwchar_t respectively[.](#8.sentence-2)

â *end example*]

[9](#9)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L432)

[*Note [2](#note-2)*:

This synopsis suggests a circularity betweenstreampos andchar_traits<char>[.](#9.sentence-1)

An implementation can avoid this circularity by substituting equivalent
types[.](#9.sentence-2)

â *end note*]
