pair<CDrug, pair<unsigned,double>> expirednull(pair<CDrug,
pair<unsigned,double>> temp){
if (temp.first.isValid() == false)
temp.second.first = 0;
return temp;
}
string checkForExpiredDrugs() {
stringstream s;
vector<CDealer>::iterator it1;
map<CDrug, pair<unsigned, double>> d;
map<CDrug, pair<unsigned, double>>::iterator it2;
//transform algorithm
for (it1 = this->m_dealers.begin(); it1 != this->m_dealers.end(); it1++) {
s << "Dealer: " << it1->getCompany() << " " << it1->getRepresentative() << " " << it1->getTelephone() << endl;
d = it1->getDrugs();
transform(d.begin(),d.end(),d.begin(),expirednull);
for (it2 = d.begin(); it2 != d.end(); it2++) {
if (it2->first.isValid() == false) {
it2->second.first = 0;
s << "Expired: " << it2->first << endl;
}
}
it1->setDrugs(d);
}
return s.str();
}
每當我運行它,它給了我下面的錯誤 - >變換算法給出了「二進制‘=’沒有運營商這需要左邊的操作數。」
錯誤7錯誤C2678:二進制「=」:沒有操作員發現這需要類型的左邊的操作數「const的CDrug」(或沒有可接受的轉化率)
我以爲這是一個*編譯*錯誤,而不是一個* *運行時錯誤。它指的是哪一行? –