From 814050baca83af2bf34c32006ddb9f45ddd2d39a Mon Sep 17 00:00:00 2001 From: CHatingPython Date: Thu, 29 Oct 2026 10:03:42 +0100 Subject: [PATCH] fix(math): use decltype(auto) instead of auto --- include/cenet/math/tensor.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/cenet/math/tensor.hpp b/include/cenet/math/tensor.hpp index 7905d5f..204a579 100644 --- a/include/cenet/math/tensor.hpp +++ b/include/cenet/math/tensor.hpp @@ -51,7 +51,7 @@ public: template 0 && sizeof...(Offs) <= sizeof...(Dims) && (std::is_integral_v && ...))>> - auto slice(Offs... offs) { + decltype(auto) slice(Offs... offs) { auto* ptr = m_view + calculate_offset(std::make_tuple(offs...)); if constexpr (sizeof...(Offs) == sizeof...(Dims)) return *ptr; return inner_view(ptr, std::index_sequence{}); @@ -60,19 +60,19 @@ public: template 0 && sizeof...(Offs) <= sizeof...(Dims) && (std::is_integral_v && ...))>> - auto slice(Offs... offs) const { + decltype(auto) slice(Offs... offs) const { const auto* ptr = m_view + calculate_offset(std::make_tuple(offs...)); if constexpr (sizeof...(Offs) == sizeof...(Dims)) return *ptr; return inner_view(ptr, std::index_sequence{}); } public: template >> - auto operator[](Off off) { + decltype(auto) operator[](Off off) { return slice(off); } template >> - auto operator[](Off off) const { + decltype(auto) operator[](Off off) const { return slice(off); } private: