Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



Array of packed elements, flat array

This is a CArrayPakFlat<class T> object whose elements can have different lengths but are physically contiguous within a flat array buffer. Each element is preceded by a TInt value to record the length of that element.

A flat buffer always occupies a single cell allocated from the heap and is always extended by the process of re-allocation. A flat array buffer is implemented using a CBufFlat object.

The following diagram illustrates how elements are organised within the array buffer:

This kind of array is suitable for a small number of objects or for a moderately large but fixed maximum number of objects. It is not suitable for large arrays with a high turnover of elements.

A packed array has the advantage over a variable flat array in having a smaller memory overhead for each element. The disadvantage is that the elements and their preceding TInt values occupy a single cell which has a higher risk of re-allocation failure in times of low memory availability.

This class is immediately derived from the abstract templated base class CArrayPak<class T> which is itself derived from the abstract non-templated base class CArrayPakBase.


See also

Dynamic Buffers Guide.