Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

第8.1节课的test_expression.cpp问题 #15

Open
Zgh20060114 opened this issue Apr 19, 2024 · 0 comments
Open

第8.1节课的test_expression.cpp问题 #15

Zgh20060114 opened this issue Apr 19, 2024 · 0 comments

Comments

@Zgh20060114
Copy link

up大佬你好,在8.1节课的代码中:
static void ShowNodes(const std::shared_ptr<kuiper_infer::TokenNode> &node) {
if (!node) {
return;
}
// 中序遍历的顺序
ShowNodes(node->left);
if (node->num_index < 0) {
if (node->num_index == -int(kuiper_infer::TokenType::TokenAdd)) {
LOG(INFO) << "ADD";
} else if (node->num_index == -int(kuiper_infer::TokenType::TokenMul)) {
LOG(INFO) << "MUL";
}
} else {
LOG(INFO) << "NUM: " << node->num_index;
}
ShowNodes(node->right);
}

TEST(test_expression, expression1) {
using namespace kuiper_infer;
const std::string &statement = "add(@1,@2)";
ExpressionParser parser(statement);
const auto &node_tokens = parser.Generate();
ShowNodes(node_tokens);
}

}
这里node_tokens的类型std::vector<std::shared_ptr>
而ShowNodes()接收的参数类型是std::shared_ptr<kuiper_infer::TokenNode>
所以会报错:No matching function for call to 'ShowNodes'
但是为啥up在b站视频里是对的呀,求教求教,感谢感谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant