From 0fd99c59f1740a7aa2ead03168705b4211bf29e8 Mon Sep 17 00:00:00 2001 From: Matthias Grob Date: Tue, 14 Jul 2020 16:28:47 +0200 Subject: [PATCH] Switch operator() to return a const reference --- matrix/Matrix.hpp | 2 +- matrix/Slice.hpp | 2 +- matrix/Vector.hpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/matrix/Matrix.hpp b/matrix/Matrix.hpp index a910d4fb04..97e1ebf76f 100644 --- a/matrix/Matrix.hpp +++ b/matrix/Matrix.hpp @@ -94,7 +94,7 @@ public: */ - inline Type operator()(size_t i, size_t j) const + inline const Type &operator()(size_t i, size_t j) const { assert(i >= 0); assert(i < M); diff --git a/matrix/Slice.hpp b/matrix/Slice.hpp index a6e093aca8..faf211ca73 100644 --- a/matrix/Slice.hpp +++ b/matrix/Slice.hpp @@ -34,7 +34,7 @@ public: assert(y0 + Q <= N); } - Type operator()(size_t i, size_t j) const + const Type &operator()(size_t i, size_t j) const { assert(i >= 0); assert(i < P); diff --git a/matrix/Vector.hpp b/matrix/Vector.hpp index 40803ba8cc..e9c0d1f1ab 100644 --- a/matrix/Vector.hpp +++ b/matrix/Vector.hpp @@ -40,7 +40,7 @@ public: { } - inline Type operator()(size_t i) const + inline const Type &operator()(size_t i) const { assert(i >= 0); assert(i < M);