[PATCH] Make std::list::iterator == and != global inline friend

François Dumont frs.dumont@gmail.com
Tue Oct 9 05:25:00 GMT 2018


As we talked one day I would like to make all iterator operators global 
for consistency. So here is the patch to do so for std::list iterators.

Thanks to this change the operators ==(iterator, const_iterator) and != 
are not necessary anymore, one less ==|!= operator candidate.

     * include/bits/stl_list.h
     (_List_operator<>::operator==): Make global inline friend.
     (_List_operator<>::operator!=): Likewise.
     (_List_const_operator<>::operator==): Likewise.
     (_List_const_operator<>::operator!=): Likewise.
     (operator==(const _List_iterator<>&, const _List_const_iterator<>&)):
     Remove.
     (operator!=(const _List_iterator<>&, const _List_const_iterator<>&)):
     Remove.

Tested under Linux x86_64.

Ok to commit ?

François
-------------- next part --------------
A non-text attachment was scrubbed...
Name: list_iterator_inline_friend.patch
Type: text/x-patch
Size: 2152 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20181009/90b13843/attachment.bin>


More information about the Libstdc++ mailing list