aboutsummaryrefslogtreecommitdiffhomepage
path: root/unsupported/Eigen/CXX11/src/util
diff options
context:
space:
mode:
authorGravatar Benoit Steiner <benoit.steiner.goog@gmail.com>2016-11-30 19:55:15 -0800
committerGravatar Benoit Steiner <benoit.steiner.goog@gmail.com>2016-11-30 19:55:15 -0800
commite37c2c52d3a86542d96d7bacd6c05849ad0d9741 (patch)
treee3114994577d8c8a6057c03e5e423cad6aa3717c /unsupported/Eigen/CXX11/src/util
parent26fff1c5b16f4eae7935635f267b48daa3164a3b (diff)
Added an implementation of numeric_list that works with sycl
Diffstat (limited to 'unsupported/Eigen/CXX11/src/util')
-rw-r--r--unsupported/Eigen/CXX11/src/util/CXX11Meta.h28
1 files changed, 24 insertions, 4 deletions
diff --git a/unsupported/Eigen/CXX11/src/util/CXX11Meta.h b/unsupported/Eigen/CXX11/src/util/CXX11Meta.h
index 1e3aef8c2..197fddab6 100644
--- a/unsupported/Eigen/CXX11/src/util/CXX11Meta.h
+++ b/unsupported/Eigen/CXX11/src/util/CXX11Meta.h
@@ -36,11 +36,21 @@ struct type_list { constexpr static int count = sizeof...(tt); };
template<typename t, typename... tt>
struct type_list<t, tt...> { constexpr static int count = sizeof...(tt) + 1; typedef t first_type; };
+#ifndef EIGEN_USE_SYCL
template<typename T, T... nn>
struct numeric_list { constexpr static std::size_t count = sizeof...(nn); };
template<typename T, T n, T... nn>
-struct numeric_list<T, n, nn...> { constexpr static std::size_t count = sizeof...(nn) + 1; constexpr static T first_value = n; };
+struct numeric_list<T, n, nn...> { static const std::size_t count = sizeof...(nn) + 1; const static T first_value = n; };
+
+#else
+template<typename T, T... nn>
+struct numeric_list {
+ static constexpr std::size_t count = sizeof...(nn);
+ const T values[count] = {nn...};
+};
+
+#endif
/* numeric list constructors
*
@@ -123,9 +133,19 @@ template<typename a, typename... as> struct get<0, type_lis
template<typename T, int n, T a, T... as> struct get<n, numeric_list<T, a, as...>> : get<n-1, numeric_list<T, as...>> {};
template<typename T, T a, T... as> struct get<0, numeric_list<T, a, as...>> { constexpr static T value = a; };
-template<std::size_t n, typename T, T a, T... as> constexpr inline const T array_get(const numeric_list<T, a, as...>&) {
- return get<(int)n, numeric_list<T, a, as...>>::value;
-}
+#ifndef EIGEN_USE_SYCL
+template<std::size_t n, typename T, T a, T... as> constexpr T array_get(const numeric_list<T, a, as...>&) {
+ return get<(int)n, numeric_list<T, a, as...>>::value;
+}
+#else
+template<std::size_t n, typename T, T... as> constexpr T array_get(const numeric_list<T, as...>& l) {
+ return l.values[n];
+}
+template<std::size_t n, typename T> constexpr T array_get(const numeric_list<T>& ) {
+ return T(0);
+}
+
+#endif
/* always get type, regardless of dummy; good for parameter pack expansion */