To 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.