Daily bit(e) of C++ | std::adjacent_difference
Daily bit(e) of C++ #314, The adjacent elements left-fold algorithm: std::adjacent_difference.
std::adjacent_difference is a reduction/left-fold algorithm that operates on adjacent elements of a range.
The left-fold variant permits the output range to overlap with the input range (by actively caching elements).
As with other binary algorithms, the first emitted element is simply the first element from the input range.