Overload of c_inner_product() for using binary operations other than operator+ (for computing the accumulation) and operator* (for computing the product between the two container's element pair).

Synopsis

Declared in <absl/algorithm/container.h>

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

Return Value

The computed inner product.

Parameters

Name

Description

factors1

The first container of factors.

factors2

The second container of factors.

sum

The initial value of the accumulation.

op1

The binary operation used to accumulate the products.

op2

The binary operation used to combine element pairs.

Created with MrDocs