#include "enginedata.h" using namespace std; Row::Row(const int nc,const Table *const _t):table(_t){items=new RowItem[nc];} Row::~Row(void){if(items)delete[] items;} Row::Row(Row &&other):table(other.table),items(other.items){ //move constr other.table=NULL; other.items=NULL; } Row::Row(const Row &other):table(other.table){ //copy constr items=new RowItem[table->nc]; memcpy(items,other.items,table->nc*sizeof(RowItem)); } Table::Table(const string &_n,const int _nc,const ColHeader *const _hd):name(_n),nc(_nc){ //copies from _hd, so you can freely delete it or whatever header=new ColHeader[nc]; memcpy(header,_hd,nc*sizeof(ColHeader)); } Table::~Table(void){if(header)delete[] header;} Table::Table(Table &&other):name(move(other.name)),nc(other.nc),header(other.header),rows(move(other.rows)){ other.header=NULL; } void Table::insert(Row &&row){rows.push_back(move(row));} void Table::insert(Row &row){rows.emplace_back(row);}