tables::column::deltas

template <is_primitive_type P>
column<P> column<P>::deltas() const

Return column with difference between consecutive elements.

Complexity

Linear

Example

Code

#include <cpptables/table.hh>

using namespace tables;
using namespace std;

void column_deltas()
{
  const column<unsigned> xs ({ 1, 2, 3, 4, 5});
  const column<unsigned> ys = xs.deltas();
  cout << ys << "\n";
}

Output

0 1 2 3 4