diff options
author | Gael Guennebaud <g.gael@free.fr> | 2017-01-06 13:29:33 +0100 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2017-01-06 13:29:33 +0100 |
commit | fad1fa75b32ccd3a19fc783a0c660ca512283224 (patch) | |
tree | c090caa5dce7bb8e41b4be9ea4c1c13a74316e4d /Eigen/src/Core | |
parent | 3730e3ca9ec8e256b76c08fb4b1e928c62f37b40 (diff) |
Propagate compile-time size with "all" and add c++11 array unit test
Diffstat (limited to 'Eigen/src/Core')
-rw-r--r-- | Eigen/src/Core/ArithmeticSequence.h | 10 | ||||
-rw-r--r-- | Eigen/src/Core/IndexedView.h | 4 |
2 files changed, 9 insertions, 5 deletions
diff --git a/Eigen/src/Core/ArithmeticSequence.h b/Eigen/src/Core/ArithmeticSequence.h index 1e7812c8c..06b6b53eb 100644 --- a/Eigen/src/Core/ArithmeticSequence.h +++ b/Eigen/src/Core/ArithmeticSequence.h @@ -159,16 +159,16 @@ span(FirstType first, SizeType size) { namespace internal { -template<typename T, typename EnableIf = void> struct get_compile_time_size { +template<typename T, int XprSize, typename EnableIf = void> struct get_compile_time_size { enum { value = -1 }; }; -template<typename T> struct get_compile_time_size<T,typename internal::enable_if<((T::SizeAtCompileTime&0)==0)>::type> { +template<typename T, int XprSize> struct get_compile_time_size<T,XprSize,typename internal::enable_if<((T::SizeAtCompileTime&0)==0)>::type> { enum { value = T::SizeAtCompileTime }; }; #ifdef EIGEN_HAS_CXX11 -template<typename T,int N> struct get_compile_time_size<std::array<T,N> > { +template<typename T, int XprSize, int N> struct get_compile_time_size<std::array<T,N>,XprSize> { enum { value = N }; }; #endif @@ -250,6 +250,10 @@ AllRange make_indexing(all_t , Index size) { return AllRange(size); } +template<int XprSize> struct get_compile_time_size<AllRange,XprSize> { + enum { value = XprSize }; +}; + } // end namespace internal } // end namespace Eigen diff --git a/Eigen/src/Core/IndexedView.h b/Eigen/src/Core/IndexedView.h index 7fc856feb..bc1eff8f9 100644 --- a/Eigen/src/Core/IndexedView.h +++ b/Eigen/src/Core/IndexedView.h @@ -19,8 +19,8 @@ struct traits<IndexedView<XprType, RowIndices, ColIndices> > : traits<XprType> { enum { - RowsAtCompileTime = get_compile_time_size<RowIndices>::value, - ColsAtCompileTime = get_compile_time_size<ColIndices>::value, + RowsAtCompileTime = get_compile_time_size<RowIndices,traits<XprType>::RowsAtCompileTime>::value, + ColsAtCompileTime = get_compile_time_size<ColIndices,traits<XprType>::ColsAtCompileTime>::value, MaxRowsAtCompileTime = RowsAtCompileTime != Dynamic ? int(RowsAtCompileTime) : int(traits<XprType>::MaxRowsAtCompileTime), MaxColsAtCompileTime = ColsAtCompileTime != Dynamic ? int(ColsAtCompileTime) : int(traits<XprType>::MaxColsAtCompileTime), |