title: Update map which is read-only object using c++
body: <pre><code>void value_multi(const map&lt;string, double&gt;&amp; myMap, string target,double alva) {
  
      double res = 0;
      map&lt;string, double&gt;::const_iterator iter = myMap.begin();
      for(; iter!=myMap.end(); ++iter) {
          string key = iter-&gt;first;
          vector&lt;string&gt; strs;
          boost::split(strs,key, boost::is_any_of("|"));
  
          if(strs[0] == target) { //if target == string value
              //res += iter-&gt;second;
              double tmp=iter-&gt;second*alva; // set tmp
              iter-&gt;second=tmp;  //update value
          }
      }
  
      //return res;
  }
  </code></pre>
  
  <p>I want to update a value using method like code ,but it shows some message after compile</p>
  
  <pre><code>[Error] assignment of member 'std::pair&lt;const std::basic_string&lt;char&gt;, double&gt;::second' in read-only object
  </code></pre>
  
  <p>Is that any easy and quick way to change my code that will easy update the <code>iter-&gt;second</code> value</p>