mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-09-24 07:13:16 +08:00
Fix const input and c++20 compatibility in unary view.
This commit is contained in:
parent
126ba1a166
commit
285da30ec3
@ -18,9 +18,11 @@ namespace Eigen {
|
|||||||
namespace internal {
|
namespace internal {
|
||||||
template <typename ViewOp, typename MatrixType, typename StrideType>
|
template <typename ViewOp, typename MatrixType, typename StrideType>
|
||||||
struct traits<CwiseUnaryView<ViewOp, MatrixType, StrideType> > : traits<MatrixType> {
|
struct traits<CwiseUnaryView<ViewOp, MatrixType, StrideType> > : traits<MatrixType> {
|
||||||
typedef typename std::result_of<ViewOp(typename traits<MatrixType>::Scalar&)>::type ScalarRef;
|
typedef typename result_of<ViewOp(typename traits<MatrixType>::Scalar&)>::type1 ScalarRef;
|
||||||
static_assert(std::is_reference<ScalarRef>::value, "Views must return a reference type.");
|
static_assert(std::is_reference<ScalarRef>::value, "Views must return a reference type.");
|
||||||
typedef remove_all_t<ScalarRef> Scalar;
|
typedef remove_all_t<ScalarRef> MutableScalar;
|
||||||
|
// Ensure const matrices stay const.
|
||||||
|
typedef std::conditional_t<std::is_const<MatrixType>::value, const MutableScalar, MutableScalar> Scalar;
|
||||||
typedef typename MatrixType::Nested MatrixTypeNested;
|
typedef typename MatrixType::Nested MatrixTypeNested;
|
||||||
typedef remove_all_t<MatrixTypeNested> MatrixTypeNested_;
|
typedef remove_all_t<MatrixTypeNested> MatrixTypeNested_;
|
||||||
enum {
|
enum {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user