Message-ID: <36C8A212.2450C0CB@bignet.net> From: John Soares X-Mailer: Mozilla 4.5 [en] (Win95; I) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.os.msdos.djgpp Subject: Displaying binsrch tree contents Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 135 NNTP-Posting-Host: 206.67.96.88 X-Trace: news5.ispnews.com 919107633 206.67.96.88 (Mon, 15 Feb 1999 14:40:33 EDT) NNTP-Posting-Date: Mon, 15 Feb 1999 14:40:33 EDT Organization: ISPNews http://ispnews.com Date: Mon, 15 Feb 1999 14:39:14 -0800 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com I am using templates to manipulate different kinds of tree data. For my project, I have an employee info tree and a project info tree. I am able to insert and retrieve from each tree with no problems. When I did projects that required only one tree, I used to be able to display the contents of each node by simply pointing to a display function. Now it seems I cannot do this, but I'm probably just missing something. Here is my code: //implementation file..this function has worked fine before I used templates template void treeNode::PreorderTraverse(functionType Visit) { Preorder(Root, Visit); } template void treeNode::Preorder(ptrType TreePtr, functionType Visit) { if (TreePtr != NULL) { Visit(TreePtr->Item); Preorder(TreePtr->LChildPtr, Visit); Preorder(TreePtr->RChildPtr, Visit); } } //driver file //I simply want to display each employee with all his information..employee number, //name, skills, etc. and then compare employee skills with each project and the skills //it requires void EmpTree_Display(treeNode & e) { cout << endl << "here is employee nbr: " << e << endl; } void assn_emp_to_project(treeNode employee_tree, treeNode project_tree) { //assuming that employee must have all skills the project calls for //Have to get to the first project in the tree..also the first //employee. Then traverse project tree until done or you find a project //for employee. cout << "into assn emp"; employee emp; employee_tree.RootData(); employee_tree.PreorderTraverse(&EmpTree_Display); exit(0); return; } When I try to compile the program, I get these syntax errors: 121p4drv.cpp: In function `void EmpTree_Display(class treeNode &)': 121p4drv.cpp:304: no match for `ostream & << treeNode &' C:\\EGCS\\BIN\\..\\lib\\gcc-lib\\i386-mingw32\\egcs-2.91.60\\..\\..\\..\\..\\include\\g++\\iostream.h:77: candidates are: ostream::operator <<(char) C:\\EGCS\\BIN\\..\\lib\\gcc-lib\\i386-mingw32\\egcs-2.91.60\\..\\..\\..\\..\\include\\g++\\iostream.h:78: ostream::operator <<(unsigned char) C:\\EGCS\\BIN\\..\\lib\\gcc-lib\\i386-mingw32\\egcs-2.91.60\\..\\..\\..\\..\\include\\g++\\iostream.h:79: ostream::operator <<(signed char) C:\\EGCS\\BIN\\..\\lib\\gcc-lib\\i386-mingw32\\egcs-2.91.60\\..\\..\\..\\..\\include\\g++\\iostream.h:80: ostream::operator <<(const char *) C:\\EGCS\\BIN\\..\\lib\\gcc-lib\\i386-mingw32\\egcs-2.91.60\\..\\..\\..\\..\\include\\g++\\iostream.h:82: ostream::operator <<(const unsigned char *) C:\\EGCS\\BIN\\..\\lib\\gcc-lib\\i386-mingw32\\egcs-2.91.60\\..\\..\\..\\..\\include\\g++\\iostream.h:84: ostream::operator <<(const signed char *) C:\\EGCS\\BIN\\..\\lib\\gcc-lib\\i386-mingw32\\egcs-2.91.60\\..\\..\\..\\..\\include\\g++\\iostream.h:85: ostream::operator <<(const void *) C:\\EGCS\\BIN\\..\\lib\\gcc-lib\\i386-mingw32\\egcs-2.91.60\\..\\..\\..\\..\\include\\g++\\iostream.h:86: ostream::operator <<(int) C:\\EGCS\\BIN\\..\\lib\\gcc-lib\\i386-mingw32\\egcs-2.91.60\\..\\..\\..\\..\\include\\g++\\iostream.h:87: ostream::operator <<(unsigned int) C:\\EGCS\\BIN\\..\\lib\\gcc-lib\\i386-mingw32\\egcs-2.91.60\\..\\..\\..\\..\\include\\g++\\iostream.h:88: ostream::operator <<(long int) C:\\EGCS\\BIN\\..\\lib\\gcc-lib\\i386-mingw32\\egcs-2.91.60\\..\\..\\..\\..\\include\\g++\\iostream.h:89: ostream::operator <<(long unsigned int) C:\\EGCS\\BIN\\..\\lib\\gcc-lib\\i386-mingw32\\egcs-2.91.60\\..\\..\\..\\..\\include\\g++\\iostream.h:91: ostream::operator <<(long long int) C:\\EGCS\\BIN\\..\\lib\\gcc-lib\\i386-mingw32\\egcs-2.91.60\\..\\..\\..\\..\\include\\g++\\iostream.h:92: ostream::operator <<(long long unsigned int) C:\\EGCS\\BIN\\..\\lib\\gcc-lib\\i386-mingw32\\egcs-2.91.60\\..\\..\\..\\..\\include\\g++\\iostream.h:94: ostream::operator <<(short int) C:\\EGCS\\BIN\\..\\lib\\gcc-lib\\i386-mingw32\\egcs-2.91.60\\..\\..\\..\\..\\include\\g++\\iostream.h:95: ostream::operator <<(short unsigned int) C:\\EGCS\\BIN\\..\\lib\\gcc-lib\\i386-mingw32\\egcs-2.91.60\\..\\..\\..\\..\\include\\g++\\iostream.h:97: ostream::operator <<(bool) C:\\EGCS\\BIN\\..\\lib\\gcc-lib\\i386-mingw32\\egcs-2.91.60\\..\\..\\..\\..\\include\\g++\\iostream.h:99: ostream::operator <<(double) C:\\EGCS\\BIN\\..\\lib\\gcc-lib\\i386-mingw32\\egcs-2.91.60\\..\\..\\..\\..\\include\\g++\\iostream.h:100: ostream::operator <<(float) C:\\EGCS\\BIN\\..\\lib\\gcc-lib\\i386-mingw32\\egcs-2.91.60\\..\\..\\..\\..\\include\\g++\\iostream.h:104: ostream::operator <<(long double) C:\\EGCS\\BIN\\..\\lib\\gcc-lib\\i386-mingw32\\egcs-2.91.60\\..\\..\\..\\..\\include\\g++\\iostream.h:106: ostream::operator <<(ostream & (*)(ostream &)) C:\\EGCS\\BIN\\..\\lib\\gcc-lib\\i386-mingw32\\egcs-2.91.60\\..\\..\\..\\..\\include\\g++\\iostream.h:107: ostream::operator <<(ios & (*)(ios &)) C:\\EGCS\\BIN\\..\\lib\\gcc-lib\\i386-mingw32\\egcs-2.91.60\\..\\..\\..\\..\\include\\g++\\iostream.h:108: ostream::operator <<(streambuf *) 121p4drv.cpp: In function `void assn_emp_to_project(class treeNode, class treeNode)': 121p4drv.cpp:319: no matching function for call to `treeNode::PreorderTraverse (void (*)(treeNode &))' 121-P4~1.cpp:153: candidates are: treeNode::PreorderTraverse(void (*)(employee &)) /////////// Does anything jump out at anyone that I am doing wrong here? This used to work with just a single tree, but now that I am using templates, it does not. Any hints appreciated. John