aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorFrançois Dumont <fdumont@gcc.gnu.org>2018-10-11 20:21:57 +0000
committerFrançois Dumont <fdumont@gcc.gnu.org>2018-10-11 20:21:57 +0000
commit91febb0e2bb8a0f891bcb17a142d952a689c5dbb (patch)
tree0f4cf137a825944d5ead060aa8bc3e7bca52322a /libstdc++-v3
parent2c4f9ec16214b53c53c46dd3a0a22f18a268bc28 (diff)
downloadgcc-91febb0e2bb8a0f891bcb17a142d952a689c5dbb.zip
gcc-91febb0e2bb8a0f891bcb17a142d952a689c5dbb.tar.gz
gcc-91febb0e2bb8a0f891bcb17a142d952a689c5dbb.tar.bz2
2018-10-11 François Dumont <fdumont@gcc.gnu.org>
* include/bits/forward_list.h (_Fwd_list_iterator<>::operator==): Replace member function with inline friend. (_Fwd_list_iterator<>::operator!=): Likewise. (_Fwd_list_const_iterator<>::operator==): Likewise. (_Fwd_list_const_iterator<>::operator!=): Likewise. (operator==(const _Fwd_list_iterator<>&, const _Fwd_list_const_iterator<>&)): Remove. (operator!=(const _Fwd_list_iterator<>&, const _Fwd_list_const_iterator<>&)): Remove. (forward_list<>::_Node): Take typedef from base type. (forward_list<>::iterator): Likewise. (forward_list<>::const_iterator): Likewise. From-SVN: r265060
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog16
-rw-r--r--libstdc++-v3/include/bits/forward_list.h61
2 files changed, 44 insertions, 33 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index b92fdf1..74a781e 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,19 @@
+2018-10-11 François Dumont <fdumont@gcc.gnu.org>
+
+ * include/bits/forward_list.h
+ (_Fwd_list_iterator<>::operator==): Replace member function with inline
+ friend.
+ (_Fwd_list_iterator<>::operator!=): Likewise.
+ (_Fwd_list_const_iterator<>::operator==): Likewise.
+ (_Fwd_list_const_iterator<>::operator!=): Likewise.
+ (operator==(const _Fwd_list_iterator<>&,
+ const _Fwd_list_const_iterator<>&)): Remove.
+ (operator!=(const _Fwd_list_iterator<>&,
+ const _Fwd_list_const_iterator<>&)): Remove.
+ (forward_list<>::_Node): Take typedef from base type.
+ (forward_list<>::iterator): Likewise.
+ (forward_list<>::const_iterator): Likewise.
+
2018-10-11 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/80538
diff --git a/libstdc++-v3/include/bits/forward_list.h b/libstdc++-v3/include/bits/forward_list.h
index 84a4ad4..ebec3b5 100644
--- a/libstdc++-v3/include/bits/forward_list.h
+++ b/libstdc++-v3/include/bits/forward_list.h
@@ -173,13 +173,20 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
return __tmp;
}
- bool
- operator==(const _Self& __x) const noexcept
- { return _M_node == __x._M_node; }
+ /**
+ * @brief Forward list iterator equality comparison.
+ */
+ friend bool
+ operator==(const _Self& __x, const _Self& __y) noexcept
+ { return __x._M_node == __y._M_node; }
- bool
- operator!=(const _Self& __x) const noexcept
- { return _M_node != __x._M_node; }
+
+ /**
+ * @brief Forward list iterator inequality comparison.
+ */
+ friend bool
+ operator!=(const _Self& __x, const _Self& __y) noexcept
+ { return __x._M_node != __y._M_node; }
_Self
_M_next() const noexcept
@@ -244,13 +251,19 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
return __tmp;
}
- bool
- operator==(const _Self& __x) const noexcept
- { return _M_node == __x._M_node; }
+ /**
+ * @brief Forward list const_iterator equality comparison.
+ */
+ friend bool
+ operator==(const _Self& __x, const _Self& __y) noexcept
+ { return __x._M_node == __y._M_node; }
- bool
- operator!=(const _Self& __x) const noexcept
- { return _M_node != __x._M_node; }
+ /**
+ * @brief Forward list const_iterator inequality comparison.
+ */
+ friend bool
+ operator!=(const _Self& __x, const _Self& __y) noexcept
+ { return __x._M_node != __y._M_node; }
_Self
_M_next() const noexcept
@@ -265,24 +278,6 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
};
/**
- * @brief Forward list iterator equality comparison.
- */
- template<typename _Tp>
- inline bool
- operator==(const _Fwd_list_iterator<_Tp>& __x,
- const _Fwd_list_const_iterator<_Tp>& __y) noexcept
- { return __x._M_node == __y._M_node; }
-
- /**
- * @brief Forward list iterator inequality comparison.
- */
- template<typename _Tp>
- inline bool
- operator!=(const _Fwd_list_iterator<_Tp>& __x,
- const _Fwd_list_const_iterator<_Tp>& __y) noexcept
- { return __x._M_node != __y._M_node; }
-
- /**
* @brief Base class for %forward_list.
*/
template<typename _Tp, typename _Alloc>
@@ -433,8 +428,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
private:
typedef _Fwd_list_base<_Tp, _Alloc> _Base;
- typedef _Fwd_list_node<_Tp> _Node;
typedef _Fwd_list_node_base _Node_base;
+ typedef typename _Base::_Node _Node;
typedef typename _Base::_Node_alloc_type _Node_alloc_type;
typedef typename _Base::_Node_alloc_traits _Node_alloc_traits;
typedef allocator_traits<__alloc_rebind<_Alloc, _Tp>> _Alloc_traits;
@@ -447,8 +442,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
typedef value_type& reference;
typedef const value_type& const_reference;
- typedef _Fwd_list_iterator<_Tp> iterator;
- typedef _Fwd_list_const_iterator<_Tp> const_iterator;
+ typedef typename _Base::iterator iterator;
+ typedef typename _Base::const_iterator const_iterator;
typedef std::size_t size_type;
typedef std::ptrdiff_t difference_type;
typedef _Alloc allocator_type;