• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Help me understand some code from a BST

tatteredpotato

Diamond Member
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.
 
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
 
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.
 
Back
Top