我不断地发现以下错误:
utils.h:22:39: error: template argument 4 is invalid
utils.h:21:24: error: template argument 2 is invalid当我试图编译:
class Words {
map <string, *Words > synonyms;
map <string, map<string, *Words> > translations;
};我不太明白是什么使它成为一个无效的论点。错误箭头指向">“符号。这个类的目的是使用AVL TreeMaps构建一个字典。
发布于 2018-03-19 15:45:23
试试map<string, Words*>。
但是,您可能需要重新考虑使用简单的指针。
class Words
{
std::map<std::string, std::shared_ptr<Words>> synonyms;
std::map<std::string, std::map<std::string, std::shared_ptr<Words>>> translations;
};https://stackoverflow.com/questions/49366999
复制相似问题