How to sort CArrayPtrFlat<T>?
How to sort an array of type CArrayPtrFlat<CMyClass>, which containg pointer to CMyClass as elements?
I have tried to use something like this,
//create the array
CArrayPtrFlat<CMyClass>* iArray = new (ELeave) CArrayPtrFlat<CMyClass>(16);
//assume serveral some elements are put into the array like this:
CMyClass* iElement = new (ELeave) MyClass;
//then i prepare the key for sorting.
//iString is a public member of type TBuf
TKeyArrayFix iKey(_FOFF(CMyClass, iString),ECmpFolded);
//it is supposed to sort the array according to the iString of each elment
Buf the array is not sorted correctly as i print out the string usign the loop
for( TInt i = 0 ; i < iArray->Count(); i++)
Could anyone tell what is wrong in my code?
I suspected that may be related to the usage of CArrayPtrFlat.
Thank you very much.
The documentation is a bit misleading as it directs you to the base class.
You need to include "msvarray.h" and link to "msgs.lib".
But is it enough that just to include the msvarray.h" and link to "msgs.lib"?