title: How to use iterator to iterate a 2D vector?
body: <p>all</p>
  
  <p>I am using vector in C++ STL to store my data. I pass and return them into and from functions. However, as the data size grows, the program is slower and slower. Thus I am updating the codes to an "iterator version".</p>
  
  <p>What I want to archieve is that <strong>use iterators to pass, return and iterate STL vectors</strong>. </p>
  
  <p>I am now ok with the operations with 1-dimensional vector, just like manipulating the arrays. However, when it comes to 2-dimensional vector, I am a bit confused.</p>
  
  <p>Can anyone show me <strong>a simple code example that how to iterate a 2D vector using STL iterator</strong>?</p>
  
  <p>Many thanks in advance.</p>
  
  <p>Regards</p>
  
  <p>Long</p>