title: Passing iterator by reference gives an error: cannot convert parameter 1 from 'const data' to 'data &
body: <p>I have a function <code>int func(data&amp; dt)</code>.
  It<code>s need to use the list of structures</code>lst<code>. It</code>s proposed that map and list has some elements (but in my example it has one element). I have to iterate through list and push each element into the <code>func</code> function by reference.</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;map&gt;
  #include &lt;algorithm&gt;
  #include &lt;list&gt;
  #include &lt;string&gt;
  
  typedef struct{
      char inf[3];
  }data;
  
  std::map&lt;int, data*&gt; mp;
  std::list&lt;data&gt; lst;
  
  int func(data&amp; dt){
  
      ...
  }
  
  int main(){
  
       ...
      //iterate through list
      std::list&lt;data&gt;::const_iterator iterator;
  
      for (iterator = lst.begin(); iterator != lst.end(); ++iterator) {
          data param = *iterator;
          func(param); 
          //func(*iterator); // doesn`t work!
      }
  
      return 0;
  }
  </code></pre>
  
  <p>The problem is: <code>func</code> doesn<code>t work with *iterator. Why should I do this:</code>data param = *iterator` to make it work? 
  Thank you for help!</p>