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?
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…