#include "stdafx.h"
#include<stdexcept>
#ifndef ToozyBinaryTreeHead
#define ToozyBinaryTreeHead
template <class T>
class ToozyBinaryTree{
public:
typedef bool (*findFunc)(typename const ToozyBinaryTree<T>::ToozyBinaryTreeNode*,const T*);
static const int LEFT = 1;
static const int RIGHT = 2;
struct ToozyBinaryTreeNode{
ToozyBinaryTreeNode *left;
ToozyBinaryTreeNode *right;
ToozyBinaryTreeNode *nextNode;
T value;
ToozyBinaryTreeNode(const T *v){
value = *v;
left = nullptr;
right = nullptr;
nextNode = nullptr;
}
};
findFunc findFunction;
ToozyBinaryTree(ToozyBinaryTreeNode *root);
ToozyBinaryTree(T *v);
~ToozyBinaryTree();
const ToozyBinaryTreeNode *find(const T *value) const;
const ToozyBinaryTreeNode *add(const ToozyBinaryTreeNode *parent,const T *value,int type);
const ToozyBinaryTreeNode *getRoot();
protected:
ToozyBinaryTreeNode* _root;
ToozyBinaryTreeNode* _lastNode;
};
这样子:
typedef bool (*findFunc)(typename const ToozyBinaryTree::ToozyBinaryTreeNode*,const T*);
应该怎么改?
typedef bool (*findFunc)(typename const ToozyBinaryTree::ToozyBinaryTreeNode*,const T*);
改为bool (*findFunc)(typename const ToozyBinaryTree::ToozyBinaryTreeNode*,const T*);
typedef的用法不是这样用的。去查查type的用法吧。
findFunc findFunction;这句多余了。去掉