how to create an iterator for a vector pair

Hi, i have a vector pair, that I would like to create an iterator for so i can iterate through, but I cant seem to figure out how to create one, hoping some one could please help me out. code below.

Code of the vector pair
 
  vector<pair<int, int> >adj[]



Code I thought would work to create the iterator
 
std::vector<pair<int, int>>::iterator it(adj);
vector<pair<int, int> >adj[]

Not quite sure what's going on there; looks kind of like you're trying to make an array of vectors of pair.

Create a vecotr of pair<int, int>:
vector<pair<int, int>> adj;

Create an iterator into it:
auto it = adj.begin(); // Work with the language; use the features and functions it provides
yes sorry its a array too for a adjacency list. Thank you, I will try that
Topic archived. No new replies allowed.