equal
deleted
inserted
replaced
|
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-8C1DF426-C85B-5124-970D-96119491926F" xml:lang="en"><title>How to |
|
13 construct an iterator</title><shortdesc>An iterator allows you to access each element of the list in turn.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody> |
|
14 <p>To create an iterator for a singly linked list of <codeph>CMyClass</codeph> elements, |
|
15 defined as:</p> |
|
16 <codeblock id="GUID-AFE2C594-F211-52E6-9378-4327A6AFD667" xml:space="preserve">class CMyClass : public CBase |
|
17 { |
|
18 ... |
|
19 TSglQueLink iSlink; |
|
20 ... |
|
21 };</codeblock> |
|
22 <p>first construct a <xref href="GUID-2364CAB0-E19E-5EBB-837F-F6484642C2E4.dita">Header</xref>:</p> |
|
23 <codeblock id="GUID-9EE3B51E-75D0-5F2E-921B-695E3FB55672" xml:space="preserve">TSglQue<CMyClass> queHeader(_FOFF(CMyClass,iSlink));</codeblock> |
|
24 <p> and then construct the <xref href="GUID-82C53275-6F7C-5B3D-9A07-FA4801D42403.dita">Iterator</xref>. |
|
25 The iterator requires the header at construction time but the list can be |
|
26 empty:</p> |
|
27 <codeblock id="GUID-0E4BEBDA-2EF2-5D6C-84D8-1CE1BCCCF00D" xml:space="preserve">TSglQueIter<CMyClass> queIter(queHeader);</codeblock> |
|
28 <p>The <codeph>TSglQueIter</codeph> class takes a class template parameter |
|
29 that defines the type of object which is to form an element of the list.</p> |
|
30 </conbody></concept> |