From 54f4087ab8749ad33a945c6baf3c1f3d0fae996c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 12 Dec 2016 19:43:43 +0100 Subject: [PATCH] Math: return const& from Bezier::operator[]. So constexpr access on Vector elements is possible as well. --- src/Magnum/Math/Bezier.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Magnum/Math/Bezier.h b/src/Magnum/Math/Bezier.h index 7920bf914..a40051769 100644 --- a/src/Magnum/Math/Bezier.h +++ b/src/Magnum/Math/Bezier.h @@ -113,7 +113,8 @@ template class Bezier { * @p i should not be larger than @ref Order. */ Vector& operator[](std::size_t i) { return _data[i]; } - constexpr Vector operator[](std::size_t i) const { return _data[i]; } /**< @overload */ + /* returns const& so [][] operations are also constexpr */ + constexpr const Vector& operator[](std::size_t i) const { return _data[i]; } /**< @overload */ /** * @brief Interpolate the curve at given position