[iostreamclass]

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

## 31.7 Formatting and manipulators [[iostream.format]](iostream.format#iostreamclass)

### 31.7.5 Input streams [[input.streams]](input.streams#iostreamclass)

#### 31.7.5.7 Class template basic_iostream [iostreamclass]

#### [31.7.5.7.1](#general) General [[iostreamclass.general]](iostreamclass.general)

[ð](#lib:basic_iostream)

namespace std {template<class charT, class traits = char_traits<charT>>class basic_iostream : public basic_istream<charT, traits>, public basic_ostream<charT, traits> {public:using char_type = charT; using int_type = typename traits::int_type; using pos_type = typename traits::pos_type; using off_type = typename traits::off_type; using traits_type = traits; // [[iostream.cons]](#iostream.cons "31.7.5.7.2 Constructors"), constructorexplicit basic_iostream(basic_streambuf<charT, traits>* sb); // [[iostream.dest]](#iostream.dest "31.7.5.7.3 Destructor"), destructorvirtual ~basic_iostream(); protected:// [[iostream.cons]](#iostream.cons "31.7.5.7.2 Constructors"), constructor basic_iostream(const basic_iostream&) = delete;
 basic_iostream(basic_iostream&& rhs); // [[iostream.assign]](#iostream.assign "31.7.5.7.4 Assignment and swap"), assignment and swap basic_iostream& operator=(const basic_iostream&) = delete;
 basic_iostream& operator=(basic_iostream&& rhs); void swap(basic_iostream& rhs); };}

[1](#general-1)

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

The class templatebasic_iostream inherits a number of functions that allow reading input and writing output to
sequences controlled by a stream buffer[.](#general-1.sentence-1)

#### [31.7.5.7.2](#iostream.cons) Constructors [[iostream.cons]](iostream.cons)

[ð](#lib:basic_iostream,constructor)

`explicit basic_iostream(basic_streambuf<charT, traits>* sb);
`

[1](#iostream.cons-1)

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

*Effects*: Initializes the base class subobjects withbasic_istream<charT, traits>(sb) ([[istream]](istream "31.7.5.2 Class template basic_­istream"))
and[basic_ostream<charT, traits>(sb)](ostream "31.7.6.2 Class template basic_­ostream [ostream]")[.](#iostream.cons-1.sentence-1)

[2](#iostream.cons-2)

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

*Postconditions*: rdbuf() == sb andgcount() == 0[.](#iostream.cons-2.sentence-1)

[ð](#lib:basic_iostream,constructor_)

`basic_iostream(basic_iostream&& rhs);
`

[3](#iostream.cons-3)

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

*Effects*: Move constructs from the rvalue rhs by
constructing the basic_istream base class withstd​::​move(rhs)[.](#iostream.cons-3.sentence-1)

#### [31.7.5.7.3](#iostream.dest) Destructor [[iostream.dest]](iostream.dest)

[ð](#lib:basic_iostream,destructor)

`virtual ~basic_iostream();
`

[1](#iostream.dest-1)

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

*Remarks*: Does not perform any operations onrdbuf()[.](#iostream.dest-1.sentence-1)

#### [31.7.5.7.4](#iostream.assign) Assignment and swap [[iostream.assign]](iostream.assign)

[ð](#lib:operator=,basic_iostream)

`basic_iostream& operator=(basic_iostream&& rhs);
`

[1](#iostream.assign-1)

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

*Effects*: Equivalent to swap(rhs)[.](#iostream.assign-1.sentence-1)

[ð](#lib:swap,basic_iostream)

`void swap(basic_iostream& rhs);
`

[2](#iostream.assign-2)

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

*Effects*: Calls basic_istream<charT, traits>​::​swap(rhs)[.](#iostream.assign-2.sentence-1)
