[PATCH] streambuf_iterator: avoid debug-dependent behaviour
François Dumont
frs.dumont@gmail.com
Tue Aug 29 20:02:00 GMT 2017
Hi
You should perhaps justify why you want to do those changes.
On 24/08/2017 11:57, Petr Ovtchenkov wrote:
> Explicit do sgetc from associated streambuf. Avoid debug-dependent
> sgetc (within _M_at_eof()):
>
> __glibcxx_requires_cond(!_M_at_eof(),
> _M_message(__gnu_debug::__msg_inc_istreambuf)
> ._M_iterator(*this));
>
> Increment operators not require not-eof precoditions.
>
> Don't unlink associated streambuf if eof detected (in _M_get).
Why ? Are you working with a streambuf_type implementation that can
return eof at some moment and later return something else ?
I don't think istreambuf_iterator has been designed to work with such a
streambuf_type implementation. Your streambuf_type should block until it
fetches data, just do it in a background thread if you don't want to
block all your application while waiting for it.
However your request made me consider this implementation, I wonder why
it is done this way. Especially why the mutable keywords ?
I would have expected an implementation more consistent with the
istream_iterator implementation reading current character on
construction like in the attached patch.
Is it because of the _GLIBCXX_USE_NOEXCEPT constraint on the
constructors ? Can sgetc() throw ?
François
-------------- next part --------------
A non-text attachment was scrubbed...
Name: istreambuf_iterator.h.patch
Type: text/x-patch
Size: 3102 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20170829/2affd9e5/attachment.bin>
More information about the Libstdc++
mailing list