aboutsummaryrefslogtreecommitdiffhomepage
path: root/unsupported/Eigen/CXX11/src/Tensor/TensorDimensions.h
diff options
context:
space:
mode:
authorGravatar Eugene Zhulenev <ezhulenev@google.com>2018-09-18 10:57:00 -0700
committerGravatar Eugene Zhulenev <ezhulenev@google.com>2018-09-18 10:57:00 -0700
commit218a7b98401aee558b96e21d8ba90641eb3e9371 (patch)
treeccdee936e70a3d0565a8727a32af97e1d75946c8 /unsupported/Eigen/CXX11/src/Tensor/TensorDimensions.h
parent1f0c941c3dee8b30814828c7e11f764ccc4f2a5f (diff)
Enable DSizes type promotion with c++03 compilers
Diffstat (limited to 'unsupported/Eigen/CXX11/src/Tensor/TensorDimensions.h')
-rw-r--r--unsupported/Eigen/CXX11/src/Tensor/TensorDimensions.h20
1 files changed, 11 insertions, 9 deletions
diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorDimensions.h b/unsupported/Eigen/CXX11/src/Tensor/TensorDimensions.h
index 5de0d0de7..dbf5af094 100644
--- a/unsupported/Eigen/CXX11/src/Tensor/TensorDimensions.h
+++ b/unsupported/Eigen/CXX11/src/Tensor/TensorDimensions.h
@@ -290,22 +290,24 @@ struct DSizes : array<DenseIndex, NumDims> {
}
}
-#ifdef EIGEN_HAS_CXX11
// Enable DSizes index type promotion only if we are promoting to the
// larger type, e.g. allow to promote dimensions of type int to long.
- template<typename OtherIndex,
- typename std::enable_if<
- std::is_same<
- DenseIndex,
- typename internal::promote_index_type<DenseIndex, OtherIndex>::type
- >::value, int>::type = 0>
+ template<typename OtherIndex>
EIGEN_DEVICE_FUNC
- explicit DSizes(const array<OtherIndex, NumDims>& other) {
+ explicit DSizes(const array<OtherIndex, NumDims>& other,
+ // Default template parameters require c++11.
+ typename internal::enable_if<
+ internal::is_same<
+ DenseIndex,
+ typename internal::promote_index_type<
+ DenseIndex,
+ OtherIndex
+ >::type
+ >::value, void*>::type = 0) {
for (int i = 0; i < NumDims; ++i) {
(*this)[i] = static_cast<DenseIndex>(other[i]);
}
}
-#endif // EIGEN_HAS_CXX11
#ifdef EIGEN_HAS_INDEX_LIST
template <typename FirstType, typename... OtherTypes>