From cc2ff226ae189a24b0a6d4a3bd1e5e7748164e37 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 3 Dec 2017 19:23:56 -0500 Subject: [PATCH] vector_math: Return by const reference for const operator[] Makes behavior between both overloads consistent. --- src/common/vector_math.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/common/vector_math.h b/src/common/vector_math.h index 3f0057d9e5..1d7ea14daf 100644 --- a/src/common/vector_math.h +++ b/src/common/vector_math.h @@ -131,7 +131,7 @@ public: { return *((&x) + i); } - T operator[](const int i) const { + const T& operator[](const int i) const { return *((&x) + i); } @@ -288,7 +288,7 @@ public: { return *((&x) + i); } - T operator[](const int i) const { + const T& operator[](const int i) const { return *((&x) + i); } @@ -502,7 +502,7 @@ public: { return *((&x) + i); } - T operator[](const int i) const { + const T& operator[](const int i) const { return *((&x) + i); }