Fixed keepSomeMatchingFunctions
Previous implementation would fail if functionIndex had wrapped around
This commit is contained in:
parent
1f052154ad
commit
d700b023b3
1 changed files with 8 additions and 4 deletions
|
@ -664,12 +664,16 @@ namespace EC
|
||||||
std::size_t keepSomeMatchingFunctions(List list)
|
std::size_t keepSomeMatchingFunctions(List list)
|
||||||
{
|
{
|
||||||
std::size_t deletedCount = 0;
|
std::size_t deletedCount = 0;
|
||||||
for(std::size_t i = 0; i < functionIndex; ++i)
|
for(auto iter = forMatchingFunctions.begin(); iter != forMatchingFunctions.end();)
|
||||||
{
|
{
|
||||||
if(forMatchingFunctions.find(i) != forMatchingFunctions.end()
|
if(std::find(list.begin(), list.end(), iter->first) == list.end())
|
||||||
&& std::find(list.begin(), list.end(), i) == list.end())
|
|
||||||
{
|
{
|
||||||
deletedCount += forMatchingFunctions.erase(i);
|
iter = forMatchingFunctions.erase(iter);
|
||||||
|
++deletedCount;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
++iter;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue