How to construct an iterator

This document describes how to create an iterator for a doubly linked list.

To create an iterator for a doubly linked list of CMyClass elements, defined as:

      class CMyClass : public CBase
    TDblQueLink iDlink;

first construct a header:

      TDblQue<CMyClass> queHeader(_FOFF(CMyClass,iDlink));

and then construct the iterator. The iterator requires the header at construction time but the list can be empty:

      TDblQueIter<CMyClass> queIter(queHeader);

The TDblQueIter class takes a class template parameter that defines the type of object which is to form an element of the list.