【发布时间】:2012-05-05 16:05:09
【问题描述】:
我在测试中有以下数据:
2011-01-03 2116
2011-01-03 2120
2011-01-04 2116
2011-01-04 2115
以及以下代码:
std::map<std::string, std::vector<double> >::iterator tk = test.begin();
std::vector<double>tmp;
std::copy(tk->second.begin(), tk->second.end(), std::back_inserter(tmp));
上面的代码tmp包含:
2116
2120
2116
2115
但是,我想将每个日期的tk->second 平均值插入tmp。我必须将我的 back_inserter 写入循环吗?
【问题讨论】: