Path: chuka.playstation.co.uk!scea!peter_alau@playstation.sony.com From: "Steve Spiller" Newsgroups: scea.yaroze.freetalk Subject: Re: Net Yaroze C++ Examples Date: Fri, 28 May 1999 09:44:32 -0700 Organization: SCEA News Server Lines: 31 Message-ID: <7imgt2$3vd2@scea> References: <374c6512.1232873@news.scea.sony.com> <374E06E4.5D701DDC@identicalsoftware.com> <37505449.1115333@news.playstation.co.uk> NNTP-Posting-Host: tide70.microsoft.com X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2314.1300 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 Daniel Hartmeier wrote in message news:37505449.1115333@news.playstation.co.uk... > > If you want doubly-linked lists for different data types (like > background tiles, enemies or levels) for instance, you'll really > appreciate templates (even though you have to write them yourself, as > there is no standard template library ;-) Just do it the old fashioned way! typedef enum { ntTile, ntEnemy, ntLevel } NODETYPE; typedef struct _tagNode { NODETYPE nNodeType; void *pItem; struct _tagNode *pNext; } NODE, *LPNODE; Then you just create structures for holding all your different node types and when you walk down the list you cast the void pointer to whatever type the nNodeType indicates. Voila! Generic linked list in C. :) -Steve