I have this code:
#include <iostream>
#include <vector>
#include <list>
using namespace std;
class Graph {
public:
//Create graph with n nodes
Graph(int size);
~Graph();
//Initialize graph
void InitializeGraphWithRandomNum();
private:
vector <list <int*> > *graph;
};
void Graph::InitializeGraphWithRandomNum() {
//Here I want to iterate
for (int i=0; i< graph->size(); i++) {
std::list <int*>::iterator it;
for (it = graph[i].begin(); it< graph[i].end();++it) {
..........
}
}
}
something wrong here. it says
No match for ‘operator=’ in ‘it = (((Graph*)this)->Graph::graph + ((unsigned int)(((unsigned int)i) * 12u)))->std::vector<_Tp, _Alloc>::begin with _Tp = std::list, _Alloc = std::allocator >, std::vector<_Tp, _Alloc>::iterator = __gnu_cxx::__normal_iterator*, std::vector > >, typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer = std::list*’ DejkstraAlg.cpp
Thank you Best