c++标准模板库algorithm头文件中accumulate算法的代码

template <typename T>
T algorithm(T* start, T* end, T total)//把[start, end)标记范围内所有元素累加到total中
{
    while (start != end)
    {
        total += *(start++);
    }
    return total;
}

原文地址:https://www.cnblogs.com/xjjsk/p/4923245.html