CList.Sort(sort mode)

To add comments, please log in or register
imamushroom
179
imamushroom  

Hi,

I can't find any documentation on the CList object sort mode parameter of the Sort method. Could someone please explain how I use it.

Thanks in advance. 

whroeder1
17940
whroeder1  
You "can't find any documentation" because there isn't any.
It is used in
void CList::QuickSort(int beg,int end,int mode){
   CObject *i_ptr,*j_ptr,*k_ptr;
   :
         while(i_ptr.Compare(k_ptr,mode)<0)
List.mqh
The CObject method is defined as/in
virtual int       Compare(const CObject *node,const int mode=0) const { return(0);      }
Object.mqh

It is your code, where you derive from CObject and override the Compare method, determines what the mode parameter means.

If you only have one value to sort by, then you use positive/negative to determine the sorting direction.

If you have multiple possible values use the mode value to select which field and the sign the direction.

Etc. It is up to you.

imamushroom
179
imamushroom  
Thank you, I was wondering how to select what I want to search on and now I know. Thanks again!
To add comments, please log in or register