Hide move_iterator ill-form operators

François Dumont frs.dumont@gmail.com
Mon May 6 17:36:00 GMT 2019


Hi

     This is another attempt to make adapter iterator types operators 
undefined when underlying iterator type doesn't support it. For the 
move_iterator it is rather easy and even already done for the operator- 
so I just generalize it to comparison operators. It doesn't cover all 
operators of course but it is still better than current situation.

     * include/bits/stl_iterator.h (move_iterator<>::operator++(int)):
     Simplify implementation using underlying iterator type same
     post-increment operator.
     (move_iterator<>::operator--(int)):
     Simplify implementation using underlying iterator type same
     post-decrement operator.
     (move_iterator<>::operator<(const move_iterator<>&,
     const move_iterator<>&): Define return type as return type of the same
     expression on underlying iterator type.
     (move_iterator<>::operator<=(const move_iterator<>&,
     const move_iterator<>&): Likewise.
     (move_iterator<>::operator>(const move_iterator<>&,
     const move_iterator<>&): Likewise.
     (move_iterator<>::operator>=(const move_iterator<>&,
     const move_iterator<>&): Likewise.
     * testsuite/24_iterators/move_iterator/operator_neg.cc: New.

     Ok to commit or should the Standard be amended first ?

François
-------------- next part --------------
A non-text attachment was scrubbed...
Name: move_iterator.patch
Type: text/x-patch
Size: 6673 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20190506/7e458a1d/attachment.bin>


More information about the Gcc-patches mailing list