[committed 2/3] libstdc++: Add remaining C++20 changes to iterator adaptors
Jonathan Wakely
jwakely@redhat.com
Sat Mar 28 22:22:13 GMT 2020
On 28/03/20 00:16 +0000, Jonathan Wakely wrote:
>On 27/03/20 23:29 +0000, Jonathan Wakely wrote:
>>@@ -403,6 +428,49 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>> operator>=(const reverse_iterator<_IteratorL>& __x,
>> const reverse_iterator<_IteratorR>& __y)
>> { return !(__x < __y); }
>>+#else // C++20
>>+ template<typename _IteratorL, typename _IteratorR>
>>+ constexpr auto
>>+ operator==(const reverse_iterator<_IteratorL>& __x,
>>+ const reverse_iterator<_IteratorR>& __y)
>>+ -> decltype(__detail::__convbool(__x.base() == __y.base()))
>>+ { return __x.base() == __y.base(); }
>>+
>>+ template<typename _IteratorL, typename _IteratorR>
>>+ constexpr auto
>>+ operator!=(const reverse_iterator<_IteratorL>& __x,
>>+ const reverse_iterator<_IteratorR>& __y)
>>+ -> decltype(__detail::__convbool(__x.base() != __y.base()))
>>+ { return __x.base() != __y.base(); }
>>+
>>+ template<typename _IteratorL, typename _IteratorR>
>>+ constexpr auto
>>+ operator<(const reverse_iterator<_IteratorL>& __x,
>>+ const reverse_iterator<_IteratorR>& __y)
>>+ -> decltype(__detail::__convbool(__x.base() < __y.base()))
>>+ { return __x.base() < __y.base(); }
>
>Drat, these relational operators use the wrong operator. The sense
>needs to be flipped because they're reverse_iterators.
>
>Looks like I lost an edit to this file that I made on another machine,
>and committed the wrong version. I'll fix it ASAP.
Here's the fix. Tested powerpc64le-linux, committed to master.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.txt
Type: text/x-patch
Size: 16362 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20200328/388c574f/attachment.bin>
More information about the Libstdc++
mailing list