I'm trying to make the Edge List class on c++. When I compile the code, I get a lot of errors, but I can not understand, what do I wrong?
struct vertex
{
double x,y;
};
class EdgeList
{
private:
std::map<vertex, vector<vertex>> graph_container;
public:
void add_vertex(const vertex& v) { //add a vertex to the map
graph_container.insert(pair<vertex,vector<vertex> >(v, vector<vertex>()));
}
//*
void add_edge(const vertex& v, const vertex& u) { //look up vertex in map
auto it = graph_container.find(v);
if (it != graph_container.end())
*it.push_back(u);
}
//*/
};
Aucun commentaire:
Enregistrer un commentaire