这是我的代码:
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<T1, T2>::equal_range(key)
感谢任何帮助。谢谢:))
答案 0 :(得分:14)
这看起来像是在模板中,VerticeType
等是模板参数。在这种情况下,您缺少typename
:
std::pair<typename ght::iterator, typename ght::iterator> ...
除非使用typename
,否则依赖名称将被假定为not name types。