Symbian3/SDK/Source/GUID-577F42BA-299E-5071-8C7A-FA0CBADCECAE.dita
author Dominic Pinkman <dominic.pinkman@nokia.com>
Tue, 20 Jul 2010 12:00:49 +0100
changeset 13 48780e181b38
parent 0 89d6a7a84779
permissions -rw-r--r--
Week 28 contribution of SDK documentation content. See release notes for details. Fixes bugs Bug 1897 and Bug 1522.

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License 
"Eclipse Public License v1.0" which accompanies this distribution, 
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
    Nokia Corporation - initial contribution.
Contributors: 
-->
<!DOCTYPE concept
  PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept id="GUID-577F42BA-299E-5071-8C7A-FA0CBADCECAE" xml:lang="en"><title>The
types of array</title><shortdesc>Describes the types of array available.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
<section id="GUID-A39A5291-6177-4521-AB8F-65D3F09FC333"><title>General arrays of objects</title> <p>Six general types of
array can be constructed:</p> <ul>
<li id="GUID-37305910-8E80-5F8B-9511-2354BD66BD38"><p><codeph>CArrayFixFlat&lt;Class
T&gt;</codeph>: an array of elements, all having the same length. It uses a flat
array buffer implemented by a <codeph>CBufFlat</codeph> object. The array
object itself is allocated on the heap.</p> </li>
<li id="GUID-E0E535CE-F623-57C9-86DC-BC755E00FE3F"><p><codeph>CArrayFixSeg&lt;Class
T&gt;</codeph>: an array of elements, all having the same length. It uses a segmented
array buffer implemented by a <codeph>CBufSeg</codeph> object. The array object
itself is allocated on the heap.</p> </li>
<li id="GUID-BA0B6BF0-C156-596A-B63F-9A7D262C218E"><p><codeph>CArrayVarFlat&lt;Class
T&gt;</codeph>: an array of elements having varying lengths. It uses a flat array
buffer implemented by a <codeph>CBufFlat</codeph> object. The array object
itself is allocated on the heap.</p> </li>
<li id="GUID-3E74B298-B832-5404-9002-92E7CE8D3228"><p><codeph>CArrayVarSeg&lt;Class
T&gt;</codeph>: an array of elements having varying lengths. It uses a segmented
array buffer implemented by a <codeph>CBufSeg</codeph> object. The array object
itself is allocated on the heap.</p> </li>
<li id="GUID-3A949BDB-822A-59EE-8C15-E5FB3EBC8FAE"><p><codeph>CArrayPakFlat&lt;Class
T&gt;</codeph>: an array of elements having varying lengths. It uses a flat array
buffer implemented by a <codeph>CBufFlat</codeph> object. The length value
of an element precedes the element itself within the array buffer. The array
object itself is allocated on the heap.</p> </li>
<li id="GUID-7B30A669-8BF5-5DDC-BDC2-2097C7631257"><p><codeph>RArray&lt;class
T&gt;</codeph>: a simple array of elements, all having the same length. The array
buffer is flat and is implemented by the array class as a simple piece of
linear memory. The array object itself can be constructed on the program stack.</p> </li>
</ul> </section>
<section id="GUID-3A99B95E-EF5D-4E7E-B545-7A9E1FE12C14"><title>General arrays of pointers</title> <p>There are three arrays
which can be used when the elements are <i>pointers</i> to <codeph>CBase</codeph> derived
objects. They allow type-safe access to <codeph>CBase</codeph> derived objects:</p> <ul>
<li id="GUID-F395B716-D47E-5915-834D-8B10C35BAC59"><p><codeph>CArrayPtrFlat&lt;class T&gt;</codeph>:
an array of pointers using a flat array buffer implemented by a <codeph>CBufFlat</codeph> object.
The array object itself is allocated on the heap.</p> </li>
<li id="GUID-ECE75F75-0178-5F00-8EE3-1B2BD162B764"><p><codeph>CArrayPtrSeg&lt;class T&gt;</codeph>:
an array of pointers using a segmented array buffer implemented by a <codeph>CBufSeg</codeph> object.
The array object itself is allocated on the heap.</p> </li>
<li id="GUID-F4AEDDAE-E8EA-571F-9089-BB736559FCE1"><p><codeph>RPointerArray&lt;class
T&gt;</codeph>: a simple array of pointers using a flat array buffer implemented
by the array class as a simple piece of linear memory. The array object itself
can be constructed on the program stack.</p> </li>
</ul> </section>
<section id="GUID-039B6556-C13A-4DFF-A1A7-D11A3702FE46"><title>Specialised arrays</title> <p>There are two specialised arrays
of <i>untyped</i> elements, all having the same length, which can be used
as data members of a base class in a thin template class/base class pair.
These classes are useful in situations where the type of elements forming
the array cannot be known in advance:</p> <ul>
<li id="GUID-2D1A46DD-FFA6-56FD-A0E4-9C4655B3B9C2"><p><codeph>CArrayFixFlat&lt;TAny&gt;</codeph>.
An array of untyped elements all having the same length. It uses a flat array
buffer implemented by a <codeph>CBufFlat</codeph> object.</p> </li>
<li id="GUID-CBF3264E-DE5C-5FA3-B953-CF6F14208EEB"><p><codeph>CArrayFixSeg&lt;TAny&gt;</codeph>.
An array of untyped elements all having the same length. It uses a segmented
array buffer implemented by a <codeph>CBufSeg</codeph> object.</p> </li>
</ul> <p>There are two specialised arrays of <i>untyped</i> elements, having
varying lengths, which can be used as data members of a base class in a thin
template class/base class pair. These classes are useful in situations where
the type of element forming the array is known only at the time the class
is created (i.e. at compile time):</p> <ul>
<li id="GUID-D689224C-F6F2-5A82-9A90-091663814F86"><p><codeph>CArrayVar&lt;TAny&gt;</codeph>.
An array of untyped elements with varying lengths.</p> </li>
<li id="GUID-5E2E9D37-65E8-5804-BD5B-6A37703C745B"><p><codeph>CArrayPak&lt;TAny&gt;</codeph>.
An array of packed (variable length) elements.</p> </li>
</ul> <p>There are two template specialisations of <codeph>RArray&lt;class
T&gt;</codeph>.</p> <ul>
<li id="GUID-A4F7D38C-7AE6-5E6B-A36F-1D70624C3E45"><p><codeph>RArray&lt;TInt&gt;</codeph>.
An array of signed integers</p> </li>
<li id="GUID-AB865DDB-5522-5A36-9DBB-BB0D535A9B9F"><p><codeph>RArray&lt;TUint&gt;</codeph>.
An array of signed integers.</p> </li>
</ul> </section>
</conbody></concept>