From 2cf1d750c2e834596c0556a16ea2e4b3fdd7003f Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 7 Nov 2014 06:42:36 +0100 Subject: simple-mat inits without a temp array now --- opentrack/simple-mat.hpp | 9 +++++++++ 1 file changed, 9 insertions(+) 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 template 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&& 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++) -- cgit v1.2.3