0

Implementing class graph I need something like this

unordered_map <Node, list<unordered_set<Edge<Node>>::iterator>> graph; 

to store adjacency list for every vertex. However, it says that list<unordered_set<Edge<Node>>::iterator> is not valid parameter.
How should I implemant this?

here's error:

Error 2 error C2923: 'std::unordered_map' : 'std::list<std::unordered_set<Edge<Node>>>::iterator' is not a valid template type argument for parameter '_Ty'

I'm using VS2012 Express with standard compiler(which is c++11 compatible)

template<class Node>
class Graph {
}

template<class Node>
    class Edge {
}
4

1 回答 1

4

Since Node is a template parameter, you need to use typename when specifying a type that depends on it:

unordered_map <Node, list<typename unordered_set<Edge<Node>>::iterator>> graph;
                          ^^^^^^^^
于 2013-10-01T10:53:55.693 回答