accumulate()
By default, adds the container elements to an initial value specified by the third argument. A binary operation can be passed in to override the default addition.
#include <numeric>
iresult = accumulate( ia, ia+8, 0);
iresult = accumulate( ilist.begin(), ilist.end(), 0, plus<int>() );
|