TSglQue<class T>
To manage a singly linked list of CAnyClass
objects,
create a TSglQue
object:
TSglQue<CAnyClass> queHeader(_FOFF(CAnyClass,iLink));
In this code fragment, queHeader
is the header for a
singly linked list of CAnyClass
elements. The offset of the link
object from the beginning of CAnyClass
is calculated using the
_FOFF
macro.
The CAnyClass
class contains a declaration for the
link object at a suitable point.
class CAnyClass : CBase
{
//... class members
TSglQueLink iLink;
//... class members
};
The offset value is normally set on construction of the singly linked list header using the appropriate constructor. Alternatively, the default constructor may be used and then followed by a call to SetOffset():
TSglQue<CAnyClass> queHeader;
...
queHeader.SetOffset(_FOFF(CAnyClass,iLink));
If this technique is used, then the offset value must be set before any elements are added to the list.