summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2017-04-29 16:04:49 +0200
committerStanislaw Halik <sthalik@misaki.pl>2017-04-29 16:04:49 +0200
commit057cf55a2a24477251fc947db6981fc8f1a6cfe6 (patch)
tree92422f0fc94b38ea43691b514e0257a4dbd245dc
parent17d8245bdfaf75cc156aaf382b54782068a0c0f7 (diff)
compat/simple-mat: initialize like a single-dimensional array
I have no idea why this works.
-rw-r--r--compat/simple-mat.hpp14
1 files changed, 1 insertions, 13 deletions
diff --git a/compat/simple-mat.hpp b/compat/simple-mat.hpp
index fbd0a75e..a119044c 100644
--- a/compat/simple-mat.hpp
+++ b/compat/simple-mat.hpp
@@ -193,13 +193,9 @@ public:
template<typename... ts, int h__ = h_, int w__ = w_,
typename = typename std::enable_if<is_arglist_correct<num, h__, w__, ts...>::value>::type>
- Mat(const ts... xs)
+ Mat(const ts... xs) : data{static_cast<num>(xs)...}
{
static_assert(h__ == h_ && w__ == w_, "");
-
- std::initializer_list<num> init = { static_cast<num>(xs)... };
-
- *this = Mat(std::move(init));
}
Mat()
@@ -216,14 +212,6 @@ public:
data[j][i] = mem[i*h_+j];
}
- Mat(std::initializer_list<num>&& init)
- {
- auto iter = init.begin();
- for (int j = 0; j < h_; j++)
- for (int i = 0; i < w_; i++)
- data[j][i] = *iter++;
- }
-
operator num*() { return reinterpret_cast<num*>(data); }
operator const num*() const { return reinterpret_cast<const num*>(data); }