×

Discussion Board

Results 1 to 4 of 4

Thread: sort TInt Array

  1. #1
    Registered User
    Join Date
    Jan 2004
    Location
    Tübingen, Germany
    Posts
    31

    sort TInt Array

    Hello everybody,

    I have a CArrayFixFlat<TInt>* and want to sort the Ints. Is this the only method to do it? It's so tricky...

    class TExtraType
    {
    public :
    TInt iData;
    };

    CArrayFixFlat<TExtraType> *iArray = new CArrayFixFlat<TExtraType>(60000);
    //add data to array
    TKeyArrayFix key(_FOFF(TExtraType,iData),ECmpTInt32);
    iArray->Sort(key);

    I don't want to do an TExtraType only to sort my Int-Array...

    Any suggestions?

    Thanks, Sara

  2. #2
    Nokia Developer Champion
    Join Date
    Oct 2006
    Location
    Bangalore, India
    Posts
    1,572

    Re: sort TInt Array

    If you can use RArray<TInt> then it is very simple...

    See if it is possible to do so... !

    with CArrayFixFlat I am not sure, as there seems to be no direct ways !
    Amit Kankani
    Nokia Developer Champion

  3. #3
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,692

    Re: sort TInt Array

    Note that _FOFF is Field OFFset, and the first argument of TKeyArrayFix is also called anOffset. So the magic number shows the offset of the array key inside an array member. If the array memeber is a simple type, the offset is obviously 0.
    Code:
    TKeyArrayFix key(0,ECmpTInt32);
    Otherwise Amit is right, if you do not need to pass the array around (via a pointer), RArray can be used in this particular case, and it is simpler to use. In fact it also uses an offset, but it is automatically set to 0 if not stated otherwise.

  4. #4
    Registered User
    Join Date
    Jan 2004
    Location
    Tübingen, Germany
    Posts
    31

    Re: sort TInt Array

    THANKS A LOT!

Similar Threads

  1. Replies: 7
    Last Post: 2007-10-19, 21:31
  2. Replies: 6
    Last Post: 2005-10-03, 05:51
  3. internal heap limit reached
    By shilpav in forum Symbian User Interface
    Replies: 1
    Last Post: 2004-10-14, 09:43
  4. Problem recording audio on Nokia 3650
    By baykouchev in forum Symbian
    Replies: 2
    Last Post: 2004-06-02, 19:38

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×