Help me understand some code from a BST

tatteredpotato

Diamond Member
Jul 23, 2006
3,934
0
76
We've been going over Binary Search Trees in class, and we have an assignment to implement an address book with a BST. Our prof gave us the code for a BST, however there is one thing I'm unfamiliar with.


template <class KeyType, class DataType>
void BST<KeyType, DataType>::traverse(TraverseType traverseType, void (*visit)(KeyType, DataType))

or particularly:

void (*visit)(KeyType, DataType)

I'm just unsure as to how to interpret this line.
 

Cogman

Lifer
Sep 19, 2000
10,286
147
106
YIKES, your teacher should be shot for introducing that so soon. It is a function pointer, basically he wants you to write the traversal function for the bst.

But like I said, he should be shot for introducing it as it is completely uncalled for in this type of scenario
 

tatteredpotato

Diamond Member
Jul 23, 2006
3,934
0
76
Originally posted by: Cogman
YIKES, your teacher should be shot for introducing that so soon. It is a function pointer, basically he wants you to write the traversal function for the bst.

But like I said, he should be shot for introducing it as it is completely uncalled for in this type of scenario

Thanks for the help... I really mostly needed a name to put to the concept so I can do some research.