tables::column::fills, fill_with, zfill

1)

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

2)

template <is_primitive_type P>
column<P> column<P>::fill_with(const prim_t val) const

3)

template <is_primitive_type P>
column<P> column<P>::fill_with(const column<P> c) const

4)

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

'

  1. Returns column with nones replaced by previous non-none value.

  2. Returns column with nones replaced by val.

  3. Returns column with nones replaced with elements from c.

  4. Returns column with nones replaced by zero.

Complexity

Linear

Example

Code

#include <cpptables/table.hh>

using namespace tables;
using namespace std;

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

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

  cout << xs.fills() << "\n";
  cout << xs.fill_with(99) << "\n";
  cout << xs.zfill() << "\n";

  const column<unsigned> ys ({ 10,20,30,40,50, 60});
  cout << xs.fill_with(ys) << "\n";
}

Output

1 1 3 4 5 5
1 99 3 4 5 99
1 0 3 4 5 0
1 20 3 4 5 60