Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

collection: fix SortedArray container #35

Merged
merged 1 commit into from
Apr 9, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Collection/SortedArray.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,19 @@ public:
// owned: flag restricts destructor to delete array elements
// unique: flag allows add()-ing of identical elements
// sorter: array sorting implementation
SortedArray(bool owned=true,bool unique=true,SortComparer<T>*sorter=NULL):
SortedArray(SortComparer<T>*sorter,bool owned=true,bool unique=true):
Collection(owned,sorter),
m_unique(unique),
m_sorter(sorter==NULL?new GenericSortComparer<T>():sorter){}
~SortedArray() {SafeDelete(m_sorter);}
m_sorter(sorter){}
~SortedArray() {clear();}

// ConstIterator interface
ConstIterator<T>*constIterator() const {return new ConstSortedArrayIterator<T>(GetPointer(this));}
// Iterator interface
Iterator<T>*iterator() {return new SortedArrayIterator<T>(GetPointer(this),m_owned);}

// Collection interface
void clear() {m_array.clear();}
void clear() {if(m_owned) m_array.clear(); else m_array.resize(0);}
bool add(T value);
bool remove(const T value);
int size() const {return m_array.size();}
Expand Down