#include <algorithm> iterator adjacent_difference( iterator start, iterator end, iterator result ); iterator adjacent_difference( iterator start, iterator end, iterator result, BinaryFunction f );
The adjacent_difference() function calculates the differences between adjacent elements in the range [start,end) and stores the result starting at result.
If a binary function f is given, it is used instead of the - operator to compute the differences.
adjacent_difference() runs in linear time.