diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2015-08-11 06:41:02 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2015-08-11 06:41:02 +0200 |
commit | f0f18a08e2f4a82902098df8d54578811919fa67 (patch) | |
tree | 7aa47ffed7359d475abbf9ba48cea7ca1d4673cf /opentrack/simple-mat.hpp | |
parent | 7b6627bb4769ada62c0b632cd72db9d0f0f74406 (diff) |
simple-mat: open-code more, add comment
Diffstat (limited to 'opentrack/simple-mat.hpp')
-rwxr-xr-x | opentrack/simple-mat.hpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/opentrack/simple-mat.hpp b/opentrack/simple-mat.hpp index 1d3b10e1..49bf4feb 100755 --- a/opentrack/simple-mat.hpp +++ b/opentrack/simple-mat.hpp @@ -47,6 +47,9 @@ template<typename num, int h_, int w_> struct Mat { num data[h_][w_]; + + // parameters w_ and h_ are rebound so that SFINAE occurs + // removing them causes a compile-time error -sh 20150811 template<int Q = w_> typename std::enable_if<equals<Q, 1, 0>::value, num>::type __inline operator()(int i) const { return data[i][0]; } @@ -108,7 +111,7 @@ struct Mat Mat<num, h_, w_> ret; for (int j = 0; j < h_; j++) for (int i = 0; i < w_; i++) - ret(j, i) = data[j][i] + other(j, i); + ret(j, i) = data[j][i] + other.data[j][i]; return ret; } @@ -117,7 +120,7 @@ struct Mat Mat<num, h_, w_> ret; for (int j = 0; j < h_; j++) for (int i = 0; i < w_; i++) - ret(j, i) = data[j][i] - other(j, i); + ret(j, i) = data[j][i] - other.data[j][i]; return ret; } |