map<int,double,greater<int>>::iterator it=co.begin(); while(it!=co.end()){ if(it->second==0)co.erase(it); it++; } 不管删不删除,都是it++;