In accordance to Standard Tree documentation, API allows following iteration methods:
Whenever a node is visited, a visit method of TreeNodeVisitor instance, already provided to function as argument, is executed. If it returns true iteration continues, otherwise it stops. Since TreeNodeVisitor is an interface, end users will need to provide an implementation for it.
Function that implements pre-order Standard Tree iteration from start node
template <typename T, int (*compare)(const T&, const T&) = comparator<T>, std::size_t (*hash)(const T&) = hash<T>>
inline void PreOrderTreeIterator(TreeNode<T,compare,hash>* const& node, TreeNodeVisitor<T>* const& visitor)
Function that implements post-order Standard Tree iteration from start node
template <typename T, int (*compare)(const T&, const T&) = comparator<T>, std::size_t (*hash)(const T&) = hash<T>>
inline void PostOrderTreeIterator(TreeNode<T,compare,hash>* const& node, TreeNodeVisitor<T>* const& visitor)
Function that implements level-order Standard Tree iteration from start node with limitless depth
template <typename T, int (*compare)(const T&, const T&) = comparator<T>, std::size_t (*hash)(const T&) = hash<T>>
inline void LevelOrderTreeIterator(TreeNode<T,compare,hash>* const& root, TreeNodeVisitor<T>* const& visitor)
Function that implements level-order Standard Tree iteration from start node with limited depth
template <typename T, int (*compare)(const T&, const T&) = comparator<T>, std::size_t (*hash)(const T&) = hash<T>>
inline void LevelOrderTreeIterator(TreeNode<T,compare,hash>* const& root, std::size_t depth, TreeNodeVisitor<T>* const& visitor)
Interface that defines prototype of a node visitor while Standard Tree iteration is performed
template <typename T, int (*compare)(const T&, const T&) = comparator<T>, std::size_t (*hash)(const T&) = hash<T>>
class TreeNodeVisitor
| Method | Signature | Description |
| ~TreeNodeVisitor | virtual ~TreeNodeVisitor () | Deallocates internals from heap memory |
| visit | virtual bool visit (TreeNode<T,compare,hash>* const& element) = 0 | Visits a node during iteration. If false is returned, iteration stops! |