From cf3ae0eee7fb252ecc9760e721cded29dbf894ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Fri, 6 Dec 2013 13:45:04 +0100 Subject: [PATCH] Revert "Math: don't allow *::data() to be called on rvalues." The pointer conversion can be done only explicitly, thus the users will always know what they are doing. With that change, perfectly valid things like this couldn't be done (the result of a + b is kept until the semicolon): Vector3 a, b; void foo(float* data); foo((a + b).data()); Moreover this conversion wasn't even properly tested, leading to issues as in mosra/corrade@781f5df38a7b1b366f3de477dd5fe641eca6ed20. This reverts commit add989703e694f7719e015cc12717d9953de0322. --- src/Math/RectangularMatrix.h | 16 ++-------------- src/Math/Vector.h | 16 ++-------------- 2 files changed, 4 insertions(+), 28 deletions(-) diff --git a/src/Math/RectangularMatrix.h b/src/Math/RectangularMatrix.h index 89b365c56..cbb0a685f 100644 --- a/src/Math/RectangularMatrix.h +++ b/src/Math/RectangularMatrix.h @@ -164,20 +164,8 @@ template class RectangularMatrix { * * @see operator[] */ - T* data() - #ifndef CORRADE_GCC47_COMPATIBILITY - & - #endif - { return _data[0].data(); } - - /** @overload */ - constexpr const T* data() - #ifndef CORRADE_GCC47_COMPATIBILITY - const & - #else - const - #endif - { return _data[0].data(); } + T* data() { return _data[0].data(); } + constexpr const T* data() const { return _data[0].data(); } /**< @overload */ /** * @brief %Matrix column diff --git a/src/Math/Vector.h b/src/Math/Vector.h index d4a1f6950..89e7b8f55 100644 --- a/src/Math/Vector.h +++ b/src/Math/Vector.h @@ -184,20 +184,8 @@ template class Vector { * * @see operator[]() */ - T* data() - #ifndef CORRADE_GCC47_COMPATIBILITY - & - #endif - { return _data; } - - /** @overload */ - constexpr const T* data() - #ifndef CORRADE_GCC47_COMPATIBILITY - const & - #else - const - #endif - { return _data; } + T* data() { return _data; } + constexpr const T* data() const { return _data; } /**< @overload */ /** * @brief Value at given position