tables::column::take

template <is_primitive_type P>
column<P> take(const std::size_t n) const

Returns first n elements of column or full column if n is more than size of column.

Complexity

Linear

Example

Code

#include <cpptables/table.hh>

using namespace tables;
using namespace std;

void column_take()
{
  constexpr unsigned none = prim_traits<unsigned>::none;

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

  cout << xs.take(2) << "\n";
}

Output

1 2