mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 14:16:07 -06:00
Core: RemoveIf optimised
git-svn-id: svn://ultimatepp.org/upp/trunk@15327 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
bfb42d1fd7
commit
c9db2e45d3
1 changed files with 9 additions and 1 deletions
|
|
@ -272,7 +272,15 @@ template <class Condition>
|
|||
void Vector<T>::RemoveIf(Condition c)
|
||||
{
|
||||
int ti = 0;
|
||||
for(int i = 0; i < items; i++)
|
||||
int i = 0;
|
||||
for(; i < items; i++) { // run to the first element without moving
|
||||
if(c(i)) {
|
||||
(vector + i++)->~T();
|
||||
break;
|
||||
}
|
||||
ti++;
|
||||
}
|
||||
for(; i < items; i++)
|
||||
if(c(i))
|
||||
(vector + i)->~T();
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue