Implement P1209 - Adopt Consistent Container Erasure from Library Fundamentals 2 for C++20. Reviewed as https://reviews.llvm.org/D55532
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@349178 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -2953,6 +2953,18 @@ template <class _Tp>
|
||||
using unwrap_ref_decay_t = typename unwrap_ref_decay<_Tp>::type;
|
||||
#endif // > C++17
|
||||
|
||||
template <class _Container, class _Predicate>
|
||||
inline void __libcpp_erase_if_container( _Container& __c, _Predicate __pred)
|
||||
{
|
||||
for (typename _Container::iterator __iter = __c.begin(), __last = __c.end(); __iter != __last;)
|
||||
{
|
||||
if (__pred(*__iter))
|
||||
__iter = __c.erase(__iter);
|
||||
else
|
||||
++__iter;
|
||||
}
|
||||
}
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_FUNCTIONAL
|
||||
|
||||
Reference in New Issue
Block a user