TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: ALL
from: ADAM MAJER
date: 1998-01-31 13:52:00
subject: Darn Templates

Could anyone explain those darn templates to me? I just started to learn
them and I got confused right at the start. Could anyone tell me what is
wrong with the following:
template 
class _EXPORT TLinkedList    (_EXPORT just expands to _export in a DLL
                                and huge otherwise
{
        private:
        TLinkedList *prev;
        TLinkedList *next;
        T *Struct;
    public:
        TLinkedList(){prev=NULL;next=NULL;Struct = new T};
        ~TLinkedList();
        BOOL Add();
        void Assign(T *s){hmemcpy(Struct,s,sizeof(T));};
        T* GetStruct(){return Struct;};
        TLinkedList *Next(){return next;};
        TLinkedList *Prev(){return prev;};
};
Then when I try to use that class I get more errors:
class Boo
{
        ....
        TLinkedList *List;     <- invalid use of tamplate !?!?!
};
Everything compiles right in the template but I get whole bunch of
errors and I try to use it (template). I wanted the T (the  in the
template class) to point to a structure which is later called from
another class. Any kind of help will be very appreciated. Thanx in
advance...
 * SLMR 2.1a * If this were an actual tagline, it would be funny.
--- FMail 0.92
---------------
* Origin: The Programmer's Oasis on FIDONET! (1:348/203)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.