copy/copy_backward/fill/fill_n/equal rework

Jonathan Wakely jwakely@redhat.com
Fri Sep 27 12:28:00 GMT 2019


On 09/09/19 20:34 +0200, François Dumont wrote:
>Hi
>
>    This patch improves stl_algobase.h 
>copy/copy_backward/fill/fill_n/equal implementations. The improvements 
>are:
>
>- activation of algo specialization for __gnu_debug::_Safe_iterator 
>(w/o _GLIBCXX_DEBUG mode)
>
>- activation of algo specialization for _Deque_iterator even if mixed 
>with another kind of iterator.
>
>- activation of algo specializations __copy_move_a2 for something else 
>than pointers. For example this code:
>
>std::vector<char> v { 'a', 'b', .... };
>
>ostreambuf_iterator out(std::cout);
>
>std::copy(v.begin(), v.end(), out);
>
>is not calling the specialization __copy_move_a2(const char*, const 
>char*, ostreambuf_iterator<>);
>
>It also fix a _GLIBCXX_DEBUG issue where the __niter_base 
>specialization was wrongly removing the _Safe_iterator<> layer. The 
>testsuite/25_algorithms/copy/debug/1_neg.cc test case was failing on a 
>debug assertion because _after_ the copy we were trying to increment 
>the vector iterator after past-the-end. Of course the problem is the 
>_after_, Debug mode should detect this _before_ it takes place which 
>it does now.
>
>Note that std::fill_n is now making use of std::fill for some 
>optimizations dealing with random access iterators.
>
>Performances are very good:

This looks good, but I'm unable to apply the patch:


error: patch failed: libstdc++-v3/include/bits/deque.tcc:967
error: libstdc++-v3/include/bits/deque.tcc: patch does not apply
error: patch failed: libstdc++-v3/include/bits/stl_algobase.h:499
error: libstdc++-v3/include/bits/stl_algobase.h: patch does not apply

Could you regenerate the patch (against a clean master tree) and
resend? Thanks.




More information about the Gcc-patches mailing list