Mail Archives: djgpp/2000/05/12/13:22:37
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 -