Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext
inner_product
Prototype

template<class SinglePassRange1,
         class SinglePassRange2,
         class Value>
    Value inner_product( const SinglePassRange1& rng1,
                         const SinglePassRange2& rng2,
                         Value                   init );

template<class SinglePassRange1,
         class SinglePassRange2,
         class Value,
         class BinaryOperation1,
         class BinaryOperation2>
    Value inner_product( const SinglePassRange1& rng1,
                         const SinglePassRange2& rng2,
                         Value                   init,
                         BinaryOperation1        op1,
                         BinaryOperation2        op2 );

Description

inner_product calculates a generalised inner product of the range rng1 and rng2.

For further information on the inner_product algorithm please see inner_product.

Definition

Defined in the header file boost/range/numeric.hpp

Requirements
For the first version
  1. SinglePassRange1 is a model of the Single Pass Range Concept.
  2. SinglePassRange2 is a model of the Single Pass Range Concept.
  3. Value is a model of the AssignableConcept.
  4. If x is an object of type Value, y is an object of SinglePassRange1's value type, and z is an object of SinglePassRange2's value type, then x + y * z is defined.
  5. The result type of the expression x + y * z is convertible to Value.
For the second version
  1. SinglePassRange1 is a model of the Single Pass Range Concept.
  2. SinglePassRange2 is a model of the Single Pass Range Concept.
  3. Value is a model of the AssignableConcept.
  4. BinaryOperation1 is a model of the BinaryFunctionConcept.
  5. BinaryOperation2 is a model of the BinaryFunctionConcept.
  6. The value type of SinglePassRange1 is convertible to the first argument type of BinaryOperation2.
  7. The value type of SinglePassRange2 is convertible to the second argument type of BinaryOperation2.
  8. Value is convertible to the value type of BinaryOperation1.
  9. The return type of BinaryOperation2 is convertible to the second argument type of BinaryOperation1.
  10. The return type of BinaryOperation1 is convertible to Value.
Precondition:

distance(rng2) >= distance(rng1) is a valid range.

Complexity

Linear. Exactly distance(rng).


PrevUpHomeNext