我对二叉树有以下问题:
....
template
class BinaryTree
{
private:
template
struct Node
{
T value;
Node* left;
Node* right;
};
private:
Node* root;
std::stack<Node<T>const *> stack;
stack.push(root);
while(false == stack.empty())
{
Node<T>* node = stack.pop();
this->visited(node->value);
之后,当我尝试实现呼吸优先搜索时:模板类 BinaryTree { private: template struct Node { T value; 左节点*;节点* 对;}; 私人:节点*根;
std::stack<Node<T>const *> stack;
stack.push(root);
while(false == stack.empty())
{
Node<T>* node = stack.pop();
this->visited(node->value);
我收到一个错误:
错误 4 错误 C2440: 'initializing' : 无法从 'void' 转换为 'BinaryTree::Node *' c:\users\stephan\documents\visual studio 2012\projects\graphs\binarytree\binarytree.cpp 152 1 BinaryTree