Skip to content

Commit

Permalink
Fix #29: make Vector emove have consistent behavior with the rest of …
Browse files Browse the repository at this point in the history
…Collection derived classes
  • Loading branch information
dingmaotu committed Apr 11, 2018
1 parent 4362062 commit 66c7b16
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions Collection/Vector.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,15 @@ public:
if(i!=j) { m_array[i]=m_array[j]; }
i++;
}
// in this case, it is no point to check m_owned and SafeDelete value
}
if(i<s) ArrayResize(m_array,i);
return ((s-i)> 0);
if(i<s)
{
ArrayResize(m_array,i);
// to conform to Collection semantics, a removed value should be deleted if it is owned
if(m_owned) SafeDelete(value);
return true;
}
return false;
}

// Sequence interface
Expand Down
2 changes: 1 addition & 1 deletion Trade/OrderGroup.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,6 @@ void OrderGroup::clearClosed(void)
set(i,0);
}
}
removeAll(0);
remove(0);
}
//+------------------------------------------------------------------+

0 comments on commit 66c7b16

Please sign in to comment.