From 9cd5ab67dbe347d1f4dcf4a6eb3f4fd7e3d89dab Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 22 Aug 2015 20:25:32 +0200 Subject: simple-mat: fix arglist SFINAE Constructor was always available, enable_if faultily allowed it to accept an arbitrary amount of parameters. The `assignable' bit is redundant and broken, anyway static_cast(x)... takes care of type compatibility. --- opentrack/simple-mat.hpp | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) (limited to 'opentrack/simple-mat.hpp') diff --git a/opentrack/simple-mat.hpp b/opentrack/simple-mat.hpp index ca60c54d..c603a2cb 100644 --- a/opentrack/simple-mat.hpp +++ b/opentrack/simple-mat.hpp @@ -42,22 +42,10 @@ namespace { enum { Q = a == 1 ? 3 : 1 }; }; - template struct assignable; - - template - struct assignable { - enum { value = true }; - }; - - template - struct assignable { - enum { value = std::is_assignable::value && assignable::value }; - }; - template struct is_arglist_correct { - enum { value = h * w == sizeof...(ts) && assignable::value }; + enum { value = h * w == sizeof...(ts) }; }; } @@ -196,7 +184,8 @@ public: inline num operator()(int j, int i) const { return data[j][i]; } inline num& operator()(int j, int i) { return data[j][i]; } - template::value>> + template::value>::type> Mat(ts const&... xs) { const std::initializer_list init = { static_cast(xs)... }; -- cgit v1.2.3