Don't use std::array when compiling with nvcc since nvidia doesn't support the use of STL containers on GPU.

This commit is contained in:
Benoit Steiner 2015-11-11 15:38:30 -08:00
parent c587293e48
commit 9fa10fe52d
2 changed files with 5 additions and 3 deletions

View File

@ -33,7 +33,7 @@
#include <vector>
// 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 <array>

View File

@ -23,7 +23,8 @@ template <typename T, size_t n> 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 <typename T, size_t n> class array {
}
#ifdef EIGEN_HAS_VARIADIC_TEMPLATES
array(std::initializer_list<T> l) {
EIGEN_DEVICE_FUNC
EIGEN_STRONG_INLINE array(std::initializer_list<T> l) {
eigen_assert(l.size() == n);
internal::smart_copy(l.begin(), l.end(), values);
}