使用带指针的迭代器时转换错误

时间:2016-05-28 08:48:26

标签: c++ pointers dictionary iterator

struct trie_node {
    char ch;
    std::unordered_map<char, trie_node*> children;
    trie_node() {
        ch = '\0';
    }
};
class Trie {
private:
    trie_node* trie_root;
public:
    Trie() {
        trie_root = new trie_node();
    }
    void insert_recursive(std::string str, trie_node* root, int len, int init) {
        if (len == 0) {
            return;
        }
        std::unordered_map<char, trie_node*>::iterator it;
        it = root->children.find(str[0]);
    }
};

我正在尝试使用迭代器但是当我指定root->children.find(str[0]);

时它会给我错误
  

“没有合适的转换函数来自”std :: _ List_iterator&gt;&gt;&gt;“to”std :: _ List_iterator&gt;&gt;&gt; *“存在”

如何解决此问题?

0 个答案:

没有答案