From 46300d64f240343aa02a4ea154817eae59945552 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 18 Mar 2019 15:29:48 +0100 Subject: compat/simple-mat: add tuple destructuring --- compat/simple-mat.hpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/compat/simple-mat.hpp b/compat/simple-mat.hpp index d499ee36..01af1c99 100644 --- a/compat/simple-mat.hpp +++ b/compat/simple-mat.hpp @@ -8,6 +8,7 @@ #pragma once +#include #include #include #include @@ -286,6 +287,12 @@ public: } }; +template +constexpr num get(const Mat& m) { return m(k); } + +template +constexpr num& get(Mat& m) { return m(k); } + } // ns simple_mat template @@ -306,3 +313,16 @@ constexpr Mat operator*(const Mat& self, num other) ret(j, i) = self(j, i) * other; return ret; } + +namespace std { + template + struct tuple_size> : + std::integral_constant + {}; + + template + struct tuple_element> + { + using type = std::remove_const_t>; + }; +} // ns std -- cgit v1.2.3