I have tried to implement basic weighted graph with adjacency list by making a list< list< pair<int,int>>> that is list of lists with pair for destination and weight but i am getting error can

anyone help me . Here is my code its showing error in addEdges function.

#include<bits/stdc++.h>

#include < utility >

#include< list >

#define ll long long

using namespace std;

class Graph{

int V;

list< list< pair<int,int> > >* adjList;

public:

Graph(int v){

V=v;

adjList = new list< list< pair<int,int> > >[V];

}

```
void addEdge(int u, int v, int wt){
adjList[u].push_back(make_pair(v,wt));
adjList[v].push_back(make_pair(u,wt));
}
void printGraph(){
for(int i=0;i<V;i++){
cout<<"Node "<<i<<"=> ";
for(list< pair<int,int> > element: adjList[i]){
cout<<" ( "<<element.first<<" , "<<element.second<<" ) "<<" , ";
}
cout<<endl;
}
}
```

};

int main(){

Graph g(4);

g.addEdge(0,1,10);

g.addEdge(0,2,20);

g.addEdge(0,3,25);

g.addEdge(1,3,30);

g.addEdge(2,3,35);

g.printGraph();

return 0;

}