efficient swap operation for vector and matrix classes

This commit is contained in:
2021-06-29 14:39:04 +02:00
parent 3288e51fba
commit 9d0249cdc4
5 changed files with 57 additions and 0 deletions

View File

@@ -299,6 +299,15 @@ public:
l=l->next;
}
}
void swap(fourindex &rhs) //more efficient swap than via tmp and constructors and operator=
{
I tmpnn=nn; nn=rhs.nn; rhs.nn=tmpnn;
I tmpterminator=terminator; terminator=rhs.terminator; rhs.terminator=tmpterminator;
int *tmpcount=count; count=rhs.count; rhs.count=tmpcount;
matel4<I,T> *tmplist=list; list=rhs.list; rhs.list=tmplist;
bool tmpdoscaling=doscaling; doscaling=rhs.doscaling; rhs.doscaling=tmpdoscaling;
fourindexsymtype tmpsymmetry=symmetry; symmetry=rhs.symmetry; rhs.symmetry=tmpsymmetry;
}
};