Name

adjacent_difference function template — Computes differences of adjacent elements in a range

Synopsis

template <typename InIter, typename OutIter>
OutIter adjacent_difference(InIter first, InIter last, OutIter result);
template <typename InIter, typename OutIter, typename BinOp>
OutIter adjacent_difference(InIter first, InIter last, OutIter result, 
                              BinOp binary_op);

The adjacent_difference function computes the differences of adjacent elements in the range [first, last) and assigns those differences to the output range starting at result. The second version calls binary_op instead of using the subtraction (-) operator.