From 285da30ec309a0cacdb10d0fd15cc0de5dbc2f74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20S=C3=A1nchez?= Date: Wed, 13 Mar 2024 16:59:44 +0000 Subject: [PATCH] Fix const input and c++20 compatibility in unary view. --- Eigen/src/Core/CwiseUnaryView.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Eigen/src/Core/CwiseUnaryView.h b/Eigen/src/Core/CwiseUnaryView.h index fdf68f0fc..f1653c87a 100644 --- a/Eigen/src/Core/CwiseUnaryView.h +++ b/Eigen/src/Core/CwiseUnaryView.h @@ -18,9 +18,11 @@ namespace Eigen { namespace internal { template struct traits > : traits { - typedef typename std::result_of::Scalar&)>::type ScalarRef; + typedef typename result_of::Scalar&)>::type1 ScalarRef; static_assert(std::is_reference::value, "Views must return a reference type."); - typedef remove_all_t Scalar; + typedef remove_all_t MutableScalar; + // Ensure const matrices stay const. + typedef std::conditional_t::value, const MutableScalar, MutableScalar> Scalar; typedef typename MatrixType::Nested MatrixTypeNested; typedef remove_all_t MatrixTypeNested_; enum {