2018-10-03 François Dumont <fdumont@gcc.gnu.org>

* include/debug/map.h
	(map<>::emplace<>(_Args&&...)): Use C++11 direct initialization.
	(map<>::emplace_hint<>(const_iterator, _Args&&...)): Likewise.
	(map<>::insert(value_type&&)): Likewise.
	(map<>::insert<>(_Pair&&)): Likewise.
	(map<>::insert<>(const_iterator, _Pair&&)): Likewise.
	(map<>::try_emplace): Likewise.
	(map<>::insert_or_assign): Likewise.
	(map<>::insert(node_type&&)): Likewise.
	(map<>::insert(const_iterator, node_type&&)): Likewise.
	(map<>::erase(const_iterator)): Likewise.
	(map<>::erase(const_iterator, const_iterator)): Likewise.
	* include/debug/multimap.h
	(multimap<>::emplace<>(_Args&&...)): Use C++11 direct initialization.
	(multimap<>::emplace_hint<>(const_iterator, _Args&&...)): Likewise.
	(multimap<>::insert<>(_Pair&&)): Likewise.
	(multimap<>::insert<>(const_iterator, _Pair&&)): Likewise.
	(multimap<>::insert(node_type&&)): Likewise.
	(multimap<>::insert(const_iterator, node_type&&)): Likewise.
	(multimap<>::erase(const_iterator)): Likewise.
	(multimap<>::erase(const_iterator, const_iterator)): Likewise.
	* include/debug/set.h
	(set<>::emplace<>(_Args&&...)): Use C++11 direct initialization.
	(set<>::emplace_hint<>(const_iterator, _Args&&...)): Likewise.
	(set<>::insert(value_type&&)): Likewise.
	(set<>::insert<>(const_iterator, value_type&&)): Likewise.
	(set<>::insert(const_iterator, node_type&&)): Likewise.
	(set<>::erase(const_iterator)): Likewise.
	(set<>::erase(const_iterator, const_iterator)): Likewise.
	* include/debug/multiset.h
	(multiset<>::emplace<>(_Args&&...)): Use C++11 direct initialization.
	(multiset<>::emplace_hint<>(const_iterator, _Args&&...)): Likewise.
	(multiset<>::insert<>(value_type&&)): Likewise.
	(multiset<>::insert<>(const_iterator, value_type&&)): Likewise.
	(multiset<>::insert(node_type&&)): Likewise.
	(multiset<>::insert(const_iterator, node_type&&)): Likewise.
	(multiset<>::erase(const_iterator)): Likewise.
	(multiset<>::erase(const_iterator, const_iterator)): Likewise.

From-SVN: r264805
This commit is contained in:
François Dumont 2018-10-03 05:50:01 +00:00
parent da76e70f62
commit 784779d471
5 changed files with 132 additions and 75 deletions

View File

@ -1,3 +1,44 @@
2018-10-03 François Dumont <fdumont@gcc.gnu.org>
* include/debug/map.h
(map<>::emplace<>(_Args&&...)): Use C++11 direct initialization.
(map<>::emplace_hint<>(const_iterator, _Args&&...)): Likewise.
(map<>::insert(value_type&&)): Likewise.
(map<>::insert<>(_Pair&&)): Likewise.
(map<>::insert<>(const_iterator, _Pair&&)): Likewise.
(map<>::try_emplace): Likewise.
(map<>::insert_or_assign): Likewise.
(map<>::insert(node_type&&)): Likewise.
(map<>::insert(const_iterator, node_type&&)): Likewise.
(map<>::erase(const_iterator)): Likewise.
(map<>::erase(const_iterator, const_iterator)): Likewise.
* include/debug/multimap.h
(multimap<>::emplace<>(_Args&&...)): Use C++11 direct initialization.
(multimap<>::emplace_hint<>(const_iterator, _Args&&...)): Likewise.
(multimap<>::insert<>(_Pair&&)): Likewise.
(multimap<>::insert<>(const_iterator, _Pair&&)): Likewise.
(multimap<>::insert(node_type&&)): Likewise.
(multimap<>::insert(const_iterator, node_type&&)): Likewise.
(multimap<>::erase(const_iterator)): Likewise.
(multimap<>::erase(const_iterator, const_iterator)): Likewise.
* include/debug/set.h
(set<>::emplace<>(_Args&&...)): Use C++11 direct initialization.
(set<>::emplace_hint<>(const_iterator, _Args&&...)): Likewise.
(set<>::insert(value_type&&)): Likewise.
(set<>::insert<>(const_iterator, value_type&&)): Likewise.
(set<>::insert(const_iterator, node_type&&)): Likewise.
(set<>::erase(const_iterator)): Likewise.
(set<>::erase(const_iterator, const_iterator)): Likewise.
* include/debug/multiset.h
(multiset<>::emplace<>(_Args&&...)): Use C++11 direct initialization.
(multiset<>::emplace_hint<>(const_iterator, _Args&&...)): Likewise.
(multiset<>::insert<>(value_type&&)): Likewise.
(multiset<>::insert<>(const_iterator, value_type&&)): Likewise.
(multiset<>::insert(node_type&&)): Likewise.
(multiset<>::insert(const_iterator, node_type&&)): Likewise.
(multiset<>::erase(const_iterator)): Likewise.
(multiset<>::erase(const_iterator, const_iterator)): Likewise.
2018-10-02 Marc Glisse <marc.glisse@inria.fr> 2018-10-02 Marc Glisse <marc.glisse@inria.fr>
PR libstdc++/87258 PR libstdc++/87258

View File

@ -240,8 +240,7 @@ namespace __debug
emplace(_Args&&... __args) emplace(_Args&&... __args)
{ {
auto __res = _Base::emplace(std::forward<_Args>(__args)...); auto __res = _Base::emplace(std::forward<_Args>(__args)...);
return std::pair<iterator, bool>(iterator(__res.first, this), return { { __res.first, this }, __res.second };
__res.second);
} }
template<typename... _Args> template<typename... _Args>
@ -249,9 +248,11 @@ namespace __debug
emplace_hint(const_iterator __pos, _Args&&... __args) emplace_hint(const_iterator __pos, _Args&&... __args)
{ {
__glibcxx_check_insert(__pos); __glibcxx_check_insert(__pos);
return iterator(_Base::emplace_hint(__pos.base(), return
std::forward<_Args>(__args)...), {
this); _Base::emplace_hint(__pos.base(), std::forward<_Args>(__args)...),
this
};
} }
#endif #endif
@ -270,7 +271,7 @@ namespace __debug
insert(value_type&& __x) insert(value_type&& __x)
{ {
auto __res = _Base::insert(std::move(__x)); auto __res = _Base::insert(std::move(__x));
return { iterator(__res.first, this), __res.second }; return { { __res.first, this }, __res.second };
} }
template<typename _Pair, typename = typename template<typename _Pair, typename = typename
@ -279,10 +280,8 @@ namespace __debug
std::pair<iterator, bool> std::pair<iterator, bool>
insert(_Pair&& __x) insert(_Pair&& __x)
{ {
std::pair<_Base_iterator, bool> __res auto __res = _Base::insert(std::forward<_Pair>(__x));
= _Base::insert(std::forward<_Pair>(__x)); return { { __res.first, this }, __res.second };
return std::pair<iterator, bool>(iterator(__res.first, this),
__res.second);
} }
#endif #endif
@ -320,8 +319,11 @@ namespace __debug
insert(const_iterator __position, _Pair&& __x) insert(const_iterator __position, _Pair&& __x)
{ {
__glibcxx_check_insert(__position); __glibcxx_check_insert(__position);
return iterator(_Base::insert(__position.base(), return
std::forward<_Pair>(__x)), this); {
_Base::insert(__position.base(), std::forward<_Pair>(__x)),
this
};
} }
#endif #endif
@ -347,7 +349,7 @@ namespace __debug
{ {
auto __res = _Base::try_emplace(__k, auto __res = _Base::try_emplace(__k,
std::forward<_Args>(__args)...); std::forward<_Args>(__args)...);
return { iterator(__res.first, this), __res.second }; return { { __res.first, this }, __res.second };
} }
template <typename... _Args> template <typename... _Args>
@ -356,7 +358,7 @@ namespace __debug
{ {
auto __res = _Base::try_emplace(std::move(__k), auto __res = _Base::try_emplace(std::move(__k),
std::forward<_Args>(__args)...); std::forward<_Args>(__args)...);
return { iterator(__res.first, this), __res.second }; return { { __res.first, this }, __res.second };
} }
template <typename... _Args> template <typename... _Args>
@ -365,9 +367,12 @@ namespace __debug
_Args&&... __args) _Args&&... __args)
{ {
__glibcxx_check_insert(__hint); __glibcxx_check_insert(__hint);
return iterator(_Base::try_emplace(__hint.base(), __k, return
std::forward<_Args>(__args)...), {
this); _Base::try_emplace(__hint.base(), __k,
std::forward<_Args>(__args)...),
this
};
} }
template <typename... _Args> template <typename... _Args>
@ -375,9 +380,12 @@ namespace __debug
try_emplace(const_iterator __hint, key_type&& __k, _Args&&... __args) try_emplace(const_iterator __hint, key_type&& __k, _Args&&... __args)
{ {
__glibcxx_check_insert(__hint); __glibcxx_check_insert(__hint);
return iterator(_Base::try_emplace(__hint.base(), std::move(__k), return
std::forward<_Args>(__args)...), {
this); _Base::try_emplace(__hint.base(), std::move(__k),
std::forward<_Args>(__args)...),
this
};
} }
template <typename _Obj> template <typename _Obj>
@ -386,7 +394,7 @@ namespace __debug
{ {
auto __res = _Base::insert_or_assign(__k, auto __res = _Base::insert_or_assign(__k,
std::forward<_Obj>(__obj)); std::forward<_Obj>(__obj));
return { iterator(__res.first, this), __res.second }; return { { __res.first, this }, __res.second };
} }
template <typename _Obj> template <typename _Obj>
@ -395,7 +403,7 @@ namespace __debug
{ {
auto __res = _Base::insert_or_assign(std::move(__k), auto __res = _Base::insert_or_assign(std::move(__k),
std::forward<_Obj>(__obj)); std::forward<_Obj>(__obj));
return { iterator(__res.first, this), __res.second }; return { { __res.first, this }, __res.second };
} }
template <typename _Obj> template <typename _Obj>
@ -404,9 +412,12 @@ namespace __debug
const key_type& __k, _Obj&& __obj) const key_type& __k, _Obj&& __obj)
{ {
__glibcxx_check_insert(__hint); __glibcxx_check_insert(__hint);
return iterator(_Base::insert_or_assign(__hint.base(), __k, return
std::forward<_Obj>(__obj)), {
this); _Base::insert_or_assign(__hint.base(), __k,
std::forward<_Obj>(__obj)),
this
};
} }
template <typename _Obj> template <typename _Obj>
@ -414,10 +425,12 @@ namespace __debug
insert_or_assign(const_iterator __hint, key_type&& __k, _Obj&& __obj) insert_or_assign(const_iterator __hint, key_type&& __k, _Obj&& __obj)
{ {
__glibcxx_check_insert(__hint); __glibcxx_check_insert(__hint);
return iterator(_Base::insert_or_assign(__hint.base(), return
std::move(__k), {
std::forward<_Obj>(__obj)), _Base::insert_or_assign(__hint.base(), std::move(__k),
this); std::forward<_Obj>(__obj)),
this
};
} }
#endif // C++17 #endif // C++17
@ -446,15 +459,15 @@ namespace __debug
insert(node_type&& __nh) insert(node_type&& __nh)
{ {
auto __ret = _Base::insert(std::move(__nh)); auto __ret = _Base::insert(std::move(__nh));
iterator __pos = iterator(__ret.position, this); return
return { __pos, __ret.inserted, std::move(__ret.node) }; { { __ret.position, this }, __ret.inserted, std::move(__ret.node) };
} }
iterator iterator
insert(const_iterator __hint, node_type&& __nh) insert(const_iterator __hint, node_type&& __nh)
{ {
__glibcxx_check_insert(__hint); __glibcxx_check_insert(__hint);
return iterator(_Base::insert(__hint.base(), std::move(__nh)), this); return { _Base::insert(__hint.base(), std::move(__nh)), this };
} }
using _Base::merge; using _Base::merge;
@ -466,7 +479,7 @@ namespace __debug
{ {
__glibcxx_check_erase(__position); __glibcxx_check_erase(__position);
this->_M_invalidate_if(_Equal(__position.base())); this->_M_invalidate_if(_Equal(__position.base()));
return iterator(_Base::erase(__position.base()), this); return { _Base::erase(__position.base()), this };
} }
iterator iterator
@ -512,7 +525,8 @@ namespace __debug
._M_iterator(__last, "last")); ._M_iterator(__last, "last"));
this->_M_invalidate_if(_Equal(__victim)); this->_M_invalidate_if(_Equal(__victim));
} }
return iterator(_Base::erase(__first.base(), __last.base()), this);
return { _Base::erase(__first.base(), __last.base()), this };
} }
#else #else
void void

View File

@ -228,18 +228,18 @@ namespace __debug
template<typename... _Args> template<typename... _Args>
iterator iterator
emplace(_Args&&... __args) emplace(_Args&&... __args)
{ { return { _Base::emplace(std::forward<_Args>(__args)...), this }; }
return iterator(_Base::emplace(std::forward<_Args>(__args)...), this);
}
template<typename... _Args> template<typename... _Args>
iterator iterator
emplace_hint(const_iterator __pos, _Args&&... __args) emplace_hint(const_iterator __pos, _Args&&... __args)
{ {
__glibcxx_check_insert(__pos); __glibcxx_check_insert(__pos);
return iterator(_Base::emplace_hint(__pos.base(), return
std::forward<_Args>(__args)...), {
this); _Base::emplace_hint(__pos.base(), std::forward<_Args>(__args)...),
this
};
} }
#endif #endif
@ -259,7 +259,7 @@ namespace __debug
_Pair&&>::value>::type> _Pair&&>::value>::type>
iterator iterator
insert(_Pair&& __x) insert(_Pair&& __x)
{ return iterator(_Base::insert(std::forward<_Pair>(__x)), this); } { return { _Base::insert(std::forward<_Pair>(__x)), this }; }
#endif #endif
#if __cplusplus >= 201103L #if __cplusplus >= 201103L
@ -296,8 +296,11 @@ namespace __debug
insert(const_iterator __position, _Pair&& __x) insert(const_iterator __position, _Pair&& __x)
{ {
__glibcxx_check_insert(__position); __glibcxx_check_insert(__position);
return iterator(_Base::insert(__position.base(), return
std::forward<_Pair>(__x)), this); {
_Base::insert(__position.base(), std::forward<_Pair>(__x)),
this
};
} }
#endif #endif
@ -337,13 +340,13 @@ namespace __debug
iterator iterator
insert(node_type&& __nh) insert(node_type&& __nh)
{ return iterator(_Base::insert(std::move(__nh)), this); } { return { _Base::insert(std::move(__nh)), this }; }
iterator iterator
insert(const_iterator __hint, node_type&& __nh) insert(const_iterator __hint, node_type&& __nh)
{ {
__glibcxx_check_insert(__hint); __glibcxx_check_insert(__hint);
return iterator(_Base::insert(__hint.base(), std::move(__nh)), this); return { _Base::insert(__hint.base(), std::move(__nh)), this };
} }
using _Base::merge; using _Base::merge;
@ -355,7 +358,7 @@ namespace __debug
{ {
__glibcxx_check_erase(__position); __glibcxx_check_erase(__position);
this->_M_invalidate_if(_Equal(__position.base())); this->_M_invalidate_if(_Equal(__position.base()));
return iterator(_Base::erase(__position.base()), this); return { _Base::erase(__position.base()), this };
} }
iterator iterator
@ -403,7 +406,8 @@ namespace __debug
._M_iterator(__last, "last")); ._M_iterator(__last, "last"));
this->_M_invalidate_if(_Equal(__victim)); this->_M_invalidate_if(_Equal(__victim));
} }
return iterator(_Base::erase(__first.base(), __last.base()), this);
return { _Base::erase(__first.base(), __last.base()), this };
} }
#else #else
void void

View File

@ -228,19 +228,18 @@ namespace __debug
template<typename... _Args> template<typename... _Args>
iterator iterator
emplace(_Args&&... __args) emplace(_Args&&... __args)
{ { return { _Base::emplace(std::forward<_Args>(__args)...), this }; }
return iterator(_Base::emplace(std::forward<_Args>(__args)...),
this);
}
template<typename... _Args> template<typename... _Args>
iterator iterator
emplace_hint(const_iterator __pos, _Args&&... __args) emplace_hint(const_iterator __pos, _Args&&... __args)
{ {
__glibcxx_check_insert(__pos); __glibcxx_check_insert(__pos);
return iterator(_Base::emplace_hint(__pos.base(), return
std::forward<_Args>(__args)...), {
this); _Base::emplace_hint(__pos.base(), std::forward<_Args>(__args)...),
this
};
} }
#endif #endif
@ -251,7 +250,7 @@ namespace __debug
#if __cplusplus >= 201103L #if __cplusplus >= 201103L
iterator iterator
insert(value_type&& __x) insert(value_type&& __x)
{ return iterator(_Base::insert(std::move(__x)), this); } { return { _Base::insert(std::move(__x)), this }; }
#endif #endif
iterator iterator
@ -266,8 +265,7 @@ namespace __debug
insert(const_iterator __position, value_type&& __x) insert(const_iterator __position, value_type&& __x)
{ {
__glibcxx_check_insert(__position); __glibcxx_check_insert(__position);
return iterator(_Base::insert(__position.base(), std::move(__x)), return { _Base::insert(__position.base(), std::move(__x)), this };
this);
} }
#endif #endif
@ -313,13 +311,13 @@ namespace __debug
iterator iterator
insert(node_type&& __nh) insert(node_type&& __nh)
{ return iterator(_Base::insert(std::move(__nh)), this); } { return { _Base::insert(std::move(__nh)), this }; }
iterator iterator
insert(const_iterator __hint, node_type&& __nh) insert(const_iterator __hint, node_type&& __nh)
{ {
__glibcxx_check_insert(__hint); __glibcxx_check_insert(__hint);
return iterator(_Base::insert(__hint.base(), std::move(__nh)), this); return { _Base::insert(__hint.base(), std::move(__nh)), this };
} }
using _Base::merge; using _Base::merge;
@ -331,7 +329,7 @@ namespace __debug
{ {
__glibcxx_check_erase(__position); __glibcxx_check_erase(__position);
this->_M_invalidate_if(_Equal(__position.base())); this->_M_invalidate_if(_Equal(__position.base()));
return iterator(_Base::erase(__position.base()), this); return { _Base::erase(__position.base()), this };
} }
#else #else
void void
@ -375,7 +373,8 @@ namespace __debug
._M_iterator(__last, "last")); ._M_iterator(__last, "last"));
this->_M_invalidate_if(_Equal(__victim)); this->_M_invalidate_if(_Equal(__victim));
} }
return iterator(_Base::erase(__first.base(), __last.base()), this);
return { _Base::erase(__first.base(), __last.base()), this };
} }
#else #else
void void

View File

@ -229,8 +229,7 @@ namespace __debug
emplace(_Args&&... __args) emplace(_Args&&... __args)
{ {
auto __res = _Base::emplace(std::forward<_Args>(__args)...); auto __res = _Base::emplace(std::forward<_Args>(__args)...);
return std::pair<iterator, bool>(iterator(__res.first, this), return { { __res.first, this }, __res.second };
__res.second);
} }
template<typename... _Args> template<typename... _Args>
@ -238,9 +237,11 @@ namespace __debug
emplace_hint(const_iterator __pos, _Args&&... __args) emplace_hint(const_iterator __pos, _Args&&... __args)
{ {
__glibcxx_check_insert(__pos); __glibcxx_check_insert(__pos);
return iterator(_Base::emplace_hint(__pos.base(), return
std::forward<_Args>(__args)...), {
this); _Base::emplace_hint(__pos.base(), std::forward<_Args>(__args)...),
this
};
} }
#endif #endif
@ -256,10 +257,8 @@ namespace __debug
std::pair<iterator, bool> std::pair<iterator, bool>
insert(value_type&& __x) insert(value_type&& __x)
{ {
std::pair<_Base_iterator, bool> __res auto __res = _Base::insert(std::move(__x));
= _Base::insert(std::move(__x)); return { { __res.first, this }, __res.second };
return std::pair<iterator, bool>(iterator(__res.first, this),
__res.second);
} }
#endif #endif
@ -275,8 +274,7 @@ namespace __debug
insert(const_iterator __position, value_type&& __x) insert(const_iterator __position, value_type&& __x)
{ {
__glibcxx_check_insert(__position); __glibcxx_check_insert(__position);
return iterator(_Base::insert(__position.base(), std::move(__x)), return { _Base::insert(__position.base(), std::move(__x)), this };
this);
} }
#endif #endif
@ -333,7 +331,7 @@ namespace __debug
insert(const_iterator __hint, node_type&& __nh) insert(const_iterator __hint, node_type&& __nh)
{ {
__glibcxx_check_insert(__hint); __glibcxx_check_insert(__hint);
return iterator(_Base::insert(__hint.base(), std::move(__nh)), this); return { _Base::insert(__hint.base(), std::move(__nh)), this };
} }
using _Base::merge; using _Base::merge;
@ -345,7 +343,7 @@ namespace __debug
{ {
__glibcxx_check_erase(__position); __glibcxx_check_erase(__position);
this->_M_invalidate_if(_Equal(__position.base())); this->_M_invalidate_if(_Equal(__position.base()));
return iterator(_Base::erase(__position.base()), this); return { _Base::erase(__position.base()), this };
} }
#else #else
void void
@ -387,7 +385,8 @@ namespace __debug
._M_iterator(__last, "last")); ._M_iterator(__last, "last"));
this->_M_invalidate_if(_Equal(__victim)); this->_M_invalidate_if(_Equal(__victim));
} }
return iterator(_Base::erase(__first.base(), __last.base()), this);
return { _Base::erase(__first.base(), __last.base()), this };
} }
#else #else
void void