0
如何擴展以下代碼以收集全部entry.score
而不只是保留最新的代碼?如何在不復制的情況下更新std :: unordered_map <std :: string,std :: vector <int>>中的向量?
我現在所擁有的代碼是:
std::unordered_map<std::string, float> container;
int main() {
// some code
for (auto entry : entries)
container[entry.name] = entry.score;
}
如何延長它讓所有entry.score
同時避免副本?:
std::unordered_map<std::string, std::vector<float>> container;
//vectors need to be updated using .push_back(entry.score)
int main() {
// some code
for (auto entry : entries)
container[entry.name] = ; //missing connection
}