diff -r 89d6a7a84779 -r 25a17d01db0c Symbian3/PDK/Source/GUID-FD5C6057-C6D3-5C1A-888C-7B7A3C89CD67.dita --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Symbian3/PDK/Source/GUID-FD5C6057-C6D3-5C1A-888C-7B7A3C89CD67.dita Fri Jan 22 18:26:19 2010 +0000 @@ -0,0 +1,38 @@ + + + + + +How to +use the range checking wrapperSymbian platform provides range checking for arrays. +

Instead of declaring a C++ array directly:

+TTest array[4]; +

use:

+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; +array.Copy(&data[0],4); +...
+
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:

array.At(1).SetValue(100);

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
+
\ No newline at end of file