64,687
社区成员
发帖
与我相关
我的任务
分享
for (int i=0; i<100; i++) {
if (i < 5) tmpData[i] = tempData_vec[i];
else {
std::move(tmpData + 1, tmpData + 5, tmpData); // #include <algorithm>
tmpData[4] = tempData_vec[i];
}
}
求和的话
std::accumulate(tmpData_vec.begin(), tmpData_vec.end(), 0); // #include <numeric>