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 开发者_JAVA百科:)
This looks like it is in a template and VerticeType
etc. are template parameters. In that case you are missing typename
:
std::pair<typename ght::iterator, typename ght::iterator> ...
Dependent names are assumed to not name types unless typename
is used.
精彩评论