expirednull(pair>-6ren">
gpt4 book ai didi

c++ - 转换算法给出 "binary ' =' no operator which takes left-hand operand.."

转载 作者:行者123 更新时间:2023-11-28 02:26:17 25 4
gpt4 key购买 nike

<分区>

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();
}

每当我运行该程序时,都会出现以下错误 ->

Error 7 error C2678: binary '=' : no operator found which takes a left-hand operand of type 'const CDrug' (or there is no acceptable conversion)

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com