Dmitry S.
Dmitry S.

Reputation: 23

List of iterators

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 {
}

Upvotes: 0

Views: 1540

Answers (1)

Mike Seymour
Mike Seymour

Reputation: 254461

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;
                          ^^^^^^^^

Upvotes: 4

Related Questions