Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
<?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-8C1DF426-C85B-5124-970D-96119491926F" xml:lang="en"><title>How to
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>
<p>To create an iterator for a singly linked list of <codeph>CMyClass</codeph> elements,
defined as:</p>
<codeblock id="GUID-AFE2C594-F211-52E6-9378-4327A6AFD667" xml:space="preserve">class CMyClass : public CBase
{
...
TSglQueLink iSlink;
...
};</codeblock>
<p>first construct a <xref href="GUID-2364CAB0-E19E-5EBB-837F-F6484642C2E4.dita">Header</xref>:</p>
<codeblock id="GUID-9EE3B51E-75D0-5F2E-921B-695E3FB55672" xml:space="preserve">TSglQue<CMyClass> queHeader(_FOFF(CMyClass,iSlink));</codeblock>
<p> and then construct the <xref href="GUID-82C53275-6F7C-5B3D-9A07-FA4801D42403.dita">Iterator</xref>.
The iterator requires the header at construction time but the list can be
empty:</p>
<codeblock id="GUID-0E4BEBDA-2EF2-5D6C-84D8-1CE1BCCCF00D" xml:space="preserve">TSglQueIter<CMyClass> queIter(queHeader);</codeblock>
<p>The <codeph>TSglQueIter</codeph> class takes a class template parameter
that defines the type of object which is to form an element of the list.</p>
</conbody></concept>