how to use “iterator” for call by reference?
<p>I have defined a dynamic memory as * indexs (vector of vector) to store set of values. Then, I appended this memory. Afterthat, I want to get a print of these values. For that I am using another function as follows. For that function, I am calling above values by references. I don’t know proper way to use iterator to print those values.
Here is my piece of codes and the error I got for that.</p>

<pre><code>vector&lt; vector&lt;unsigned int&gt; &gt;* indexs = new vector&lt; vector&lt;unsigned int&gt; &gt;(9); 
for( ){       //finish data adding into indexs      } 
calcParameter(*indexs); //call function 
void myclass::calcParameter(vector&lt; vector&lt;unsigned int&gt; &gt;const &amp;indexs){ 
    vector&lt; vector&lt;unsigned int&gt; &gt; :: iterator cell_i; 
    for (cell_i=indexs-&gt;begin(); cell_i != indexs-&gt;end();cell_i++){ //this is line 305 in my program
        vector&lt;unsigned int&gt; :: iterator pij; 
        for (pij=cell_i-&gt;begin(); pij =! cell_i-&gt;end(); pij++){ 
            cout&lt;&lt;"  "&lt;&lt;*pij; 
       } 
       cout&lt;&lt;endl; 
   } 
} 

error message: 305-base operand of `-&gt;' has non-pointer type `const 
std::vector&lt;std::vector&lt;unsigned int, std::allocator&lt;unsigned int&gt; &gt;, 
std::allocator&lt;std::vector&lt;unsigned int, std::allocator&lt;unsigned int&gt; &gt; &gt; &gt;' 
</code></pre>

<p>when I use simple for loop to get that, It works but I want to learn how to use iterator for this.</p>

<pre><code>void myclass::calcParameter(vector&lt; vector&lt;unsigned int&gt; &gt;const &amp;indexs){ 
   for (int i=0; i&lt;indexs.size(); i++){   

        for (int j=0; j&lt; indexs[i].size(); j++){ 

            cout&lt;&lt;"  "&lt;&lt;indexs[i][j]; 
       } 
       cout&lt;&lt;endl; 
   } 
}
</code></pre>

<p>Any help please..</p>
