Make istreambuf_iterator::_M_sbuf immutable and add debug checks
François Dumont
frs.dumont@gmail.com
Mon Nov 6 21:19:00 GMT 2017
Hi
   Any final decision regarding this patch ?
François
On 23/10/2017 21:08, François Dumont wrote:
> Hi
>
> Â Â Â Â I completed execution of all tests and found one test impacted by
> this patch.
>
> Â Â Â Â It is a good example of the impact of the patch. Users won't be
> able to build a istreambuf_iterator at a point where the underlying
> streambuf is at end-of-stream and then put some data in the streambuf
> and then use the iterator. This is similar to what Petr was proposing,
> some eof iterator becoming valid again through an operation on the
> streambuf. I would prefer we forbid it completely or we accept it
> completely but current middle way situation is strange.
>
> Â Â Â Â The fix is easy, let the compiler build the streambuf_iterator
> when needed. Even if patch is not accepted I think we should keep the
> change on the test which is fragile.
>
> François
>
>
> On 13/10/2017 19:14, François Dumont wrote:
>> Hi
>>
>> Â Â Â Â Here is the last patch I will propose for istreambuf_iterator.
>> This is mostly to remove the mutable keyword on _M_sbuf.
>>
>> Â Â Â Â To do so I had to reset _M_sbuf in valid places that is to say
>> constructors and increment operators. Despite that we might still
>> have eof iterators with _M_sbuf not null when you have for instance
>> several iterator instance but only increment one. It seems fine to me
>> because even in this case iterator will still be considered as eof
>> and using several istreambuf_iterator to go through a given streambuf
>> is not usual.
>>
>> Â Â Â Â As _M_sbuf is immutable I have been able to restore the simple
>> call to _M_at_eof() in the increment operators debug check.
>>
>> Ok to commit after successful tests ?
>>
>> François
>>
>>
>>
>
>
More information about the Libstdc++
mailing list