niter_base simplification

François Dumont frs.dumont@gmail.com
Wed Apr 22 20:10:00 GMT 2015


Hello

     I don't know if I am missing something but I think __niter_base 
could be simplified to remove usage of _Iter_base. Additionally I 
overload it to also remove __normal_iterator layer even if behind a 
reverse_iterator or move_iterator, might help compiler to optimize code, 
no ? If not, might allow other algo optimization in the future...

     I prefered to provide a __make_reverse_iterator to allow the latter 
in C++11 and not only in C++14. Is it fine to do it this way or do you 
prefer to simply get rid of all this part ?

     * include/bits/cpp_type_traits.h (__gnu_cxx::__normal_iterator): 
Delete.
     * include/bits/stl_algobase.h (std::__niter_base): Adapt.
     * include/bits/stl_iterator.h (__make_reverse_iterator): New in C++11.
     (std::__niter_base): Overloads for std::reverse_iterator,
     __gnu_cxx::__normal_iterator and std::move_iterator.

Tested under Linux x86_64. I checked that std::copy still ends up 
calling __builtin_memmove when used on vector iterators.

François

-------------- next part --------------
A non-text attachment was scrubbed...
Name: niter.patch
Type: text/x-patch
Size: 4438 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20150422/24e55e77/attachment.bin>


More information about the Libstdc++ mailing list