Fix Vec<> comparison operator

- Iterate over size of Vec<> (thx Joachim)
- Declare it const (otherwise pybind compares the pointers to the data
    arrays instead)
This commit is contained in:
Matthias Hochsteger 2019-11-28 10:44:10 +01:00
parent 05e6456ec2
commit a0921a5e7f

View File

@ -120,9 +120,12 @@ namespace netgen
return *this; return *this;
} }
bool operator== (const Vec<D,T> &a) bool operator== (const Vec<D,T> &a) const
{ {
return x[0]==a.x[0] && x[1]==a.x[1] && x[2]==a.x[2]; bool res = true;
for (auto i : Range(D))
res &= (x[i]==a.x[i]);
return res;
} }
T & operator() (int i) { return x[i]; } T & operator() (int i) { return x[i]; }