Files
cppdraft_translate/cppdraft/syncstream/syncbuf/members.md
2025-10-25 03:02:53 +03:00

3.0 KiB
Raw Blame History

[syncstream.syncbuf.members]

31 Input/output library [input.output]

31.11 Synchronized output streams [syncstream]

31.11.2 Class template basic_syncbuf [syncstream.syncbuf]

31.11.2.4 Member functions [syncstream.syncbuf.members]

🔗

bool emit();

1

#

Effects: Atomically transfers the associated output of *this to the stream buffer *wrapped, so that it appears in the output stream as a contiguous sequence of characters.

wrapped->pubsync() is called if and only if a call was made to sync() since the most recent call to emit(), if any.

2

#

Synchronization: All emit() calls transferring characters to the same stream buffer object appear to execute in a total order consistent with the “happens before” relation ([intro.races]), where each emit() call synchronizes with subsequent emit() calls in that total order.

3

#

Postconditions: On success, the associated output is empty.

4

#

Returns: true if all of the following conditions hold; otherwise false:

  • (4.1)

    wrapped == nullptr is false.

  • (4.2)

    All of the characters in the associated output were successfully transferred.

  • (4.3)

    The call to wrapped->pubsync() (if any) succeeded.

5

#

Remarks: May call member functions of wrapped while holding a lock uniquely associated with wrapped.

🔗

streambuf_type* get_wrapped() const noexcept;

6

#

Returns: wrapped.

🔗

allocator_type get_allocator() const noexcept;

7

#

Returns: A copy of the allocator that was set in the constructor or assignment operator.

🔗

void set_emit_on_sync(bool b) noexcept;

8

#

Effects: emit-on-sync = b.