Symbian
Symbian Developer Library

SYMBIAN OS V9.4

Feedback

[Index] [Previous] [Next]


Array keys

A key is used by an array for sorting and finding elements and can also be used to locate the insertion position for new elements.

The characteristics of a key are defined by a key object, constructed from one of the three concrete classes: TKeyArrayFix, TKeyArrayVar and TKeyArrayPak. In general, the choice of key class depends on the type of array being used and the specific member function of that array.

TKeyArrayFix is used by the following functions accessible through the CArrayFixFlat and CArrayFixSeg classes:

TKeyArrayVar is used by the following functions accessible through the CArrayVarFlat and CArrayVarSeg classes:

TKeyArrayVar is also used by CArrayPakFlat::SortL().

TKeyArrayPak is used by the following functions accessible through the CArrayPakFlat class:

The concrete classes are all derived from the abstract base class TKey that encapsulates the characteristics of a key and defines the basic behaviour of keys. A class such as TKeyArrayFix provides an implementation for specific arrays or types of array.

A key object is not a component of an array class but is constructed separately and passed, as an argument, to the appropriate array class member function. A key definition is not an integral part of an array, but is used by an array.

A TKey derived object is also passed as an argument to the User::BinarySearch() and User::QuickSort() functions.

An array can use various different key definitions during its life.

The characteristics of a key as defined by the base TKey class are:

See also: