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

69 lines
2.2 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[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.2Construction 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<Allocator>::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<Allocator>::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)