|
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-5875C752-12A9-5819-90D9-CAAE48F1A5C5" xml:lang="en"><title>Using |
|
13 CArrayFixSeg<TAny></title><shortdesc>The <codeph>CArrayFixSeg<TAny></codeph> is useful for constructing |
|
14 an array of fixed length buffers, where the length is decided at run time.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody> |
|
15 <section id="GUID-C0F44785-6E5F-447D-B1AC-F5187527D73F"><title>Arrays whose type is not known until class instantiation</title> <p>The <codeph>CArrayFixSeg<TAny></codeph> is |
|
16 useful for constructing an array of fixed length buffers, where the length |
|
17 is decided at run time. It is also useful as a data member of a base class |
|
18 in a thin template class/base class pair where the type of the array element |
|
19 is not known until the owning thin template class is instantiated.</p> <p>For |
|
20 example, to implement a stack of fixed length objects of type <codeph>T</codeph>.</p> <codeblock id="GUID-F707A19F-A9C0-5704-973B-11A0087F714D" xml:space="preserve">class CExampleBase : public CBase |
|
21 { |
|
22 public : |
|
23 ... |
|
24 protected : |
|
25 ... |
|
26 void PushL(const TAny* aPtr); |
|
27 TAny* Pop(); |
|
28 private : |
|
29 CArrayFixSeg<TAny> iArray; |
|
30 }</codeblock> <codeblock id="GUID-8DA14B1F-3771-56F8-9C15-4E1BB0AC68CE" xml:space="preserve">template <class T> |
|
31 class CExample : public CExampleBase |
|
32 { |
|
33 public : |
|
34 ... |
|
35 inline void PushL(const T* aPtr); |
|
36 inline T* Pop(); |
|
37 }</codeblock> </section> |
|
38 </conbody></concept> |