title: hashtable,unorderd_map iterator usage
body: <p>I hope someone familiar with <a href="http://www.cplusplus.com/reference/unordered_map/unordered_map/" rel="nofollow">unorderd_map</a> can give me a best answer to my problem. </p>
  
  <p>am trying to access a values stored on an <a href="http://www.cplusplus.com/reference/unordered_map/unordered_map/" rel="nofollow">unorderd_map</a> using iterator,but am stuck with the following error.</p>
  
  <pre><code>error: assignment of data-member ‘mystruct::time_diff’ in read-only structure
  </code></pre>
  
  <p>The following is sample of my code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;unordered_map&gt;
  #include &lt;vector&gt;
  using namespace std;
  struct mystruct
  {
       string str_name;
       time_t my_last_time;
       int time_diff;
  };
  
  int main()
  {
      unordered_map&lt;int,mystruct&gt;hash_table;
      //filling my hash table
      for(int i=0;i&lt;10;i++)
      {
        mystruct myst;
        myst.str_name="my string";
        myst.my_last_time=time(0);
        myst.time_diff=0;
        hash_table.insert(make_pair(i,myst));
      }
     //now, i want to access values of my hash_table with iterator.
     unordered_map&lt;int,mystruct&gt;::const_iterator itr=hash_table.begin();
  
    for (itr = hash_table.begin(); itr != hash_table.end(); itr++ )
    {
       time_t now=time(0);//pick current time 
       itr-&gt;second.time_diff=now-itr-&gt;second.my_last_time;//here is where my  error comes from
    }
    return 0;
  }
  </code></pre>
  
  <p>so, when compile get an error:</p>
  
  <pre><code>error: assignment of data-member ‘mystruct::time_diff’ in read-only structure
  </code></pre>