Symbian3/SDK/Source/GUID-63C60154-2A50-5A39-A188-515A607F498B.dita
author Dominic Pinkman <dominic.pinkman@nokia.com>
Fri, 11 Jun 2010 12:39:03 +0100
changeset 8 ae94777fff8f
parent 7 51a74ef9ed63
child 13 48780e181b38
permissions -rw-r--r--
Week 23 contribution of SDK documentation content. See release notes for details. Fixes bugs Bug 2714, Bug 462.

<?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-63C60154-2A50-5A39-A188-515A607F498B" xml:lang="en"><title>Array
of same length elements, flat buffer</title><shortdesc>Describes how elements are organised within the array buffer.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
<p>This can be either an <codeph>RArray&lt;class T&gt;</codeph> or a <codeph>CArrayFixFlat&lt;class T&gt;</codeph> object.</p>
<p>In both arrays, all elements:</p>
<ul>
<li id="GUID-9A6138C3-BBB5-5D8E-B0CB-9E51E1B2C59C"><p>have the same length.</p> </li>
<li id="GUID-A68AD60D-1077-5425-869C-619EDC70F4DF"><p>are physically contiguous
within a flat array buffer. The length of an element is the size of the template
class.</p> </li>
</ul>
<p>A flat buffer always occupies a single cell allocated from the heap and
is always extended by the process of reallocation.</p>
<p>The following diagram illustrates how elements are organised within the
array buffer:</p>
<fig id="GUID-7E9AF455-9CC4-5814-A746-36A94585488F">
<image href="GUID-516D2E22-F5C0-56FE-ABDA-948F01CD50DB_d0e215568_href.png" placement="inline"/>
</fig>
<p>This kind of array is suitable for a small number of elements or for a
moderately large but fixed maximum number of elements. It is not suitable
for large arrays with a high turnover of elements.</p>
<p>The <codeph>RArray&lt;class T&gt;</codeph> array has the simpler and
more efficient implementation but the length of an element is limited to 640
bytes. This array can also be constructed on te program stack.</p>
<p>The <codeph>CArrayFixFlat&lt;class T&gt;</codeph> array is more general
and is allocated on the heap. This class is immediately derived from the abstract
templated base class <codeph>CArrayFix&lt;class T&gt;</codeph> which is
itself derived from the abstract non-template base class <codeph>CArrayFixBase</codeph>.
Its array buffer is implemented using a <codeph>CBufFlat</codeph> object.</p>
<section id="GUID-AED136DE-81CB-4247-ADF7-283C6061D4D9"><title>See also</title> <p><xref href="GUID-112AAFA5-B4C9-5B62-A106-FB5097C13A0E.dita">Using
Dynamic Buffers </xref>.</p> </section>
</conbody></concept>