diff -r 43e37759235e -r 51a74ef9ed63 Symbian3/SDK/Source/GUID-DD3411FE-D95B-5153-8C90-442618920E20.dita --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Symbian3/SDK/Source/GUID-DD3411FE-D95B-5153-8C90-442618920E20.dita Wed Mar 31 11:11:55 2010 +0100 @@ -0,0 +1,32 @@ + + + + + +How +to reserve space in a fixed flat arrayTo be sure that there is sufficient space available to add new +elements to a fixed flat array, you can use the SetReserveL() function +to pre-allocate memory. +

When adding elements to a flat array of elements having the same length +(a CArrayFixFlat<class T> type) the array buffer may be +re-allocated to accommodate the extra elements. This can fail for lack of +memory.

+

If it is important to guarantee that the process of inserting elements +cannot fail at the time of insertion, then the necessary space in the array +buffer should be reserved in advance. This allows any out of memory situation +to be handled before starting to add elements to the array.

+

SetReserveL() reserves sufficient space to accommodate +the required number of elements, in this case ten.

+CArrayFixFlat<TElement>* fixflat; +fixflat = new (ELeave) CArrayFixFlat<TElement>(3); +... +fixflat->SetReserveL(10); +

If the array already contains five elements, then another five elements +can be added to the array and be guaranteed not to fail for lack of memory.

+
\ No newline at end of file