mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-04-23 10:09:36 +08:00
Add support for plain arrays for columns and both rows/columns
This commit is contained in:
parent
76e183bd52
commit
233dff1b35
@ -569,10 +569,24 @@ template<typename Derived> class DenseBase
|
||||
template<typename RowIndicesT, std::size_t RowIndicesN, typename ColIndices>
|
||||
IndexedView<const Derived,const RowIndicesT (&)[RowIndicesN],typename internal::MakeIndexing<ColIndices>::type>
|
||||
operator()(const RowIndicesT (&rowIndices)[RowIndicesN], const ColIndices& colIndices) const {
|
||||
return IndexedView<const Derived,const RowIndicesT (&) [RowIndicesN],typename internal::MakeIndexing<ColIndices>::type>(
|
||||
return IndexedView<const Derived,const RowIndicesT (&)[RowIndicesN],typename internal::MakeIndexing<ColIndices>::type>(
|
||||
derived(), rowIndices, internal::make_indexing(colIndices,derived().cols()));
|
||||
}
|
||||
|
||||
template<typename RowIndices, typename ColIndicesT, std::size_t ColIndicesN>
|
||||
IndexedView<const Derived,typename internal::MakeIndexing<RowIndices>::type, const ColIndicesT (&)[ColIndicesN]>
|
||||
operator()(const RowIndices& rowIndices, const ColIndicesT (&colIndices)[ColIndicesN]) const {
|
||||
return IndexedView<const Derived,typename internal::MakeIndexing<RowIndices>::type,const ColIndicesT (&)[ColIndicesN]>(
|
||||
derived(), internal::make_indexing(rowIndices,derived().rows()), colIndices);
|
||||
}
|
||||
|
||||
template<typename RowIndicesT, std::size_t RowIndicesN, typename ColIndicesT, std::size_t ColIndicesN>
|
||||
IndexedView<const Derived,const RowIndicesT (&)[RowIndicesN], const ColIndicesT (&)[ColIndicesN]>
|
||||
operator()(const RowIndicesT (&rowIndices)[RowIndicesN], const ColIndicesT (&colIndices)[ColIndicesN]) const {
|
||||
return IndexedView<const Derived,const RowIndicesT (&)[RowIndicesN],const ColIndicesT (&)[ColIndicesN]>(
|
||||
derived(), rowIndices, colIndices);
|
||||
}
|
||||
|
||||
#define EIGEN_CURRENT_STORAGE_BASE_CLASS Eigen::DenseBase
|
||||
#define EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL
|
||||
#define EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(COND)
|
||||
|
@ -148,6 +148,11 @@ void check_indexed_view()
|
||||
|
||||
#if (!EIGEN_COMP_CLANG) || (EIGEN_COMP_CLANG>=308 && !defined(__apple_build_version__))
|
||||
VERIFY_IS_APPROX( A({3, 1, 6, 5}, all), A(std::array<int,4>{{3, 1, 6, 5}}, all) );
|
||||
VERIFY_IS_APPROX( A(all,{3, 1, 6, 5}), A(all,std::array<int,4>{{3, 1, 6, 5}}) );
|
||||
VERIFY_IS_APPROX( A({1,3,5},{3, 1, 6, 5}), A(std::array<int,3>{{1,3,5}},std::array<int,4>{{3, 1, 6, 5}}) );
|
||||
|
||||
VERIFY_IS_EQUAL( A({1,3,5},{3, 1, 6, 5}).RowsAtCompileTime, 3 );
|
||||
VERIFY_IS_EQUAL( A({1,3,5},{3, 1, 6, 5}).ColsAtCompileTime, 4 );
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user