[filebuf.cons]

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

## 31.10 File-based streams [[file.streams]](file.streams#filebuf.cons)

### 31.10.3 Class template basic_filebuf [[filebuf]](filebuf#cons)

#### 31.10.3.2 Constructors [filebuf.cons]

[ð](#lib:basic_filebuf,constructor)

`basic_filebuf();
`

[1](#1)

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

*Effects*: Initializes the base class withbasic_streambuf<charT, traits>() ([[streambuf.cons]](streambuf.cons "31.6.3.2 Constructors"))[.](#1.sentence-1)

[2](#2)

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

*Postconditions*: is_open() == false[.](#2.sentence-1)

[ð](#lib:basic_filebuf,constructor_)

`basic_filebuf(basic_filebuf&& rhs);
`

[3](#3)

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

*Effects*: It is implementation-defined whether the sequence pointers in *this (eback(), gptr(), egptr(),pbase(), pptr(), epptr()) obtain
the values which rhs had[.](#3.sentence-1)

Whether they do or not, *this and rhs reference separate buffers (if any at all) after the
construction[.](#3.sentence-2)

Additionally *this references the file
which rhs did before the construction, andrhs references no file after the construction[.](#3.sentence-3)

The
openmode, locale and any other state of rhs is also
copied[.](#3.sentence-4)

[4](#4)

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

*Postconditions*: Let rhs_p refer to the state ofrhs just prior to this construction and let rhs_a refer to the state of rhs just after this construction[.](#4.sentence-1)

- [(4.1)](#4.1)

is_open() == rhs_p.is_open()

- [(4.2)](#4.2)

rhs_a.is_open() == false

- [(4.3)](#4.3)

gptr() - eback() == rhs_p.gptr() - rhs_p.eback()

- [(4.4)](#4.4)

egptr() - eback() == rhs_p.egptr() - rhs_p.eback()

- [(4.5)](#4.5)

pptr() - pbase() == rhs_p.pptr() - rhs_p.pbase()

- [(4.6)](#4.6)

epptr() - pbase() == rhs_p.epptr() - rhs_p.pbase()

- [(4.7)](#4.7)

if (eback()) eback() != rhs_a.eback()

- [(4.8)](#4.8)

if (gptr()) gptr() != rhs_a.gptr()

- [(4.9)](#4.9)

if (egptr()) egptr() != rhs_a.egptr()

- [(4.10)](#4.10)

if (pbase()) pbase() != rhs_a.pbase()

- [(4.11)](#4.11)

if (pptr()) pptr() != rhs_a.pptr()

- [(4.12)](#4.12)

if (epptr()) epptr() != rhs_a.epptr()

[ð](#lib:basic_filebuf,destructor)

`virtual ~basic_filebuf();
`

[5](#5)

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

*Effects*: Callsclose()[.](#5.sentence-1)

If an exception occurs during the destruction of the object, including the call to close(), the exception is caught but not rethrown (see [[res.on.exception.handling]](res.on.exception.handling "16.4.6.14 Restrictions on exception handling"))[.](#5.sentence-2)
