diff --git a/Eigen/src/Core/DenseCoeffsBase.h b/Eigen/src/Core/DenseCoeffsBase.h index 86683fe31..a48fc4465 100644 --- a/Eigen/src/Core/DenseCoeffsBase.h +++ b/Eigen/src/Core/DenseCoeffsBase.h @@ -113,7 +113,7 @@ class DenseCoeffsBase : public EigenBase { return coeff(row, col); } -#if __cpp_multidimensional_subscript >= 202110L +#ifdef EIGEN_MULTIDIMENSIONAL_SUBSCRIPT /** \returns the coefficient at given the given row and column. * * \sa operator[](Index,Index), operator[](Index) @@ -331,7 +331,7 @@ class DenseCoeffsBase : public DenseCoeffsBase= 202110L +#ifdef EIGEN_MULTIDIMENSIONAL_SUBSCRIPT /** \returns a reference to the coefficient at given the given row and column. * * \sa operator[](Index) diff --git a/Eigen/src/Core/TriangularMatrix.h b/Eigen/src/Core/TriangularMatrix.h index 910b5042c..66b860afd 100644 --- a/Eigen/src/Core/TriangularMatrix.h +++ b/Eigen/src/Core/TriangularMatrix.h @@ -89,7 +89,7 @@ class TriangularBase : public EigenBase { return coeffRef(row, col); } -#if __cpp_multidimensional_subscript >= 202110L +#ifdef EIGEN_MULTIDIMENSIONAL_SUBSCRIPT EIGEN_DEVICE_FUNC inline Scalar operator[](Index row, Index col) const { return operator()(row, col); } EIGEN_DEVICE_FUNC inline Scalar& operator[](Index row, Index col) { return operator()(row, col); } #endif diff --git a/Eigen/src/Core/util/Macros.h b/Eigen/src/Core/util/Macros.h index dad367169..a2c0d9479 100644 --- a/Eigen/src/Core/util/Macros.h +++ b/Eigen/src/Core/util/Macros.h @@ -830,6 +830,11 @@ #endif #endif +// Multidimensional subscript operator feature test +#if defined(__cpp_multidimensional_subscript) && __cpp_multidimensional_subscript >= 202110L +#define EIGEN_MULTIDIMENSIONAL_SUBSCRIPT +#endif + //------------------------------------------------------------------------------------------ // Preprocessor programming helpers //------------------------------------------------------------------------------------------ diff --git a/Eigen/src/Geometry/Transform.h b/Eigen/src/Geometry/Transform.h index f767c8b4f..bb8ba4c7a 100644 --- a/Eigen/src/Geometry/Transform.h +++ b/Eigen/src/Geometry/Transform.h @@ -365,7 +365,7 @@ class Transform { * \sa MatrixBase::operator(Index,Index) */ EIGEN_DEVICE_FUNC inline Scalar& operator()(Index row, Index col) { return m_matrix(row, col); } -#if __cpp_multidimensional_subscript >= 202110L +#ifdef EIGEN_MULTIDIMENSIONAL_SUBSCRIPT /** shortcut for m_matrix(row,col); * \sa MatrixBase::operator(Index,Index) const */ EIGEN_DEVICE_FUNC inline Scalar operator[](Index row, Index col) const { return m_matrix[row, col]; } diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorContractionMapper.h b/unsupported/Eigen/CXX11/src/Tensor/TensorContractionMapper.h index 7b672fa6e..83fec99af 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorContractionMapper.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorContractionMapper.h @@ -117,7 +117,7 @@ class SimpleTensorContractionMapper { return m_tensor.coeff(computeIndex(row, col)); } -#if __cpp_multidimensional_subscript >= 202110L +#ifdef EIGEN_MULTIDIMENSIONAL_SUBSCRIPT EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator[](Index row, Index col) const { return operator()(row, col); } #endif diff --git a/unsupported/Eigen/src/Polynomials/Companion.h b/unsupported/Eigen/src/Polynomials/Companion.h index ea245a991..1b7f6e101 100644 --- a/unsupported/Eigen/src/Polynomials/Companion.h +++ b/unsupported/Eigen/src/Polynomials/Companion.h @@ -63,7 +63,7 @@ class companion { } } -#if __cpp_multidimensional_subscript >= 202110L +#ifdef EIGEN_MULTIDIMENSIONAL_SUBSCRIPT EIGEN_STRONG_INLINE const Scalar_ operator[](Index row, Index col) const { return operator()(row, col); } #endif diff --git a/unsupported/Eigen/src/SparseExtra/RandomSetter.h b/unsupported/Eigen/src/SparseExtra/RandomSetter.h index 2ba652304..54b26461d 100644 --- a/unsupported/Eigen/src/SparseExtra/RandomSetter.h +++ b/unsupported/Eigen/src/SparseExtra/RandomSetter.h @@ -280,7 +280,7 @@ class RandomSetter { return m_hashmaps[outerMajor][key].value; } -#if __cpp_multidimensional_subscript >= 202110L +#ifdef EIGEN_MULTIDIMENSIONAL_SUBSCRIPT /** \returns a reference to the coefficient at given coordinates \a row, \a col */ Scalar& operator[](Index row, Index col) { return operator()(row, col); } #endif