From 5defb0f2085dc651c1d36539198da5d72fa09516 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Tue, 7 Oct 2008 14:49:20 +0000 Subject: [PATCH] stl_iterator.h (operator-(const reverse_iterator<>&, const reverse_iterator<>&), [...]): Use the auto -> return type syntax, implement DR 685. 2008-10-07 Paolo Carlini * include/bits/stl_iterator.h (operator-(const reverse_iterator<>&, const reverse_iterator<>&), operator-(const __normal_iterator<>&, const __normal_iterator<>&), operator-(const move_iterator<>&, const move_iterator<>&)): Use the auto -> return type syntax, implement DR 685. From-SVN: r140937 --- libstdc++-v3/ChangeLog | 8 ++++++++ libstdc++-v3/include/bits/stl_iterator.h | 20 +++++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 7ab200becd45..90c48823c933 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,11 @@ +2008-10-07 Paolo Carlini + + * include/bits/stl_iterator.h (operator-(const reverse_iterator<>&, + const reverse_iterator<>&), operator-(const __normal_iterator<>&, + const __normal_iterator<>&), operator-(const move_iterator<>&, + const move_iterator<>&)): Use the auto -> return type syntax, + implement DR 685. + 2008-10-06 Jason Merrill * config/abi/pre/gnu.ver: Update char16/32_t manglings. diff --git a/libstdc++-v3/include/bits/stl_iterator.h b/libstdc++-v3/include/bits/stl_iterator.h index 0d66129fb801..d161e303e305 100644 --- a/libstdc++-v3/include/bits/stl_iterator.h +++ b/libstdc++-v3/include/bits/stl_iterator.h @@ -365,9 +365,17 @@ _GLIBCXX_BEGIN_NAMESPACE(std) { return !(__x < __y); } template +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + // DR 685. + inline auto + operator-(const reverse_iterator<_IteratorL>& __x, + const reverse_iterator<_IteratorR>& __y) + -> decltype(__y.base() - __x.base()) +#else inline typename reverse_iterator<_IteratorL>::difference_type operator-(const reverse_iterator<_IteratorL>& __x, const reverse_iterator<_IteratorR>& __y) +#endif { return __y.base() - __x.base(); } //@} @@ -835,9 +843,17 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) // operators but also operator- must accept mixed iterator/const_iterator // parameters. template +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + // DR 685. + inline auto + operator-(const __normal_iterator<_IteratorL, _Container>& __lhs, + const __normal_iterator<_IteratorR, _Container>& __rhs) + -> decltype(__lhs.base() - __rhs.base()) +#else inline typename __normal_iterator<_IteratorL, _Container>::difference_type operator-(const __normal_iterator<_IteratorL, _Container>& __lhs, const __normal_iterator<_IteratorR, _Container>& __rhs) +#endif { return __lhs.base() - __rhs.base(); } template @@ -1001,10 +1017,12 @@ _GLIBCXX_BEGIN_NAMESPACE(std) const move_iterator<_IteratorR>& __y) { return !(__x < __y); } + // DR 685. template - inline typename move_iterator<_IteratorL>::difference_type + inline auto operator-(const move_iterator<_IteratorL>& __x, const move_iterator<_IteratorR>& __y) + -> decltype(__x.base() - __y.base()) { return __x.base() - __y.base(); } template -- 2.47.3