PR libstdc++/68222 Hide safe iterator operators

François Dumont frs.dumont@gmail.com
Tue Aug 21 20:18:00 GMT 2018


On 21/08/2018 11:33, Jonathan Wakely wrote:
> On 18/08/18 22:31 +0200, François Dumont wrote:
>> Here is the new proposal. It is indeed possible to keep 
>> _Safe_iterator and just add a _Category template parameter to it.
>
> While this is still a large patch (obviously, because it's changing a
> lot!) I think this version is much easier to understand, and doesn't
> add a whole new class unnecessarily. Thanks for updating it.
>
>> I introduce a friend declaration to access container _Base nested 
>> typedef from the safe iterator.
>>
>> I review the safe const_iterator constructor from safe iterator. I 
>> now check if we are in the a const_iterator context so that compilers 
>> don't even try to consider this constructor when we are in an 
>> iterator context.
>
> Nice.
>
>> I adapted _Safe_local_iterator the same way to keep consistency with 
>> _Safe_iterator and because I find the new design cleaner. It also 
>> fixes the same problem I fixed on _Safe_iterator when checking it 
>> iterator has been initialized using _MutableIterator() rather than 
>> _Iterator().
>>
>> I stop overloading __get_distance for safe iterators or safe local 
>> iterators, it was useless. I prefer to introduce similar functions as 
>> members. Same for __get_distance_from_begin or __get_distance_to_end, 
>> and I move code in safe_iterator.tcc.
>>
>> Tested under Linux x86_64 debug mode.
>>
>> Ok to commit ?
>
> OK for trunk, thanks again.
>
>
>
Note that it also avoids to adapt the pretty printers scripts.

I'll commit it tomorrow once I'll have rework the ChangeLog entry. I'll 
also add the test case in PR 68222 adapted for the testsuite.

François



More information about the Libstdc++ mailing list