diff options
-rw-r--r-- | opentrack/simple-mat.hpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/opentrack/simple-mat.hpp b/opentrack/simple-mat.hpp index 8e39a14f..b36b21ba 100644 --- a/opentrack/simple-mat.hpp +++ b/opentrack/simple-mat.hpp @@ -1,4 +1,5 @@ #pragma once +#include <initializer_list> template<typename num, int h, int w> struct Mat @@ -26,6 +27,14 @@ struct Mat num operator()(int j, int i) const { return data[j][i]; } num& operator()(int j, int i) { return data[j][i]; } + Mat(std::initializer_list<num>&& list) + { + auto iter = list.begin(); + for (int i = 0; i < h; i++) + for (int j = 0; j < w; j++) + data[i][j] = *iter++; + } + Mat() { for (int j = 0; j < h; j++) |