delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/05/12/13:22:37

Message-ID: <391C2047.57740096@home.com>
From: Robin Johnson <robbat2 AT home DOT com>
Organization: Orbit Computers
X-Mailer: Mozilla 4.7 [en] (Win98; U)
X-Accept-Language: en,af,es
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: Re: template error
References: <39190F26 DOT 609A37C8 AT home DOT com> <391C05F1 DOT 1AF32F2D AT gmx DOT de>
Lines: 56
Date: Fri, 12 May 2000 15:16:17 GMT
NNTP-Posting-Host: 24.113.36.103
X-Complaints-To: abuse AT home DOT net
X-Trace: news1.rdc1.bc.home.com 958144577 24.113.36.103 (Fri, 12 May 2000 08:16:17 PDT)
NNTP-Posting-Date: Fri, 12 May 2000 08:16:17 PDT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

I am currently writing a templated tree system that I need,
and it needs to be able to do traversal via a callback mechinism.

template<class tItem>
void traverse_pre(tNode<tItem> *tree,tCallBack<tItem> Visit)
{ if(!tree) return;
  Visit(tree);
  traverse_pre(tree->left);
  traverse_pre(tree->right);
}

Ole Reinartz wrote:
> 
> Robin Johnson wrote:
> 
> > I am getting an error that I am at a complete loss to explain...
> > The g++ FAQ mentions nothing like it, so I thought I'd ask just to be sure...
> >
> > Error: template declaration of `typedef void ( tCallBack)(struct tNode<tItem>
> > *&)'
> >
> > Code Segment:
> > template <class tItem>
> > struct tNode {
> >  tItem data;
> >  tNode *right, *left;
> > };
> >
> > template <class tItem>
> > typedef void tCallBack(tNode<tItem>* &node); //error here
> >
> 
> Hugh,
> What do you want to typef here to what? Is it possible that the 'typedef' is
> just wrong here?
> 
> Ole
> 
> >
> > ---
> > Robin Hugh Johnson
> > "Robbat2"
> > QTOD: "I used to be an idealist, but I got mugged by reality."
> > E-Mail     : robbat2 AT orbis-terrarum DOT net
> > ICQ#       : 30269588 or 41961639
> > Home Page  : http://www.orbis-terrarum.net
> > Time Zone  : Pacific Daylight (GMT - 8)

-- 
Robin Hugh Johnson
"Robbat2"
QTOD: "I used to be an idealist, but I got mugged by reality."
E-Mail     : robbat2 AT orbis-terrarum DOT net
ICQ#       : 30269588 or 41961639
Home Page  : http://www.orbis-terrarum.net
Time Zone  : Pacific Daylight (GMT - 8)

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019