title: Accessing Each Node in a list that is an index in a vector
body: <p>I am currently making a hash table by using a private data member <code>vector&lt;list&lt;pair&lt;K, V&gt;&gt;&gt; hashTable;</code>.</p>
  <p>I need to access each list, and in turn, each pair for various different functions. I am currently doing so like:</p>
  <pre><code>for(int i = 0; i &lt; hashTable.capacity(); i++){
          list&lt;pair&lt;K,V&gt;&gt;* listPtr = hashTable[i];
  for(pair&lt;K,V&gt;* pairPtr = listPtr-&gt;front(); pairPtr != listPtr-&gt;end(); pairPtr++){
                  pair&lt;K,V&gt; tempPair;
                  tempPair.first = pairPtr-&gt;first;
                  tempPair.second = pairPtr-&gt;second;
                  insert(tempPair);
              }
          }
  }
  </code></pre>
  <p>The code above is part of my rehash function. Insert inserts the pair based on the hash functions which hashes based on the size of the vector. It's not really important. I just want to know how to get to each list and then each pair.</p>
  <p>My question is, is there a better way to access each list and pair in the vector?</p>