diff options
Diffstat (limited to 'enginedata.cpp')
-rw-r--r-- | enginedata.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/enginedata.cpp b/enginedata.cpp index ff67f4d..a1e8da4 100644 --- a/enginedata.cpp +++ b/enginedata.cpp @@ -24,7 +24,7 @@ RowItem RowItem::copy(const ColHeader &header){ } Row::Row(void):nc(0),table(NULL){} -Row::Row(const int _nc,const Table *const _t):nc(_nc),table(_t){ +Row::Row(const int _nc,Table *_t):nc(_nc),table(_t){ items=new RowItem[nc]; } Row::~Row(void){ @@ -35,11 +35,18 @@ Row::Row(Row &&other):nc(other.nc),table(other.table),items(other.items){ //move } Row::Row(const Row &other):nc(other.nc),table(other.table){ //copy constr items=new RowItem[nc]; - //memcpy(items,other.items,nc*sizeof(RowItem)); for(int i=0;i<nc;i++){ items[i]=other.items[i].copy(table->header[i]); } } +Row& Row::operator=(const Row &other){ //copy assignment + nc=other.nc; table=other.table; + items=new RowItem[nc]; + for(int i=0;i<nc;i++){ + items[i]=other.items[i].copy(table->header[i]); + } + return *this; +} ostream& operator<<(ostream &os,const Row &r){ os<<'['; for(int i=0;i<r.nc;i++){ |