Fix PR#202520 - predicate called too many times in list::remove_if. Add tests for list, forward_list, and the std::remove_if algorithm
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@214736 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -2046,6 +2046,8 @@ list<_Tp, _Alloc>::remove(const value_type& __x)
|
||||
for (; __j != __e && *__j == __x; ++__j)
|
||||
;
|
||||
__i = erase(__i, __j);
|
||||
if (__i != __e)
|
||||
__i = _VSTD::next(__i);
|
||||
}
|
||||
else
|
||||
++__i;
|
||||
@@ -2065,6 +2067,8 @@ list<_Tp, _Alloc>::remove_if(_Pred __pred)
|
||||
for (; __j != __e && __pred(*__j); ++__j)
|
||||
;
|
||||
__i = erase(__i, __j);
|
||||
if (__i != __e)
|
||||
__i = _VSTD::next(__i);
|
||||
}
|
||||
else
|
||||
++__i;
|
||||
|
Reference in New Issue
Block a user