From: "François Dumont" <frs.dumont@gmail.com>
To: "libstdc++@gcc.gnu.org" <libstdc++@gcc.gnu.org>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>
Subject: [PATCH][_GLIBCXX_DEBUG] Code cleanup/simplification
Date: Sat, 13 Nov 2021 14:17:48 +0100 [thread overview]
Message-ID: <8c49ed0b-6c4f-7663-47a9-7c7f31b47c04@gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 4491 bytes --]
libstdc++: [_GLIBCXX_DEBUG] Remove _Safe_container<>::_M_safe()
Container code cleanup to get rid of _Safe_container<>::_M_safe()
and just
_Safe:: calls which use normal inheritance. Also remove several
usages of _M_base()
which can be most of the time ommitted and sometimes replace with
explicit _Base::
calls.
libstdc++-v3/ChangeLog:
* include/debug/safe_container.h
(_Safe_container<>::_M_safe): Remove.
* include/debug/deque
(deque::operator=(initializer_list<>)): Replace
_M_base() call with _Base:: call.
(deque::operator[](size_type)): Likewise.
* include/debug/forward_list (forward_list(forward_list&&,
const allocator_type&):
Remove _M_safe() and _M_base() calls.
(forward_list::operator=(initializer_list<>)): Remove
_M_base() calls.
(forward_list::splice_after, forward_list::merge): Likewise.
* include/debug/list (list(list&&, const allocator_type&)):
Remove _M_safe() and _M_base() calls.
(list::operator=(initializer_list<>)): Remove _M_base() calls.
(list::splice, list::merge): Likewise.
* include/debug/map.h (map(map&&, const allocator_type&)):
Remove _M_safe() and _M_base() calls.
(map::operator=(initializer_list<>)): Remove _M_base() calls.
* include/debug/multimap.h (multimap(multimap&&, const
allocator_type&)):
Remove _M_safe() and _M_base() calls.
(multimap::operator=(initializer_list<>)): Remove _M_base()
calls.
* include/debug/set.h (set(set&&, const allocator_type&)):
Remove _M_safe() and _M_base() calls.
(set::operator=(initializer_list<>)): Remove _M_base() calls.
* include/debug/multiset.h (multiset(multiset&&, const
allocator_type&)):
Remove _M_safe() and _M_base() calls.
(multiset::operator=(initializer_list<>)): Remove _M_base()
calls.
* include/debug/string (basic_string(basic_string&&, const
allocator_type&)):
Remove _M_safe() and _M_base() calls.
(basic_string::operator=(initializer_list<>)): Remove
_M_base() call.
(basic_string::operator=(const _CharT*),
basic_string::operator=(_CharT)): Likewise.
(basic_string::operator[](size_type),
basic_string::operator+=(const basic_string&)): Likewise.
(basic_string::operator+=(const _Char*),
basic_string::operator+=(_CharT)): Likewise.
* include/debug/unordered_map
(unordered_map(unordered_map&&, const allocator_type&)):
Remove _M_safe() and _M_base() calls.
(unordered_map::operator=(initializer_list<>),
unordered_map::merge): Remove _M_base() calls.
(unordered_multimap(unordered_multimap&&, const
allocator_type&)):
Remove _M_safe() and _M_base() calls.
(unordered_multimap::operator=(initializer_list<>),
unordered_multimap::merge):
Remove _M_base() calls.
* include/debug/unordered_set
(unordered_set(unordered_set&&, const allocator_type&)):
Remove _M_safe() and _M_base() calls.
(unordered_set::operator=(initializer_list<>),
unordered_set::merge): Remove _M_base() calls.
(unordered_multiset(unordered_multiset&&, const
allocator_type&)):
Remove _M_safe() and _M_base() calls.
(unordered_multiset::operator=(initializer_list<>),
unordered_multiset::merge):
Remove _M_base() calls.
* include/debug/vector (vector(vector&&, const
allocator_type&):
Remove _M_safe() and _M_base() calls.
(vector::operator=(initializer_list<>)): Remove _M_base()
calls.
(vector::operator[](size_type)): Likewise.
Tested under Linux x86_64 _GLIBCXX_DEBUG mode -std=gnu++14 and -std=gnu++98.
Ok to commit ?
François
[-- Attachment #2: debug_mode.patch --]
[-- Type: text/x-patch, Size: 21244 bytes --]
diff --git a/libstdc++-v3/include/debug/deque b/libstdc++-v3/include/debug/deque
index 52778ba1617..a73d6c34209 100644
--- a/libstdc++-v3/include/debug/deque
+++ b/libstdc++-v3/include/debug/deque
@@ -166,7 +166,7 @@ namespace __debug
deque&
operator=(initializer_list<value_type> __l)
{
- _M_base() = __l;
+ _Base::operator=(__l);
this->_M_invalidate_all();
return *this;
}
@@ -344,7 +344,7 @@ namespace __debug
operator[](size_type __n) _GLIBCXX_NOEXCEPT
{
__glibcxx_check_subscript(__n);
- return _M_base()[__n];
+ return _Base::operator[](__n);
}
_GLIBCXX_NODISCARD
@@ -352,7 +352,7 @@ namespace __debug
operator[](size_type __n) const _GLIBCXX_NOEXCEPT
{
__glibcxx_check_subscript(__n);
- return _M_base()[__n];
+ return _Base::operator[](__n);
}
using _Base::at;
diff --git a/libstdc++-v3/include/debug/forward_list b/libstdc++-v3/include/debug/forward_list
index cae5b5f038b..6ed4853af40 100644
--- a/libstdc++-v3/include/debug/forward_list
+++ b/libstdc++-v3/include/debug/forward_list
@@ -242,8 +242,8 @@ namespace __debug
noexcept(
std::is_nothrow_constructible<_Base,
_Base, const allocator_type&>::value )
- : _Safe(std::move(__list._M_safe()), __al),
- _Base(std::move(__list._M_base()), __al)
+ : _Safe(std::move(__list), __al),
+ _Base(std::move(__list), __al)
{ }
explicit
@@ -287,7 +287,7 @@ namespace __debug
forward_list&
operator=(std::initializer_list<_Tp> __il)
{
- _M_base() = __il;
+ _Base::operator=(__il);
this->_M_invalidate_all();
return *this;
}
@@ -584,7 +584,7 @@ namespace __debug
return __it != __list._M_base().cbefore_begin()
&& __it != __list._M_base().end();
});
- _Base::splice_after(__pos.base(), std::move(__list._M_base()));
+ _Base::splice_after(__pos.base(), std::move(__list));
}
void
@@ -613,8 +613,7 @@ namespace __debug
_Base_const_iterator __next = std::next(__i.base());
this->_M_transfer_from_if(__list, [__next](_Base_const_iterator __it)
{ return __it == __next; });
- _Base::splice_after(__pos.base(), std::move(__list._M_base()),
- __i.base());
+ _Base::splice_after(__pos.base(), std::move(__list), __i.base());
}
void
@@ -669,7 +668,7 @@ namespace __debug
{ return __it == __tmp; });
}
- _Base::splice_after(__pos.base(), std::move(__list._M_base()),
+ _Base::splice_after(__pos.base(), std::move(__list),
__before.base(), __last.base());
}
@@ -710,7 +709,7 @@ namespace __debug
this->_M_invalidate_if([__next](_Base_const_iterator __it)
{ return __it == __next; });
__to_destroy.splice_after(__to_destroy.cbefore_begin(),
- _M_base(), __old);
+ *this, __old);
__x = __old;
_GLIBCXX20_ONLY( __removed++ );
}
@@ -739,7 +738,7 @@ namespace __debug
this->_M_invalidate_if([__x](_Base_const_iterator __it)
{ return __it == __x; });
__to_destroy.splice_after(__to_destroy.cbefore_begin(),
- _M_base(), __old);
+ *this, __old);
__x = __old;
_GLIBCXX20_ONLY( __removed++ );
}
@@ -777,7 +776,7 @@ namespace __debug
this->_M_invalidate_if([__next](_Base_const_iterator __it)
{ return __it == __next; });
__to_destroy.splice_after(__to_destroy.cbefore_begin(),
- _M_base(), __first);
+ *this, __first);
__next = __first;
_GLIBCXX20_ONLY( __removed++ );
}
@@ -804,7 +803,7 @@ namespace __debug
return __it != __list._M_base().cbefore_begin()
&& __it != __list._M_base().cend();
});
- _Base::merge(std::move(__list._M_base()));
+ _Base::merge(std::move(__list));
}
}
@@ -827,7 +826,7 @@ namespace __debug
return __it != __list._M_base().cbefore_begin()
&& __it != __list._M_base().cend();
});
- _Base::merge(std::move(__list._M_base()), __comp);
+ _Base::merge(std::move(__list), __comp);
}
}
diff --git a/libstdc++-v3/include/debug/list b/libstdc++-v3/include/debug/list
index f40ebc8521e..383482c0acf 100644
--- a/libstdc++-v3/include/debug/list
+++ b/libstdc++-v3/include/debug/list
@@ -122,8 +122,8 @@ namespace __debug
noexcept(
std::is_nothrow_constructible<_Base,
_Base, const allocator_type&>::value )
- : _Safe(std::move(__x._M_safe()), __a),
- _Base(std::move(__x._M_base()), __a) { }
+ : _Safe(std::move(__x), __a),
+ _Base(std::move(__x), __a) { }
#endif
explicit
@@ -172,7 +172,7 @@ namespace __debug
operator=(initializer_list<value_type> __l)
{
this->_M_invalidate_all();
- _M_base() = __l;
+ _Base::operator=(__l);
return *this;
}
@@ -583,7 +583,7 @@ namespace __debug
_M_message(__gnu_debug::__msg_self_splice)
._M_sequence(*this, "this"));
this->_M_transfer_from_if(__x, _Not_equal(__x._M_base().end()));
- _Base::splice(__position.base(), _GLIBCXX_MOVE(__x._M_base()));
+ _Base::splice(__position.base(), _GLIBCXX_MOVE(__x));
}
#if __cplusplus >= 201103L
@@ -614,7 +614,7 @@ namespace __debug
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 250. splicing invalidates iterators
this->_M_transfer_from_if(__x, _Equal(__i.base()));
- _Base::splice(__position.base(), _GLIBCXX_MOVE(__x._M_base()),
+ _Base::splice(__position.base(), _GLIBCXX_MOVE(__x),
__i.base());
}
@@ -662,7 +662,7 @@ namespace __debug
this->_M_transfer_from_if(__x, _Equal(__tmp));
}
- _Base::splice(__position.base(), _GLIBCXX_MOVE(__x._M_base()),
+ _Base::splice(__position.base(), _GLIBCXX_MOVE(__x),
__first.base(), __last.base());
}
@@ -709,7 +709,7 @@ namespace __debug
// 526. Is it undefined if a function in the standard changes
// in parameters?
this->_M_invalidate_if(_Equal(__first));
- __to_destroy.splice(__to_destroy.begin(), _M_base(), __first);
+ __to_destroy.splice(__to_destroy.begin(), *this, __first);
#if !_GLIBCXX_USE_CXX11_ABI
_GLIBCXX20_ONLY( __removed++ );
#endif
@@ -743,7 +743,7 @@ namespace __debug
if (__pred(*__x))
{
this->_M_invalidate_if(_Equal(__x));
- __to_destroy.splice(__to_destroy.begin(), _M_base(), __x);
+ __to_destroy.splice(__to_destroy.begin(), *this, __x);
#if !_GLIBCXX_USE_CXX11_ABI
_GLIBCXX20_ONLY( __removed++ );
#endif
@@ -780,7 +780,7 @@ namespace __debug
if (*__first == *__next)
{
this->_M_invalidate_if(_Equal(__next));
- __to_destroy.splice(__to_destroy.begin(), _M_base(), __next);
+ __to_destroy.splice(__to_destroy.begin(), *this, __next);
__next = __first;
#if !_GLIBCXX_USE_CXX11_ABI
_GLIBCXX20_ONLY( __removed++ );
@@ -818,7 +818,7 @@ namespace __debug
if (__binary_pred(*__first, *__next))
{
this->_M_invalidate_if(_Equal(__next));
- __to_destroy.splice(__to_destroy.begin(), _M_base(), __next);
+ __to_destroy.splice(__to_destroy.begin(), *this, __next);
__next = __first;
#if !_GLIBCXX_USE_CXX11_ABI
_GLIBCXX20_ONLY( __removed++ );
@@ -851,7 +851,7 @@ namespace __debug
__glibcxx_check_sorted(_Base::begin(), _Base::end());
__glibcxx_check_sorted(__x.begin().base(), __x.end().base());
this->_M_transfer_from_if(__x, _Not_equal(__x._M_base().end()));
- _Base::merge(_GLIBCXX_MOVE(__x._M_base()));
+ _Base::merge(_GLIBCXX_MOVE(__x));
}
}
@@ -878,7 +878,7 @@ namespace __debug
__glibcxx_check_sorted_pred(__x.begin().base(), __x.end().base(),
__comp);
this->_M_transfer_from_if(__x, _Not_equal(__x._M_base().end()));
- _Base::merge(_GLIBCXX_MOVE(__x._M_base()), __comp);
+ _Base::merge(_GLIBCXX_MOVE(__x), __comp);
}
}
diff --git a/libstdc++-v3/include/debug/map.h b/libstdc++-v3/include/debug/map.h
index 3883c546871..c62f0b574e6 100644
--- a/libstdc++-v3/include/debug/map.h
+++ b/libstdc++-v3/include/debug/map.h
@@ -118,9 +118,9 @@ namespace __debug
: _Base(__m, __a) { }
map(map&& __m, const __type_identity_t<allocator_type>& __a)
- noexcept( noexcept(_Base(std::move(__m._M_base()), __a)) )
- : _Safe(std::move(__m._M_safe()), __a),
- _Base(std::move(__m._M_base()), __a) { }
+ noexcept( noexcept(_Base(std::move(__m), __a)) )
+ : _Safe(std::move(__m), __a),
+ _Base(std::move(__m), __a) { }
map(initializer_list<value_type> __l, const allocator_type& __a)
: _Base(__l, __a) { }
@@ -162,7 +162,7 @@ namespace __debug
map&
operator=(initializer_list<value_type> __l)
{
- _M_base() = __l;
+ _Base::operator=(__l);
this->_M_invalidate_all();
return *this;
}
diff --git a/libstdc++-v3/include/debug/multimap.h b/libstdc++-v3/include/debug/multimap.h
index 073c1c39240..5f0f1faa33e 100644
--- a/libstdc++-v3/include/debug/multimap.h
+++ b/libstdc++-v3/include/debug/multimap.h
@@ -119,9 +119,9 @@ namespace __debug
: _Base(__m, __a) { }
multimap(multimap&& __m, const __type_identity_t<allocator_type>& __a)
- noexcept( noexcept(_Base(std::move(__m._M_base()), __a)) )
- : _Safe(std::move(__m._M_safe()), __a),
- _Base(std::move(__m._M_base()), __a) { }
+ noexcept( noexcept(_Base(std::move(__m), __a)) )
+ : _Safe(std::move(__m), __a),
+ _Base(std::move(__m), __a) { }
multimap(initializer_list<value_type> __l, const allocator_type& __a)
: _Base(__l, __a) { }
@@ -162,7 +162,7 @@ namespace __debug
multimap&
operator=(initializer_list<value_type> __l)
{
- _M_base() = __l;
+ _Base::operator=(__l);
this->_M_invalidate_all();
return *this;
}
diff --git a/libstdc++-v3/include/debug/multiset.h b/libstdc++-v3/include/debug/multiset.h
index 479411d9d06..7729fc19689 100644
--- a/libstdc++-v3/include/debug/multiset.h
+++ b/libstdc++-v3/include/debug/multiset.h
@@ -118,9 +118,9 @@ namespace __debug
: _Base(__m, __a) { }
multiset(multiset&& __m, const __type_identity_t<allocator_type>& __a)
- noexcept( noexcept(_Base(std::move(__m._M_base()), __a)) )
- : _Safe(std::move(__m._M_safe()), __a),
- _Base(std::move(__m._M_base()), __a) { }
+ noexcept( noexcept(_Base(std::move(__m), __a)) )
+ : _Safe(std::move(__m), __a),
+ _Base(std::move(__m), __a) { }
multiset(initializer_list<value_type> __l, const allocator_type& __a)
: _Base(__l, __a)
@@ -162,7 +162,7 @@ namespace __debug
multiset&
operator=(initializer_list<value_type> __l)
{
- _M_base() = __l;
+ _Base::operator=(__l);
this->_M_invalidate_all();
return *this;
}
diff --git a/libstdc++-v3/include/debug/safe_container.h b/libstdc++-v3/include/debug/safe_container.h
index 5de55d69f34..caba37a1207 100644
--- a/libstdc++-v3/include/debug/safe_container.h
+++ b/libstdc++-v3/include/debug/safe_container.h
@@ -48,10 +48,6 @@ namespace __gnu_debug
{ return *static_cast<_SafeContainer*>(this); }
protected:
- _Safe_container&
- _M_safe() _GLIBCXX_NOEXCEPT
- { return *this; }
-
#if __cplusplus >= 201103L
_Safe_container() = default;
_Safe_container(const _Safe_container&) = default;
diff --git a/libstdc++-v3/include/debug/set.h b/libstdc++-v3/include/debug/set.h
index e35e5c1faae..39142aef60b 100644
--- a/libstdc++-v3/include/debug/set.h
+++ b/libstdc++-v3/include/debug/set.h
@@ -117,9 +117,9 @@ namespace __debug
: _Base(__x, __a) { }
set(set&& __x, const __type_identity_t<allocator_type>& __a)
- noexcept( noexcept(_Base(std::move(__x._M_base()), __a)) )
- : _Safe(std::move(__x._M_safe()), __a),
- _Base(std::move(__x._M_base()), __a) { }
+ noexcept( noexcept(_Base(std::move(__x), __a)) )
+ : _Safe(std::move(__x), __a),
+ _Base(std::move(__x), __a) { }
set(initializer_list<value_type> __l, const allocator_type& __a)
: _Base(__l, __a) { }
@@ -160,7 +160,7 @@ namespace __debug
set&
operator=(initializer_list<value_type> __l)
{
- _M_base() = __l;
+ _Base::operator=(__l);
this->_M_invalidate_all();
return *this;
}
diff --git a/libstdc++-v3/include/debug/string b/libstdc++-v3/include/debug/string
index 2209f88fd54..dd16527b958 100644
--- a/libstdc++-v3/include/debug/string
+++ b/libstdc++-v3/include/debug/string
@@ -160,8 +160,8 @@ namespace __gnu_debug
basic_string(basic_string&& __s, const _Allocator& __a)
noexcept(
std::is_nothrow_constructible<_Base, _Base, const _Allocator&>::value )
- : _Safe(std::move(__s._M_safe()), __a),
- _Base(std::move(__s._M_base()), __a)
+ : _Safe(std::move(__s), __a),
+ _Base(std::move(__s), __a)
{ }
~basic_string() = default;
@@ -213,7 +213,7 @@ namespace __gnu_debug
operator=(const _CharT* __s)
{
__glibcxx_check_string(__s);
- _M_base() = __s;
+ _Base::operator=(__s);
this->_M_invalidate_all();
return *this;
}
@@ -221,7 +221,7 @@ namespace __gnu_debug
basic_string&
operator=(_CharT __c)
{
- _M_base() = __c;
+ _Base::operator=(__c);
this->_M_invalidate_all();
return *this;
}
@@ -230,7 +230,7 @@ namespace __gnu_debug
basic_string&
operator=(std::initializer_list<_CharT> __l)
{
- _M_base() = __l;
+ _Base::operator=(__l);
this->_M_invalidate_all();
return *this;
}
@@ -341,7 +341,7 @@ namespace __gnu_debug
._M_sequence(*this, "this")
._M_integer(__pos, "__pos")
._M_integer(this->size(), "size"));
- return _M_base()[__pos];
+ return _Base::operator[](__pos);
}
reference
@@ -357,7 +357,7 @@ namespace __gnu_debug
._M_integer(__pos, "__pos")
._M_integer(this->size(), "size"));
#endif
- return _M_base()[__pos];
+ return _Base::operator[](__pos);
}
using _Base::at;
@@ -371,7 +371,7 @@ namespace __gnu_debug
basic_string&
operator+=(const basic_string& __str)
{
- _M_base() += __str;
+ _Base::operator+=(__str);
this->_M_invalidate_all();
return *this;
}
@@ -380,7 +380,7 @@ namespace __gnu_debug
operator+=(const _CharT* __s)
{
__glibcxx_check_string(__s);
- _M_base() += __s;
+ _Base::operator+=(__s);
this->_M_invalidate_all();
return *this;
}
@@ -388,7 +388,7 @@ namespace __gnu_debug
basic_string&
operator+=(_CharT __c)
{
- _M_base() += __c;
+ _Base::operator+=(__c);
this->_M_invalidate_all();
return *this;
}
@@ -397,7 +397,7 @@ namespace __gnu_debug
basic_string&
operator+=(std::initializer_list<_CharT> __l)
{
- _M_base() += __l;
+ _Base::operator+=(__l);
this->_M_invalidate_all();
return *this;
}
diff --git a/libstdc++-v3/include/debug/unordered_map b/libstdc++-v3/include/debug/unordered_map
index d6e184a2e99..64cc8bacabd 100644
--- a/libstdc++-v3/include/debug/unordered_map
+++ b/libstdc++-v3/include/debug/unordered_map
@@ -150,9 +150,9 @@ namespace __debug
unordered_map(unordered_map&& __umap,
const allocator_type& __a)
- noexcept( noexcept(_Base(std::move(__umap._M_base()), __a)) )
- : _Safe(std::move(__umap._M_safe()), __a),
- _Base(std::move(__umap._M_base()), __a) { }
+ noexcept( noexcept(_Base(std::move(__umap), __a)) )
+ : _Safe(std::move(__umap), __a),
+ _Base(std::move(__umap), __a) { }
unordered_map(initializer_list<value_type> __l,
size_type __n = 0,
@@ -210,7 +210,7 @@ namespace __debug
unordered_map&
operator=(initializer_list<value_type> __l)
{
- _M_base() = __l;
+ _Base::operator=(__l);
this->_M_invalidate_all();
return *this;
}
@@ -561,7 +561,7 @@ namespace __debug
{
auto __guard
= _Safe::_S_uc_guard(std::__detail::_Select1st{}, __source);
- _Base::merge(__source._M_base());
+ _Base::merge(__source);
}
template<typename _H2, typename _P2>
@@ -575,7 +575,7 @@ namespace __debug
{
auto __guard
= _Safe::_S_umc_guard(std::__detail::_Select1st{}, __source);
- _Base::merge(__source._M_base());
+ _Base::merge(__source);
}
template<typename _H2, typename _P2>
@@ -953,9 +953,9 @@ namespace __debug
unordered_multimap(unordered_multimap&& __umap,
const allocator_type& __a)
- noexcept( noexcept(_Base(std::move(__umap._M_base()), __a)) )
- : _Safe(std::move(__umap._M_safe()), __a),
- _Base(std::move(__umap._M_base()), __a) { }
+ noexcept( noexcept(_Base(std::move(__umap), __a)) )
+ : _Safe(std::move(__umap), __a),
+ _Base(std::move(__umap), __a) { }
unordered_multimap(initializer_list<value_type> __l,
size_type __n = 0,
@@ -1010,7 +1010,7 @@ namespace __debug
unordered_multimap&
operator=(initializer_list<value_type> __l)
{
- this->_M_base() = __l;
+ _Base::operator=(__l);
this->_M_invalidate_all();
return *this;
}
@@ -1270,7 +1270,7 @@ namespace __debug
{
auto __guard
= _Safe::_S_umc_guard(std::__detail::_Select1st{}, __source);
- _Base::merge(__source._M_base());
+ _Base::merge(__source);
}
template<typename _H2, typename _P2>
@@ -1284,7 +1284,7 @@ namespace __debug
{
auto __guard
= _Safe::_S_uc_guard(std::__detail::_Select1st{}, __source);
- _Base::merge(__source._M_base());
+ _Base::merge(__source);
}
template<typename _H2, typename _P2>
diff --git a/libstdc++-v3/include/debug/unordered_set b/libstdc++-v3/include/debug/unordered_set
index 7dc91fa862d..3516af4dc4e 100644
--- a/libstdc++-v3/include/debug/unordered_set
+++ b/libstdc++-v3/include/debug/unordered_set
@@ -146,9 +146,9 @@ namespace __debug
unordered_set(unordered_set&& __uset,
const allocator_type& __a)
- noexcept( noexcept(_Base(std::move(__uset._M_base()), __a)) )
- : _Safe(std::move(__uset._M_safe()), __a),
- _Base(std::move(__uset._M_base()), __a) { }
+ noexcept( noexcept(_Base(std::move(__uset), __a)) )
+ : _Safe(std::move(__uset), __a),
+ _Base(std::move(__uset), __a) { }
unordered_set(initializer_list<value_type> __l,
size_type __n = 0,
@@ -203,7 +203,7 @@ namespace __debug
unordered_set&
operator=(initializer_list<value_type> __l)
{
- _M_base() = __l;
+ _Base::operator=(__l);
this->_M_invalidate_all();
return *this;
}
@@ -448,7 +448,7 @@ namespace __debug
{
auto __guard
= _Safe::_S_uc_guard(std::__detail::_Identity{}, __source);
- _Base::merge(__source._M_base());
+ _Base::merge(__source);
}
template<typename _H2, typename _P2>
@@ -462,7 +462,7 @@ namespace __debug
{
auto __guard
= _Safe::_S_umc_guard(std::__detail::_Identity{}, __source);
- _Base::merge(__source._M_base());
+ _Base::merge(__source);
}
template<typename _H2, typename _P2>
@@ -819,9 +819,9 @@ namespace __debug
unordered_multiset(unordered_multiset&& __uset,
const allocator_type& __a)
- noexcept( noexcept(_Base(std::move(__uset._M_base()), __a)) )
- : _Safe(std::move(__uset._M_safe()), __a),
- _Base(std::move(__uset._M_base()), __a) { }
+ noexcept( noexcept(_Base(std::move(__uset), __a)) )
+ : _Safe(std::move(__uset), __a),
+ _Base(std::move(__uset), __a) { }
unordered_multiset(initializer_list<value_type> __l,
size_type __n = 0,
@@ -876,7 +876,7 @@ namespace __debug
unordered_multiset&
operator=(initializer_list<value_type> __l)
{
- this->_M_base() = __l;
+ _Base::operator=(__l);
this->_M_invalidate_all();
return *this;
}
@@ -1116,7 +1116,7 @@ namespace __debug
{
auto __guard
= _Safe::_S_umc_guard(std::__detail::_Identity{}, __source);
- _Base::merge(__source._M_base());
+ _Base::merge(__source);
}
template<typename _H2, typename _P2>
@@ -1130,7 +1130,7 @@ namespace __debug
{
auto __guard
= _Safe::_S_uc_guard(std::__detail::_Identity{}, __source);
- _Base::merge(__source._M_base());
+ _Base::merge(__source);
}
template<typename _H2, typename _P2>
diff --git a/libstdc++-v3/include/debug/vector b/libstdc++-v3/include/debug/vector
index b532a168e0e..ed10e82c080 100644
--- a/libstdc++-v3/include/debug/vector
+++ b/libstdc++-v3/include/debug/vector
@@ -219,8 +219,8 @@ namespace __debug
noexcept(
std::is_nothrow_constructible<_Base,
_Base, const allocator_type&>::value )
- : _Safe(std::move(__x._M_safe()), __a),
- _Base(std::move(__x._M_base()), __a),
+ : _Safe(std::move(__x), __a),
+ _Base(std::move(__x), __a),
_Safe_vector(std::move(__x)) { }
vector(initializer_list<value_type> __l,
@@ -244,7 +244,7 @@ namespace __debug
vector&
operator=(initializer_list<value_type> __l)
{
- _M_base() = __l;
+ _Base::operator=(__l);
this->_M_invalidate_all();
this->_M_update_guaranteed_capacity();
return *this;
@@ -440,7 +440,7 @@ namespace __debug
operator[](size_type __n) _GLIBCXX_NOEXCEPT
{
__glibcxx_check_subscript(__n);
- return _M_base()[__n];
+ return _Base::operator[](__n);
}
_GLIBCXX_NODISCARD
@@ -448,7 +448,7 @@ namespace __debug
operator[](size_type __n) const _GLIBCXX_NOEXCEPT
{
__glibcxx_check_subscript(__n);
- return _M_base()[__n];
+ return _Base::operator[](__n);
}
using _Base::at;
next reply other threads:[~2021-11-13 13:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-13 13:17 François Dumont [this message]
2021-11-14 17:12 ` Jonathan Wakely
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8c49ed0b-6c4f-7663-47a9-7c7f31b47c04@gmail.com \
--to=frs.dumont@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=libstdc++@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).