aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2024-11-12 17:01:59 +0000
committerJonathan Wakely <redi@gcc.gnu.org>2024-12-03 21:34:25 +0000
commit5f02a4f5c66df222ca8db12cde510c387a962c2d (patch)
tree425d5f79c48664da8c9b9dff9704f54bd2243557
parentca24f585fc3b7bf5e145cf3ee3f6f83ad8a4f2dd (diff)
downloadgcc-5f02a4f5c66df222ca8db12cde510c387a962c2d.zip
gcc-5f02a4f5c66df222ca8db12cde510c387a962c2d.tar.gz
gcc-5f02a4f5c66df222ca8db12cde510c387a962c2d.tar.bz2
libstdc++: Stop using _Self typedefs in std::list iterators
We can just use the injected-class-name instead of defining a new name. That seems simpler. libstdc++-v3/ChangeLog: * include/bits/stl_list.h (_List_iterator): Remove _Self typedef and just use injected-class-name instead. (_List_const_iterator): Likewise.
-rw-r--r--libstdc++-v3/include/bits/stl_list.h40
1 files changed, 21 insertions, 19 deletions
diff --git a/libstdc++-v3/include/bits/stl_list.h b/libstdc++-v3/include/bits/stl_list.h
index dfdab6e..db6b31f 100644
--- a/libstdc++-v3/include/bits/stl_list.h
+++ b/libstdc++-v3/include/bits/stl_list.h
@@ -255,7 +255,6 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _Tp>
struct _List_iterator
{
- typedef _List_iterator<_Tp> _Self;
typedef _List_node<_Tp> _Node;
typedef ptrdiff_t difference_type;
@@ -271,7 +270,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
_List_iterator(__detail::_List_node_base* __x) _GLIBCXX_NOEXCEPT
: _M_node(__x) { }
- _Self
+ _List_iterator
_M_const_cast() const _GLIBCXX_NOEXCEPT
{ return *this; }
@@ -286,45 +285,47 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
operator->() const _GLIBCXX_NOEXCEPT
{ return static_cast<_Node*>(_M_node)->_M_valptr(); }
- _Self&
+ _List_iterator&
operator++() _GLIBCXX_NOEXCEPT
{
_M_node = _M_node->_M_next;
return *this;
}
- _Self
+ _List_iterator
operator++(int) _GLIBCXX_NOEXCEPT
{
- _Self __tmp = *this;
+ _List_iterator __tmp = *this;
_M_node = _M_node->_M_next;
return __tmp;
}
- _Self&
+ _List_iterator&
operator--() _GLIBCXX_NOEXCEPT
{
_M_node = _M_node->_M_prev;
return *this;
}
- _Self
+ _List_iterator
operator--(int) _GLIBCXX_NOEXCEPT
{
- _Self __tmp = *this;
+ _List_iterator __tmp = *this;
_M_node = _M_node->_M_prev;
return __tmp;
}
_GLIBCXX_NODISCARD
friend bool
- operator==(const _Self& __x, const _Self& __y) _GLIBCXX_NOEXCEPT
+ operator==(const _List_iterator& __x,
+ const _List_iterator& __y) _GLIBCXX_NOEXCEPT
{ return __x._M_node == __y._M_node; }
#if __cpp_impl_three_way_comparison < 201907L
_GLIBCXX_NODISCARD
friend bool
- operator!=(const _Self& __x, const _Self& __y) _GLIBCXX_NOEXCEPT
+ operator!=(const _List_iterator& __x,
+ const _List_iterator& __y) _GLIBCXX_NOEXCEPT
{ return __x._M_node != __y._M_node; }
#endif
@@ -340,7 +341,6 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _Tp>
struct _List_const_iterator
{
- typedef _List_const_iterator<_Tp> _Self;
typedef const _List_node<_Tp> _Node;
typedef _List_iterator<_Tp> iterator;
@@ -376,45 +376,47 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
operator->() const _GLIBCXX_NOEXCEPT
{ return static_cast<_Node*>(_M_node)->_M_valptr(); }
- _Self&
+ _List_const_iterator&
operator++() _GLIBCXX_NOEXCEPT
{
_M_node = _M_node->_M_next;
return *this;
}
- _Self
+ _List_const_iterator
operator++(int) _GLIBCXX_NOEXCEPT
{
- _Self __tmp = *this;
+ _List_const_iterator __tmp = *this;
_M_node = _M_node->_M_next;
return __tmp;
}
- _Self&
+ _List_const_iterator&
operator--() _GLIBCXX_NOEXCEPT
{
_M_node = _M_node->_M_prev;
return *this;
}
- _Self
+ _List_const_iterator
operator--(int) _GLIBCXX_NOEXCEPT
{
- _Self __tmp = *this;
+ _List_const_iterator __tmp = *this;
_M_node = _M_node->_M_prev;
return __tmp;
}
_GLIBCXX_NODISCARD
friend bool
- operator==(const _Self& __x, const _Self& __y) _GLIBCXX_NOEXCEPT
+ operator==(const _List_const_iterator& __x,
+ const _List_const_iterator& __y) _GLIBCXX_NOEXCEPT
{ return __x._M_node == __y._M_node; }
#if __cpp_impl_three_way_comparison < 201907L
_GLIBCXX_NODISCARD
friend bool
- operator!=(const _Self& __x, const _Self& __y) _GLIBCXX_NOEXCEPT
+ operator!=(const _List_const_iterator& __x,
+ const _List_const_iterator& __y) _GLIBCXX_NOEXCEPT
{ return __x._M_node != __y._M_node; }
#endif