How to use the range checking wrapper

Symbian platform provides range checking for arrays.

Instead of declaring a C++ array directly:

      TTest array[4];


      TFixedArray<TTest,4> array;

Initialise array

The array can be initialised either at construction time or by using the Copy() member function after construction.

const TTest data[] = {TTest(1),TTest(2),TTest(3),TTest(4)};
 // initialise at construction time
TFixedArray<TTest,4> array(&data[0],4);
 // or later using Copy()
TFixedArray<TTest,4> array;

Check accesses for legality

Accesses can be checked for legality using the At() function or the operator[] .

The At() function checks for a legal access in both a release build and a debug build while the operator[] only checks for a legal access in a debug build.

Assuming that the TTest class has a public member function called SetValue() , then a call to this function on the second element of the array is legal:


but an attempt to call this function on the fifth element raises a panic; in this example, there are only four elements:

       array.At(5).SetValue(100); // panics