From 48bf5ec2164974c88935148aa1dff09a41d532b2 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Fri, 20 May 2016 14:54:20 +0200 Subject: [PATCH] Make EIGEN_HAS_RVALUE_REFERENCES user configurable --- Eigen/src/Core/Array.h | 2 +- Eigen/src/Core/DenseStorage.h | 6 +++--- Eigen/src/Core/Matrix.h | 2 +- Eigen/src/Core/PlainObjectBase.h | 2 +- Eigen/src/Core/util/Macros.h | 6 +++++- test/rvalue_types.cpp | 2 +- unsupported/Eigen/CXX11/src/Tensor/TensorFixedSize.h | 2 +- 7 files changed, 13 insertions(+), 9 deletions(-) diff --git a/Eigen/src/Core/Array.h b/Eigen/src/Core/Array.h index f296dd495..c0af4aa9d 100644 --- a/Eigen/src/Core/Array.h +++ b/Eigen/src/Core/Array.h @@ -147,7 +147,7 @@ class Array } #endif -#ifdef EIGEN_HAS_RVALUE_REFERENCES +#if EIGEN_HAS_RVALUE_REFERENCES EIGEN_DEVICE_FUNC Array(Array&& other) : Base(std::move(other)) diff --git a/Eigen/src/Core/DenseStorage.h b/Eigen/src/Core/DenseStorage.h index cf55b6b35..4c0afdc7a 100644 --- a/Eigen/src/Core/DenseStorage.h +++ b/Eigen/src/Core/DenseStorage.h @@ -362,7 +362,7 @@ template class DenseStorage class DenseStorage class DenseStorage::type } #endif -#ifdef EIGEN_HAS_RVALUE_REFERENCES +#if EIGEN_HAS_RVALUE_REFERENCES EIGEN_DEVICE_FUNC PlainObjectBase(PlainObjectBase&& other) : m_storage( std::move(other.m_storage) ) diff --git a/Eigen/src/Core/util/Macros.h b/Eigen/src/Core/util/Macros.h index 4fe0dde8f..7fb194a40 100644 --- a/Eigen/src/Core/util/Macros.h +++ b/Eigen/src/Core/util/Macros.h @@ -348,11 +348,15 @@ #endif // Do we support r-value references? +#ifndef EIGEN_HAS_RVALUE_REFERENCES #if EIGEN_MAX_CPP_VER>=11 && \ (__has_feature(cxx_rvalue_references) || \ (defined(__cplusplus) && __cplusplus >= 201103L) || \ (EIGEN_COMP_MSVC >= 1600)) - #define EIGEN_HAS_RVALUE_REFERENCES + #define EIGEN_HAS_RVALUE_REFERENCES 1 +#else + #define EIGEN_HAS_RVALUE_REFERENCES 0 +#endif #endif // Does the compiler support C99? diff --git a/test/rvalue_types.cpp b/test/rvalue_types.cpp index b4eda140c..a263d737f 100644 --- a/test/rvalue_types.cpp +++ b/test/rvalue_types.cpp @@ -11,7 +11,7 @@ #include -#ifdef EIGEN_HAS_RVALUE_REFERENCES +#if EIGEN_HAS_RVALUE_REFERENCES template void rvalue_copyassign(const MatrixType& m) { diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorFixedSize.h b/unsupported/Eigen/CXX11/src/Tensor/TensorFixedSize.h index 4ff965f61..4573a0926 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorFixedSize.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorFixedSize.h @@ -309,7 +309,7 @@ class TensorFixedSize : public TensorBase