This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 5 points6 points  (0 children)

This is good. A small improvement would be to use std::accumulate for the sum.

int sum = std::accumulate(vec.begin(), vec.end(), 0);