我有一个课要用在trie上
class Node {
public:
map<char,Node*> node;
bool flag = false;
};
int main(){
Node table;
for(auto x: table){}
return 0;
}
我试着遍历它的元素,但是我总是得到错误
我检查了stack中的解决方案,并尝试使用迭代器映射方法:
error: 'class Node' has no member named 'begin'
for (it = table->begin(); it != table->end(); it++){
^~~~~
error: 'class Node' has no member named 'end'
for (it = table->begin(); it != table->end(); it++){
也尝试使用for循环,得到了类似的错误:
error: 'begin' was not declared in this scope
for(auto x: table){
^~~~
如何以另一种方式迭代元素,或者如何修复这些错误?
另外,在您展示给我们的代码中,