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