tables::column::cast_to

template<is_primitive_type P>
template<is_primitive_type P1>
column<P1> column<P>::cast_to() const

Return column with elements x casted to type P1

Complexity

Linear

Example

Code

#include <cpptables/table.hh>

using namespace tables;
using namespace std;

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

Output

1.0 2.0 3.0 4.0 5.0