I was implementing some code that required something like this
const auto concat = std::accumulate(ints.begin(), ints.end(), string{},
[](string& acc, const int& val) { return string(std::move(acc))+to_string(val);});
2 questions:
1) is it safe to move from acc?
2) is it faster(than having const string& acc
argument?
Aucun commentaire:
Enregistrer un commentaire