27 Input/output library [input.output]

27.10 Synchronized output streams [syncstream]

27.10.2 Class template basic_­syncbuf [syncstream.syncbuf] Construction and destruction [syncstream.syncbuf.cons]

basic_syncbuf(streambuf_type* obuf, const Allocator& allocator);
Effects: Constructs the basic_­syncbuf object and sets wrapped to obuf.
Remarks: A copy of allocator is used to allocate memory for internal buffers holding the associated output.
Throws: Nothing unless an exception is thrown by the construction of a mutex or by memory allocation.
Ensures: get_­wrapped() == obuf and get_­allocator() == allocator are true.
basic_syncbuf(basic_syncbuf&& other);
Effects: Move constructs from other (Table 25).
Ensures: The value returned by this->get_­wrapped() is the value returned by other.get_­wrapped() prior to calling this constructor.
Output stored in other prior to calling this constructor will be stored in *this afterwards.
other.rdbuf()->pbase() == other.rdbuf()->pptr() and other.get_­wrapped() == nullptr are true.
Remarks: This constructor disassociates other from its wrapped stream buffer, ensuring destruction of other produces no output.
Effects: Calls emit().
Throws: Nothing.
If an exception is thrown from emit(), the destructor catches and ignores that exception.