absl::c_adjacent_difference

Container-based version of the <numeric> std::adjacent_difference() function to compute the difference between each element and the one preceding it and write it to an iterator.

Synopsis

Declared in <absl/algorithm/container.h>

template<
    typename InputSequence,
    typename OutputIt>
constexpr
OutputIt
c_adjacent_difference(
    InputSequence const& input,
    OutputIt output_first);

Return Value

An iterator to the end of the written range in the output.

Parameters

NameDescription
inputThe container whose elements to process.
output_firstThe output iterator receiving the differences.