[PATCH] Extend std::copy/std::copy_n char* overload to deque iterator

François Dumont frs.dumont@gmail.com
Thu May 7 07:12:37 GMT 2020


     This patch purpose is to make sure that existing 
std::copy/std::copy_n overloads for char* will also be used for 
std::deque<char> iterators when dealing with istreambuf_iterator. It 
also make sure that it still works when _GLIBCXX_DEBUG is activated.

     * include/bits/stl_algo.h (__copy_n_a): Move to ...
     * include/bits/stl_algobase.h (__copy_n_a): ...here. Add __strict
     parameter.
     (__niter_base(const _Safe_iterator<_Ite, _Seq,
     random_access_iterator_tag>&)): New declaration.
     (__copy_move_a2(istreambuf_iterator<>, istreambuf_iterator<>,
     _Deque_iterator<>)): New declaration.
     (__copy_n_a(istreambuf_iterator<>, _Size, _Deque_iterator<>, bool)):
     New declaration.
     * include/bits/deque.tcc
     (__copy_move_a2(istreambuf_iterator<>, istreambuf_iterator<>,
     _Deque_iterator<>)): Add definition.
     (__copy_n_a(istreambuf_iterator<>, _Size, _Deque_iterator<>, bool)):
     Add definition.
     * include/bits/streambuf_iterator.h
     (__copy_n_a(istreambuf_iterator<>, _Size, _CharT*, bool)): Adapt
     definition.
     * include/debug/safe_iterator.tcc (__niter_base): Add definition.
     * testsuite/25_algorithms/copy/streambuf_iterators/char/4.cc (test03):
     New.
     * testsuite/25_algorithms/copy/streambuf_iterators/char/debug/
     deque_neg.cc: New.
     * testsuite/25_algorithms/copy_n/debug/istreambuf_ite_deque_neg.cc:
     New.
     * testsuite/25_algorithms/copy_n/istreambuf_iterator/2.cc: New.
     * testsuite/25_algorithms/copy_n/istreambuf_iterator/deque.cc: New.

Already tested for a while on Linux x64 normal and debug modes but I am 
currently rebuilding everything and will commit only once all succeeded 
again.

Ok ?

François

-------------- next part --------------
A non-text attachment was scrubbed...
Name: deque_streambuf_ite.patch
Type: text/x-patch
Size: 16095 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/libstdc++/attachments/20200507/9e431368/attachment.bin>


More information about the Libstdc++ mailing list