summaryrefslogtreecommitdiffhomepage
path: root/opentrack
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2015-08-22 20:25:32 +0200
committerStanislaw Halik <sthalik@misaki.pl>2015-08-22 20:25:32 +0200
commit9cd5ab67dbe347d1f4dcf4a6eb3f4fd7e3d89dab (patch)
tree283a603b2d83c9ff1474af0cbff52ba3b83d5242 /opentrack
parent48339aa148200f0f9cdf8ff61b17413ff1dacc87 (diff)
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<num>(x)... takes care of type compatibility.
Diffstat (limited to 'opentrack')
-rw-r--r--opentrack/simple-mat.hpp17
1 files changed, 3 insertions, 14 deletions
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<typename... arglist> struct assignable;
-
- template<typename num>
- struct assignable<num> {
- enum { value = true };
- };
-
- template<typename num, typename t, typename... ts>
- struct assignable<num, t, ts...> {
- enum { value = std::is_assignable<num, t>::value && assignable<num, ts...>::value };
- };
-
template<typename num, int h, int w, typename...ts>
struct is_arglist_correct
{
- enum { value = h * w == sizeof...(ts) && assignable<num, ts...>::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<typename... ts, typename = typename std::enable_if<is_arglist_correct<num, h_, w_, ts...>::value>>
+ template<typename... ts, int h__ = h_, int w__ = w_,
+ typename = typename std::enable_if<is_arglist_correct<num, h__, w__, ts...>::value>::type>
Mat(ts const&... xs)
{
const std::initializer_list<num> init = { static_cast<num>(xs)... };