Week 23 contribution of PDK 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-FF0330E8-81CA-52F3-AD60-89360B74B25D" xml:lang="en"><title>Using
CArrayVar<TAny></title><shortdesc>The <codeph>CArrayVar<TAny></codeph> class is useful for constructing
an array of variable length buffers, where the length is decided at run time.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
<section id="GUID-763A4737-913B-417F-A9A6-CB1844EC64F6"><title>Arrays whose type is not known until class instantiation</title> <p>The <codeph>CArrayVar<TAny></codeph> class
is useful for constructing an array of variable length buffers, where the
length is decided at run time. It is also useful as a data member of a base
class in a thin template class/base class pair,where the type of the array
element is not known until the owning thin template class is instantiated.</p> <p>For
example, to implement a stack of variable length objects of type <codeph>T</codeph>.</p> <codeblock id="GUID-4478A571-F004-5015-9D35-DBEABFDBCFF1" xml:space="preserve">class CExampleBase : public CBase
{
public :
...
protected :
...
void PushL(const TAny* aPtr);
TAny* Pop();
private :
CArrayVar<TAny> iArray;
}</codeblock> <codeblock id="GUID-3EEED66E-A71A-597D-82B5-E2EAD5AC93CC" xml:space="preserve">template <class T>
class CExample : public CExampleBase
{
public :
...
inline void PushL(const T* aPtr);
inline T* Pop();
}</codeblock> </section>
</conbody></concept>