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.
---
Tested x86_64-linux.
Pull request at https://forge.sourceware.org/gcc/gcc-TEST/pulls/25
libstdc++-v3/include/bits/stl_list.h | 40 +++++++++++++++-------------
1 file changed, 21 insertions(+), 19 deletions(-)
diff --git a/libstdc++-v3/include/bits/stl_list.h
b/libstdc++-v3/include/bits/stl_list.h
index d51fde90e2b..b1ab335ba4c 100644
--- a/libstdc++-v3/include/bits/stl_list.h
+++ b/libstdc++-v3/include/bits/stl_list.h
@@ -254,7 +254,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;
@@ -270,7 +269,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; }
@@ -285,45 +284,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
@@ -339,7 +340,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;
@@ -375,45 +375,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
--
2.47.0