|
1 <?xml version="1.0" encoding="utf-8"?> |
|
2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. --> |
|
3 <!-- This component and the accompanying materials are made available under the terms of the License |
|
4 "Eclipse Public License v1.0" which accompanies this distribution, |
|
5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". --> |
|
6 <!-- Initial Contributors: |
|
7 Nokia Corporation - initial contribution. |
|
8 Contributors: |
|
9 --> |
|
10 <!DOCTYPE concept |
|
11 PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd"> |
|
12 <concept id="GUID-D1ADAF9A-62BD-5B68-980F-524FF440FEE1" xml:lang="en"><title>Using |
|
13 CArrayFixFlat<TAny></title><shortdesc>The <codeph>CArrayFixFlat<Tany></codeph> class is useful for |
|
14 constructing an array of fixed length buffers, where the length is decided |
|
15 at run time.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody> |
|
16 <section id="GUID-2AD32A65-729E-4C8C-B012-7CF5FC442EFE"><title>Arrays whose type is not known until class instantiation</title> <p>The <codeph>CArrayFixFlat<Tany></codeph> class |
|
17 is useful for constructing an array of fixed length buffers, where the length |
|
18 is decided at run time. It is also useful as a data member of a base class |
|
19 in a thin template class/base class pair where the type of the array element |
|
20 is not known until the owning thin template class is instantiated.</p> <p>For |
|
21 example, to implement a stack of fixed length objects of type <codeph>T</codeph>.</p> <codeblock id="GUID-86CBEBF4-FFE4-565B-A6A3-1BABE564205E" xml:space="preserve">class CExampleBase : public CBase |
|
22 { |
|
23 public : |
|
24 ... |
|
25 protected : |
|
26 ... |
|
27 void PushL(const TAny* aPtr); |
|
28 TAny* Pop(); |
|
29 private : |
|
30 CArrayFixFlat<TAny> iArray; |
|
31 }</codeblock> <codeblock id="GUID-8A4100C4-280F-5BDC-9C44-908C58C4EA92" xml:space="preserve">template <class T> |
|
32 class CExample : public CExampleBase |
|
33 { |
|
34 public : |
|
35 ... |
|
36 inline void PushL(const T* aPtr); |
|
37 inline T* Pop(); |
|
38 }</codeblock> </section> |
|
39 </conbody></concept> |