absl::c_inner_product

Container-based version of the <numeric> std::inner_product() function to compute the cumulative inner product of container element pairs.

Synopsis

Declared in <absl/algorithm/container.h>

template<
    typename Sequence1,
    typename Sequence2,
    typename T>
constexpr
std::decay_t<T>
c_inner_product(
    Sequence1 const& factors1,
    Sequence2 const& factors2,
    T&& sum);

Description

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.

Return Value

The computed inner product.

Parameters

NameDescription
factors1The first container of factors.
factors2The second container of factors.
sumThe initial value of the accumulation.