From 25f69cb932f05b8509df14d14d2779a20fc9b091 Mon Sep 17 00:00:00 2001 From: Benoit Steiner Date: Fri, 11 Mar 2016 15:20:37 -0800 Subject: [PATCH] Added a comparison operator for Eigen::array Alias Eigen::array to std::array when compiling with Visual Studio 2015 --- .../Eigen/CXX11/src/Core/util/EmulateArray.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) 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 class array { @@ -177,6 +177,19 @@ template class array { T dummy; }; +// Comparison operator +// Todo: implement !=, <, <=, >, and >= +template +bool operator==(const array& lhs, const array& rhs) { + for (std::size_t i = 0; i < N; ++i) { + if (lhs[i] != rhs[i]) { + return false; + } + } + return true; +} + + namespace internal { template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T& array_get(array& a) {