Files
2025-10-25 03:02:53 +03:00

2.9 KiB

[filebuf.cons]

31 Input/output library [input.output]

31.10 File-based streams [file.streams]

31.10.3 Class template basic_filebuf [filebuf]

31.10.3.2 Constructors [filebuf.cons]

🔗

basic_filebuf();

1

#

Effects: Initializes the base class withbasic_streambuf<charT, traits>() ([streambuf.cons]).

2

#

Postconditions: is_open() == false.

🔗

basic_filebuf(basic_filebuf&& rhs);

3

#

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

Whether they do or not, *this and rhs reference separate buffers (if any at all) after the construction.

Additionally *this references the file which rhs did before the construction, andrhs references no file after the construction.

The openmode, locale and any other state of rhs is also copied.

4

#

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.

is_open() == rhs_p.is_open()

rhs_a.is_open() == false

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

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

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

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

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

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

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

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

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

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

🔗

virtual ~basic_filebuf();

5

#

Effects: Callsclose().

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]).