*, Edge

Std :: pair expects a "type", but I give it a type

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 message:

error: type/value mismatch at argument 1 in template parameter list fortemplate<class _T1, class _T2> struct std::pair’
error:   expected a type, got ‘__gnu_cxx::hash_multimap::iterator’

But no, std :: hash_multimap :: type iterator? All the examples I've seen on the Internet use the same notation for the return type.std::hash_multimap<T1, T2>::equal_range(key)

Any help is appreciated. Thank:)

+3
source share
1 answer

It looks like a template VerticeType, etc. are the template options. In this case, you are missing typename:

std::pair<typename ght::iterator, typename ght::iterator> ...

Dependent names are considered not name types if not used typename.

+14
source

Source: https://habr.com/ru/post/1766219/


All Articles