Created on 2019-02-14.00:00:00 last changed 50 months ago
Proposed resolution:
This wording is relative to N4849.
Modify [ostream.manip] as indicated:
template<class charT, class traits> basic_ostream<charT, traits>& flush_emit(basic_ostream<charT, traits>& os);-12- Effects: Calls os.flush(). Then, if os.rdbuf() is a basic_syncbuf<charT, traits, Allocator>*, called buf for the purpose of exposition, calls buf->try_emit().
Modify [syncstream.syncbuf.overview] as indicated:
[…] // [syncstream.syncbuf.members], member functions bool try_emit(); streambuf_type* get_wrapped() const noexcept; […]
-1- Class template basic_syncbuf stores character data written to it, known as the associated output, into internal buffers allocated using the object's allocator. The associated output is transferred to the wrapped stream buffer object *wrapped when try_emit() is called or when the basic_syncbuf object is destroyed. Such transfers are atomic with respect to transfers by other basic_syncbuf objects with the same wrapped stream buffer object.
Modify [syncstream.syncbuf.cons] as indicated:
~basic_syncbuf();-7- Effects: Calls try_emit().
-8- Throws: Nothing. If an exception is thrown from try_emit(), the destructor catches and ignores that exception.
Modify [syncstream.syncbuf.assign] as indicated:
basic_syncbuf& operator=(basic_syncbuf&& rhs) noexcept;-1- Effects: Calls try_emit() then move assigns from rhs. After the move assignment *this has the observable state it would have had if it had been move constructed from rhs ([syncstream.syncbuf.cons]).
Replace in [syncstream.syncbuf.members] all occurrences of emit() by try_emit() (five occurrences)
Replace in [syncstream.syncbuf.virtuals] all occurrences of emit() by try_emit() (three occurrences)
Modify [syncstream.osyncstream.overview] as indicated:
[…] // [syncstream.osyncstream.members], member functions void emit_or_fail(); streambuf_type* get_wrapped() const noexcept; […]
Replace in [syncstream.osyncstream.cons] all occurrences of emit() by emit_or_fail() (three occurrences)
Replace in [syncstream.osyncstream.assign] all occurrences of emit() by emit_or_fail() (two occurrences)
Replace in [syncstream.osyncstream.members] all occurrences of emit() by emit_or_fail() (six occurrences)
[ 2020-11-09 Status changed: Tentatively NAD → NAD. ]
[ 2020-02-14, Prague ]
The issue was send to LEWG, who made the following poll:
We're open to renaming osyncstream::emit() (and related).
SF F N A SA 1 1 5 8 20
The current IS contains a function called emit() (in basic_syncbuf, added by P0053).
emit is a macro in pervasive use in every Qt program. #include'ing <osyncstream> after any Qt header would break, because emit was #define'd to nothing by the Qt headers. It is understood that the committee cannot check every 3rd-party library out there that chooses (badly, as I’d readily concur) to #define a macro of all-lowercase letters, but the min/max issue in the Windows headers caused so much pain for our users, that we probably should avoid a breakage here, for the benefit of our users that have to work Qt. It also doesn’t seem like emit() is a particularly mandatory name for the syncbuf function. Since it returns bool, it could just as easily be called try_emit() and the issue would be solved. Suggested approach: In basic_syncbuf, rename bool emit() to bool try_emit(). In basic_osyncstream, where the function doesn't return bool, but sets the stream's failbit, rename void emit() to void emit_or_fail().History | |||
---|---|---|---|
Date | User | Action | Args |
2020-11-09 20:22:58 | admin | set | messages: + msg11537 |
2020-02-14 12:42:03 | admin | set | status: new -> nad |
2020-02-14 12:42:03 | admin | set | messages: + msg11121 |
2020-02-14 12:42:03 | admin | set | status: new -> new |
2020-02-14 07:38:36 | admin | set | status: nad -> new |
2020-02-14 07:38:36 | admin | set | messages: + msg11098 |
2019-02-14 00:00:00 | admin | create |