template<class InIt, class OutIt>
OutIt adjacent_difference(InIt first, InIt last,
OutIt result);
template<class InIt, class OutIt, class Pred>
OutIt adjacent_difference(InIt first, InIt last,
OutIt result, Pred pr);
The first template function stores successive values beginning at result, for each value of the InIt iterator I in the
interval [first, last). The first value val stored (if any) is *I. Each subsequent value stored is *I - val, and
val is replaced by *I. The function returns result incremented last - first times.
The second template function stores successive values beginning at result, for each value of the InIt iterator I in the
interval [first, last). The first value val stored (if any) is *I. Each subsequent value stored is pr(*I, val), and
val is replaced by *I. The function returns result incremented last - first times.
See the related sample program.