Container-based version of the <numeric> std::accumulate() function to accumulate the element values of a container to init and return that accumulation by value.
Declared in <absl/algorithm/container.h>
template<
typename Sequence,
typename T>
constexpr
std::decay_t<T>
c_accumulate(
Sequence const& sequence,
T&& init);
Note: Due to a language technicality this function has return type std::decay_t<T>. As a user of this function you can casually read this as "returns T by value" and assume it does the right thing.
The accumulated result.
| Name | Description |
|---|---|
| sequence | The container whose elements to accumulate. |
| init | The initial value of the accumulation. |