operators - and * in crystal::coord

This commit is contained in:
Zeno Rogue 2020-01-06 20:36:42 +01:00
parent 6a1911ef01
commit 8f1a65c9d7
1 changed files with 2 additions and 0 deletions

View File

@ -16,6 +16,8 @@ static const int MAXDIM = 7;
struct coord : public array<int, MAXDIM> {
coord operator + (coord b) { for(int i=0; i<MAXDIM; i++) b[i] += self[i]; return b; }
coord operator - (coord b) { for(int i=0; i<MAXDIM; i++) b[i] = self[i] - b[i]; return b; }
coord operator * (int x) { coord res; for(int i=0; i<MAXDIM; i++) res[i] = x * self[i]; return res; }
};
static const coord c0 = {};