diff options
author | 2016-03-11 15:20:37 -0800 | |
---|---|---|
committer | 2016-03-11 15:20:37 -0800 | |
commit | 25f69cb932f05b8509df14d14d2779a20fc9b091 (patch) | |
tree | 1c03c2585561f55d2934acd07b44c234d9a1e97e /unsupported | |
parent | c5b98a58b8ea018be71cdc03f7060d2b96184a84 (diff) |
Added a comparison operator for Eigen::array
Alias Eigen::array to std::array when compiling with Visual Studio 2015
Diffstat (limited to 'unsupported')
-rw-r--r-- | unsupported/Eigen/CXX11/src/Core/util/EmulateArray.h | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/unsupported/Eigen/CXX11/src/Core/util/EmulateArray.h b/unsupported/Eigen/CXX11/src/Core/util/EmulateArray.h index eae8b996c..894b22009 100644 --- a/unsupported/Eigen/CXX11/src/Core/util/EmulateArray.h +++ b/unsupported/Eigen/CXX11/src/Core/util/EmulateArray.h @@ -15,7 +15,7 @@ // The array class is only available starting with cxx11. Emulate our own here // if needed. // Moreover, CUDA doesn't support the STL containers, so we use our own instead. -#if __cplusplus <= 199711L || defined(__CUDACC__) || defined(EIGEN_AVOID_STL_ARRAY) +#if (__cplusplus <= 199711L && EIGEN_COMP_MSVC < 1900) || defined(__CUDACC__) || defined(EIGEN_AVOID_STL_ARRAY) namespace Eigen { template <typename T, size_t n> class array { @@ -177,6 +177,19 @@ template <typename T> class array<T, 0> { T dummy; }; +// Comparison operator +// Todo: implement !=, <, <=, >, and >= +template<class T, std::size_t N> +bool operator==(const array<T,N>& lhs, const array<T,N>& rhs) { + for (std::size_t i = 0; i < N; ++i) { + if (lhs[i] != rhs[i]) { + return false; + } + } + return true; +} + + namespace internal { template<std::size_t I, class T, std::size_t N> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T& array_get(array<T,N>& a) { |