[filebuf.assign] # 31 Input/output library [[input.output]](./#input.output) ## 31.10 File-based streams [[file.streams]](file.streams#filebuf.assign) ### 31.10.3 Class template basic_filebuf [[filebuf]](filebuf#assign) #### 31.10.3.3 Assignment and swap [filebuf.assign] [🔗](#lib:operator=,basic_filebuf) `basic_filebuf& operator=(basic_filebuf&& rhs); ` [1](#1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L11166) *Effects*: Calls close() then move assigns from rhs[.](#1.sentence-1) After the move assignment *this has the observable state it would have had if it had been move constructed from rhs (see [[filebuf.cons]](filebuf.cons "31.10.3.2 Constructors"))[.](#1.sentence-2) [2](#2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L11172) *Returns*: *this[.](#2.sentence-1) [🔗](#lib:swap,basic_filebuf) `void swap(basic_filebuf& rhs); ` [3](#3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L11183) *Effects*: Exchanges the state of *this and rhs[.](#3.sentence-1) [🔗](#lib:swap,basic_filebuf_) `template void swap(basic_filebuf& x, basic_filebuf& y); ` [4](#4) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L11196) *Effects*: Equivalent to x.swap(y)[.](#4.sentence-1)