What are the good ways of finding the sum of all the elements in a std::vector
?
Suppose I have a vector std::vector<int> vector
with a few elements in it. Now I want to find the sum of all the elements. What are the different ways for the same?
What are the good ways of finding the sum of all the elements in a std::vector
?
Suppose I have a vector std::vector<int> vector
with a few elements in it. Now I want to find the sum of all the elements. What are the different ways for the same?