Commit 32bbb362 by Edward Smith-Rowland

The remainder of the Pre-emptively support P0646R1 for std container erasure.

From-SVN: r266673
parent 0b44b4b8
...@@ -95,19 +95,23 @@ namespace std _GLIBCXX_VISIBILITY(default) ...@@ -95,19 +95,23 @@ namespace std _GLIBCXX_VISIBILITY(default)
{ {
_GLIBCXX_BEGIN_NAMESPACE_VERSION _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _Tp, typename _Alloc, typename _Predicate> template<typename _Tp, typename _Alloc, typename _Predicate>
inline void inline typename deque<_Tp, _Alloc>::size_type
erase_if(deque<_Tp, _Alloc>& __cont, _Predicate __pred) erase_if(deque<_Tp, _Alloc>& __cont, _Predicate __pred)
{ {
const auto __osz = __cont.size();
__cont.erase(std::remove_if(__cont.begin(), __cont.end(), __pred), __cont.erase(std::remove_if(__cont.begin(), __cont.end(), __pred),
__cont.end()); __cont.end());
return __osz - __cont.size();
} }
template<typename _Tp, typename _Alloc, typename _Up> template<typename _Tp, typename _Alloc, typename _Up>
inline void inline typename deque<_Tp, _Alloc>::size_type
erase(deque<_Tp, _Alloc>& __cont, const _Up& __value) erase(deque<_Tp, _Alloc>& __cont, const _Up& __value)
{ {
const auto __osz = __cont.size();
__cont.erase(std::remove(__cont.begin(), __cont.end(), __value), __cont.erase(std::remove(__cont.begin(), __cont.end(), __value),
__cont.end()); __cont.end());
return __osz - __cont.size();
} }
_GLIBCXX_END_NAMESPACE_VERSION _GLIBCXX_END_NAMESPACE_VERSION
} // namespace std } // namespace std
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment