[syncstream.syncbuf.assign] # 31 Input/output library [[input.output]](./#input.output) ## 31.11 Synchronized output streams [[syncstream]](syncstream#syncbuf.assign) ### 31.11.2 Class template basic_syncbuf [[syncstream.syncbuf]](syncstream.syncbuf#assign) #### 31.11.2.3 Assignment and swap [syncstream.syncbuf.assign] [🔗](#lib:operator=,basic_syncbuf) `basic_syncbuf& operator=(basic_syncbuf&& rhs); ` [1](#1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L12742) *Effects*: Calls emit() 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 ([[syncstream.syncbuf.cons]](syncstream.syncbuf.cons "31.11.2.2 Construction and destruction"))[.](#1.sentence-2) [2](#2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L12750) *Postconditions*: - [(2.1)](#2.1) rhs.get_wrapped() == nullptr is true. - [(2.2)](#2.2) this->get_allocator() == rhs.get_allocator() is true whenallocator_traits::propagate_on_container_move_assignment::value is true; otherwise, the allocator is unchanged. [3](#3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L12763) *Returns*: *this[.](#3.sentence-1) [4](#4) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L12767) *Remarks*: This assignment operator disassociates rhs from its wrapped stream buffer, ensuring destruction of rhs produces no output[.](#4.sentence-1) [🔗](#lib:swap,basic_syncbuf) `void swap(basic_syncbuf& other); ` [5](#5) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L12780) *Preconditions*: Eitherallocator_traits​::​propagate_on_container_swap​::​value is true orthis->get_allocator() == other.get_allocator() is true[.](#5.sentence-1) [6](#6) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L12789) *Effects*: Exchanges the state of *this and other[.](#6.sentence-1)