86 lines
2.6 KiB
Markdown
86 lines
2.6 KiB
Markdown
[syncstream.syncbuf.cons]
|
|
|
|
# 31 Input/output library [[input.output]](./#input.output)
|
|
|
|
## 31.11 Synchronized output streams [[syncstream]](syncstream#syncbuf.cons)
|
|
|
|
### 31.11.2 Class template basic_syncbuf [[syncstream.syncbuf]](syncstream.syncbuf#cons)
|
|
|
|
#### 31.11.2.2 Construction and destruction [syncstream.syncbuf.cons]
|
|
|
|
[ð](#lib:basic_syncbuf,constructor)
|
|
|
|
`basic_syncbuf(streambuf_type* obuf, const Allocator& allocator);
|
|
`
|
|
|
|
[1](#1)
|
|
|
|
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L12669)
|
|
|
|
*Effects*: Sets *wrapped* to obuf[.](#1.sentence-1)
|
|
|
|
[2](#2)
|
|
|
|
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L12673)
|
|
|
|
*Postconditions*: get_wrapped() == obuf andget_allocator() == allocator are true[.](#2.sentence-1)
|
|
|
|
[3](#3)
|
|
|
|
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L12678)
|
|
|
|
*Throws*: Nothing unless an exception is thrown
|
|
by the construction of a mutex or
|
|
by memory allocation[.](#3.sentence-1)
|
|
|
|
[4](#4)
|
|
|
|
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L12684)
|
|
|
|
*Remarks*: A copy of allocator is used
|
|
to allocate memory for internal buffers
|
|
holding the associated output[.](#4.sentence-1)
|
|
|
|
[ð](#lib:basic_syncbuf,constructor_)
|
|
|
|
`basic_syncbuf(basic_syncbuf&& other);
|
|
`
|
|
|
|
[5](#5)
|
|
|
|
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L12697)
|
|
|
|
*Postconditions*: The value returned by this->get_wrapped() is the value returned by other.get_wrapped() prior to calling this constructor[.](#5.sentence-1)
|
|
|
|
Output stored in other prior to calling this constructor
|
|
will be stored in *this afterwards[.](#5.sentence-2)
|
|
|
|
other.pbase() == other.pptr() andother.get_wrapped() == nullptr are true[.](#5.sentence-3)
|
|
|
|
[6](#6)
|
|
|
|
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L12710)
|
|
|
|
*Remarks*: This constructor disassociates other from its wrapped stream buffer,
|
|
ensuring destruction of other produces no output[.](#6.sentence-1)
|
|
|
|
[ð](#lib:basic_syncbuf,destructor)
|
|
|
|
`~basic_syncbuf();
|
|
`
|
|
|
|
[7](#7)
|
|
|
|
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L12723)
|
|
|
|
*Effects*: Calls emit()[.](#7.sentence-1)
|
|
|
|
[8](#8)
|
|
|
|
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L12727)
|
|
|
|
*Throws*: Nothing[.](#8.sentence-1)
|
|
|
|
If an exception is thrown from emit(),
|
|
the destructor catches and ignores that exception[.](#8.sentence-2)
|