basic_osyncstream::emit should be an unformatted output function
Tim Song

Created on 2021-06-19.00:00:00 last changed 7 days ago


Date: 2021-10-14.09:56:08

Proposed resolution:

This wording is relative to N4885.

  1. Modify [syncstream.osyncstream.members] as indicated:

    void emit();

    -1- Effects: Behaves as an unformatted output function ([ostream.unformatted]). After constructing a sentry object, cCalls sb.emit(). If that call returns false, calls setstate(ios_base::badbit).

Date: 2021-10-14.00:00:00

[ 2021-10-14 Approved at October 2021 virtual plenary. Status changed: Voting → WP. ]

Date: 2021-06-15.00:00:00

[ 2021-06-23; Reflector poll ]

Set status to Tentatively Ready after five votes in favour during reflector poll.

Date: 2021-06-19.00:00:00

basic_osyncstream::emit seems rather similar to basic_ostream::flush — both are "flushing" operations that forward to member functions of the streambuf and set badbit if those functions fail. But the former isn't currently specified as an unformatted output function, so it a) doesn't construct or check a sentry and b) doesn't set badbit if emit exits via an exception. At least the latter appears to be clearly desirable — a streambuf operation that throws ordinarily results in badbit being set.

The reference implementation in P0053R7 constructs a sentry and only calls emit on the streambuf if the sentry converts to true, so this seems to be an accidental omission in the wording.

Date User Action Args
2021-10-14 09:56:08adminsetmessages: + msg12132
2021-10-14 09:56:08adminsetstatus: voting -> wp
2021-09-29 12:57:28adminsetstatus: ready -> voting
2021-06-23 14:16:45adminsetmessages: + msg11965
2021-06-23 14:16:45adminsetstatus: new -> ready
2021-06-19 14:53:47adminsetmessages: + msg11940
2021-06-19 00:00:00admincreate