std::pair 期待一个“类型”,但我给它一个类型
这是我的代码:
typedef std::hash_multimap<Vertice<VerticeType, WeightType>*, Edge<VerticeType, WeightType>*> ght;
std::pair<ght::iterator, ght::iterator> getEdgesFromVertice(Vertice<VerticeType, WeightType>*);
当我尝试编译它时,它给了我一个错误:
error: type/value mismatch at argument 1 in template parameter list for ‘template<class _T1, class _T2> struct std::pair’
error: expected a type, got ‘__gnu_cxx::hash_multimap::iterator’
但是 std::hash_multimap::iterator 不是一个类型吗?我在网上看到的所有示例都对 std::hash_multimap
返回类型使用相同的表示法,
感谢任何帮助。谢谢 :)
This is my code:
typedef std::hash_multimap<Vertice<VerticeType, WeightType>*, Edge<VerticeType, WeightType>*> ght;
std::pair<ght::iterator, ght::iterator> getEdgesFromVertice(Vertice<VerticeType, WeightType>*);
When I try to compile it, it gives me an error saying:
error: type/value mismatch at argument 1 in template parameter list for ‘template<class _T1, class _T2> struct std::pair’
error: expected a type, got ‘__gnu_cxx::hash_multimap::iterator’
But isn't, std::hash_multimap::iterator a type? All the examples I've seen online use the same kind of notation for the return type of std::hash_multimap<T1, T2>::equal_range(key)
Any help is appreciated. Thanks :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这看起来像是在模板中,而
VerticeType
等是模板参数。在这种情况下,您缺少typename
:从属名称假定为 不命名类型,除非使用
typename
。This looks like it is in a template and
VerticeType
etc. are template parameters. In that case you are missingtypename
:Dependent names are assumed to not name types unless
typename
is used.