Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Apr 2004

    how to INSERT data in an ARRAY in ARBITRARY order??

    Dear all

    I want to declare an array with 3000 elements, ,and then add data to the array in arbitrary order

    I have tried the following

    CArrayPtrFlat<CResData)* iArray;
    iArray = new (ELeave) CArrayPtrFlat<CResData> (3000);

    then i tried to use a for loop to add data

    for(TInt i=0; i<size; i++) // size is supposed to be smaller than 3K
    id = GetId();
    iArray->InsertL(id, data);

    I know that InsertL cannot perform what i want because i cannot insert to a position GREATER than the number of elements in the array

    So how to achieve the arbbitrary insertion??

    thx a lot

  2. #2
    Super Contributor
    Join Date
    Mar 2003
    Please be noted that:

    iArray = new (ELeave) CArrayPtrFlat<CResData> (3000);

    "3000" is the granularity for the array, and it is not the actual size for the array. In fact, you can use it beyond 3000.

    Hope this helps!

    Forum Nokia
    Last edited by liuxg; 2004-05-13 at 03:43.

Posting Permissions

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