summaryrefslogtreecommitdiffhomepage
path: root/logic/simple-mat.hpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-09-28 02:00:39 +0200
committerStanislaw Halik <sthalik@misaki.pl>2016-09-28 02:00:39 +0200
commiteb24176b266e2406979ec4daf1c5ea73f356efef (patch)
tree8b70de186cf0c99e87f42808b9ea4c768261b211 /logic/simple-mat.hpp
parent346af3e3e49ae9fdd9c1cb6bf38506371773a7f2 (diff)
logic/simple-mat: add unsigned index accessors
Diffstat (limited to 'logic/simple-mat.hpp')
-rw-r--r--logic/simple-mat.hpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/logic/simple-mat.hpp b/logic/simple-mat.hpp
index 1d416e6b..089e8dfe 100644
--- a/logic/simple-mat.hpp
+++ b/logic/simple-mat.hpp
@@ -70,6 +70,18 @@ public:
template<int P = h_> typename std::enable_if<equals<P, 1, 3>::value, num&>::type
inline operator()(int i) { return data[0][i]; }
+ template<int Q = w_> typename std::enable_if<equals<Q, 1, 0>::value, num>::type
+ inline operator()(unsigned i) const { return data[i][0]; }
+
+ template<int P = h_> typename std::enable_if<equals<P, 1, 1>::value, num>::type
+ inline operator()(unsigned i) const { return data[0][i]; }
+
+ template<int Q = w_> typename std::enable_if<equals<Q, 1, 2>::value, num&>::type
+ inline operator()(unsigned i) { return data[i][0]; }
+
+ template<int P = h_> typename std::enable_if<equals<P, 1, 3>::value, num&>::type
+ inline operator()(unsigned i) { return data[0][i]; }
+
#define OPENTRACK_ASSERT_SWIZZLE static_assert(P == h_ && Q == w_, "")
template<int P = h_, int Q = w_> typename std::enable_if<maybe_add_swizzle<P, Q, 1>::value, num>::type
@@ -176,6 +188,9 @@ public:
inline num operator()(int j, int i) const { return data[j][i]; }
inline num& operator()(int j, int i) { return data[j][i]; }
+ inline num operator()(unsigned j, unsigned i) const { return data[j][i]; }
+ inline num& operator()(unsigned j, unsigned i) { return data[j][i]; }
+
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)