From 5ea9faef0468b866868c37ae35d5eba34722b9a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 31 Dec 2025 20:21:24 +0100 Subject: [PATCH] Math: mark scatter() with CORRADE_NODISCARD. Spent quite a while figuring out why the call didn't work, only to realize it doesn't modify the value in-place. This annotation should help. --- src/Magnum/Math/Swizzle.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Magnum/Math/Swizzle.h b/src/Magnum/Math/Swizzle.h index 9bd86323e..f671c41bf 100644 --- a/src/Magnum/Math/Swizzle.h +++ b/src/Magnum/Math/Swizzle.h @@ -145,11 +145,11 @@ Inverse to @ref gather(), supporting the same component addressing except for @ref Vector4::rgb(), @ref Vector4::xy(), @ref Vector3::xy() */ #ifdef DOXYGEN_GENERATING_OUTPUT -template constexpr T scatter(const T& vector, const Vector& values) +template CORRADE_NODISCARD constexpr T scatter(const T& vector, const Vector& values) #else /* Using std::common_type otherwise GCC 4.8 fails to match the arguments in SwizzleTest::scatterOneComponent() */ -template constexpr T scatter(const T& vector, const typename std::common_type>::type& values) +template CORRADE_NODISCARD constexpr T scatter(const T& vector, const typename std::common_type>::type& values) #endif { return Implementation::scatterRecursive(vector, values, 0);