From fcbc18ddaef103c2913db55e3484e1ce237be41b Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 27 Oct 2017 12:54:52 +0200 Subject: compat/simple-mat: try some function ref-qualifiers --- compat/simple-mat.hpp | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'compat') diff --git a/compat/simple-mat.hpp b/compat/simple-mat.hpp index 3b2d89eb..5bc26a62 100644 --- a/compat/simple-mat.hpp +++ b/compat/simple-mat.hpp @@ -58,54 +58,54 @@ class Mat public: template std::enable_if_t::value, num> - constexpr inline operator()(int i) const { return data[i][0]; } + constexpr inline operator()(int i) const& { return data[i][0]; } template std::enable_if_t::value, num> - constexpr inline operator()(int i) const { return data[0][i]; } + constexpr inline operator()(int i) const& { return data[0][i]; } template std::enable_if_t::value, num&> - constexpr inline operator()(int i) { return data[i][0]; } + constexpr inline operator()(int i) & { return data[i][0]; } template std::enable_if_t::value, num&> - constexpr inline operator()(int i) { return data[0][i]; } + constexpr inline operator()(int i) & { return data[0][i]; } template std::enable_if_t::value, num> - constexpr inline operator()(unsigned i) const { return data[i][0]; } + constexpr inline operator()(unsigned i) const& { return data[i][0]; } template std::enable_if_t::value, num> - constexpr inline operator()(unsigned i) const { return data[0][i]; } + constexpr inline operator()(unsigned i) const& { return data[0][i]; } template std::enable_if_t::value, num&> - constexpr inline operator()(unsigned i) { return data[i][0]; } + constexpr inline operator()(unsigned i) & { return data[i][0]; } template std::enable_if_t::value, num&> - constexpr inline operator()(unsigned i) { return data[0][i]; } + constexpr inline operator()(unsigned i) & { return data[0][i]; } #define OPENTRACK_ASSERT_SWIZZLE static_assert(P == h_ && Q == w_, "") template std::enable_if_t::value, num> - constexpr inline x() const { OPENTRACK_ASSERT_SWIZZLE; return operator()(0); } + constexpr inline x() const& { OPENTRACK_ASSERT_SWIZZLE; return operator()(0); } template std::enable_if_t::value, num> - constexpr inline y() const { OPENTRACK_ASSERT_SWIZZLE; return operator()(1); } + constexpr inline y() const& { OPENTRACK_ASSERT_SWIZZLE; return operator()(1); } template std::enable_if_t::value, num> - constexpr inline z() const { OPENTRACK_ASSERT_SWIZZLE; return operator()(2); } + constexpr inline z() const& { OPENTRACK_ASSERT_SWIZZLE; return operator()(2); } template std::enable_if_t::value, num> - constexpr inline w() const { OPENTRACK_ASSERT_SWIZZLE; return operator()(3); } + constexpr inline w() const& { OPENTRACK_ASSERT_SWIZZLE; return operator()(3); } template std::enable_if_t::value, num&> - constexpr inline x() { OPENTRACK_ASSERT_SWIZZLE; return operator()(0); } + constexpr inline x() & { OPENTRACK_ASSERT_SWIZZLE; return operator()(0); } template std::enable_if_t::value, num&> - constexpr inline y() { OPENTRACK_ASSERT_SWIZZLE; return operator()(1); } + constexpr inline y() & { OPENTRACK_ASSERT_SWIZZLE; return operator()(1); } template std::enable_if_t::value, num&> - constexpr inline z() { OPENTRACK_ASSERT_SWIZZLE; return operator()(2); } + constexpr inline z() & { OPENTRACK_ASSERT_SWIZZLE; return operator()(2); } template std::enable_if_t::value, num&> - constexpr inline w() { OPENTRACK_ASSERT_SWIZZLE; return operator()(3); } + constexpr inline w() & { OPENTRACK_ASSERT_SWIZZLE; return operator()(3); } // parameters w_ and h_ are rebound so that SFINAE occurs // removing them causes a compile-time error -sh 20150811 @@ -199,11 +199,11 @@ public: return ret; } - constexpr inline num operator()(int j, int i) const { return data[j][i]; } - constexpr inline num& operator()(int j, int i) { return data[j][i]; } + constexpr inline num operator()(int j, int i) const& { return data[j][i]; } + constexpr inline num& operator()(int j, int i) & { return data[j][i]; } - constexpr inline num operator()(unsigned j, unsigned i) const { return data[j][i]; } - constexpr inline num& operator()(unsigned j, unsigned i) { return data[j][i]; } + constexpr inline num operator()(unsigned j, unsigned i) const& { return data[j][i]; } + constexpr inline num& operator()(unsigned j, unsigned i) & { return data[j][i]; } #ifdef __GNUG__ # pragma GCC diagnostic push -- cgit v1.2.3