tables::column::avg

template <is_primitive_type P>
P column<P>::avg()

Returns the arithmetic mean of the elements in the list.

Complexity

Linear

Example

Code

#include <cpptables/table.hh>

using namespace tables;
using namespace std;

void column_avg()
{
  const column<unsigned> xs({ 1, 2, 3, 4, 5});

  cout << xs.avg() << "\n";
}

Output

3