From 9fa10fe52d30525505ca97afd1fce7cda44d27e5 Mon Sep 17 00:00:00 2001 From: Benoit Steiner Date: Wed, 11 Nov 2015 15:38:30 -0800 Subject: [PATCH] Don't use std::array when compiling with nvcc since nvidia doesn't support the use of STL containers on GPU. --- unsupported/Eigen/CXX11/Core | 2 +- unsupported/Eigen/CXX11/src/Core/util/EmulateCXX11Meta.h | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/unsupported/Eigen/CXX11/Core b/unsupported/Eigen/CXX11/Core index 292f09564..cadfaaff1 100644 --- a/unsupported/Eigen/CXX11/Core +++ b/unsupported/Eigen/CXX11/Core @@ -33,7 +33,7 @@ #include // Emulate the cxx11 functionality that we need if the compiler doesn't support it. -#if __cplusplus <= 199711L +#if __cplusplus <= 199711L || defined(__CUDACC__) #include "src/Core/util/EmulateCXX11Meta.h" #else #include diff --git a/unsupported/Eigen/CXX11/src/Core/util/EmulateCXX11Meta.h b/unsupported/Eigen/CXX11/src/Core/util/EmulateCXX11Meta.h index ecd1bddf1..ce34a7f04 100644 --- a/unsupported/Eigen/CXX11/src/Core/util/EmulateCXX11Meta.h +++ b/unsupported/Eigen/CXX11/src/Core/util/EmulateCXX11Meta.h @@ -23,7 +23,8 @@ template class array { EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const T& operator[] (size_t index) const { return values[index]; } - static const std::size_t size() { return n; } + EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE + static std::size_t size() { return n; } T values[n]; @@ -105,7 +106,8 @@ template class array { } #ifdef EIGEN_HAS_VARIADIC_TEMPLATES - array(std::initializer_list l) { + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE array(std::initializer_list l) { eigen_assert(l.size() == n); internal::smart_copy(l.begin(), l.end(), values); }