-void wxList::Sort(const wxSortCompareFunction compfunc)
-{
- // allocate an array for the wxObject pointers of the list
- const size_t num = Number();
- wxObject **objArray = new wxObject *[num];
- wxObject **objPtr = objArray;
-
- // go through the list and put the pointers into the array
- wxNode *node = First();
- while(node!=NULL){
- *objPtr++ = node->Data();
- node = node->Next();
- }
- // sort the array
- qsort((void *)objArray,num,sizeof(wxObject *),compfunc);
- // put the sorted pointers back into the list
- objPtr = objArray;
- node = First();
- while(node!=NULL){
- node->SetData(*objPtr++);
- node = node->Next();
- }
- // free the array
- delete[] objArray;
-}
+void wxListBase::Sort(const wxSortCompareFunction compfunc)
+{
+ // allocate an array for the wxObject pointers of the list
+ const size_t num = GetCount();
+ void **objArray = new void *[num];
+ void **objPtr = objArray;