aboutsummaryrefslogtreecommitdiffhomepage
path: root/unsupported
diff options
context:
space:
mode:
authorGravatar Benoit Steiner <benoit.steiner.goog@gmail.com>2016-03-11 15:20:37 -0800
committerGravatar Benoit Steiner <benoit.steiner.goog@gmail.com>2016-03-11 15:20:37 -0800
commit25f69cb932f05b8509df14d14d2779a20fc9b091 (patch)
tree1c03c2585561f55d2934acd07b44c234d9a1e97e /unsupported
parentc5b98a58b8ea018be71cdc03f7060d2b96184a84 (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.h15
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) {