mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-07-10 07:01:51 +08:00
Fix previous commits: disbale only problematic indexed view methods for old compilers instead of disabling everything.
Tested with gcc 4.7 (c++03) and gcc 4.8 (c++03 & c++11)
This commit is contained in:
parent
1ef30b8090
commit
4a4a72951f
@ -7,7 +7,6 @@
|
|||||||
// Public License v. 2.0. If a copy of the MPL was not distributed
|
// Public License v. 2.0. If a copy of the MPL was not distributed
|
||||||
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
#if EIGEN_HAS_INDEXED_VIEW
|
|
||||||
#if !defined(EIGEN_PARSED_BY_DOXYGEN)
|
#if !defined(EIGEN_PARSED_BY_DOXYGEN)
|
||||||
|
|
||||||
// This file is automatically included twice to generate const and non-const versions
|
// This file is automatically included twice to generate const and non-const versions
|
||||||
@ -113,6 +112,8 @@ operator()(const RowIndices& rowIndices, const ColIndices& colIndices) EIGEN_IND
|
|||||||
return Base::operator()(internal::eval_expr_given_size(rowIndices,rows()),internal::eval_expr_given_size(colIndices,cols()));
|
return Base::operator()(internal::eval_expr_given_size(rowIndices,rows()),internal::eval_expr_given_size(colIndices,cols()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if EIGEN_HAS_STATIC_ARRAY_TEMPLATE
|
||||||
|
|
||||||
// The folowing three overloads are needed to handle raw Index[N] arrays.
|
// The folowing three overloads are needed to handle raw Index[N] arrays.
|
||||||
|
|
||||||
template<typename RowIndicesT, std::size_t RowIndicesN, typename ColIndices>
|
template<typename RowIndicesT, std::size_t RowIndicesN, typename ColIndices>
|
||||||
@ -139,6 +140,8 @@ operator()(const RowIndicesT (&rowIndices)[RowIndicesN], const ColIndicesT (&col
|
|||||||
(derived(), rowIndices, colIndices);
|
(derived(), rowIndices, colIndices);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // EIGEN_HAS_STATIC_ARRAY_TEMPLATE
|
||||||
|
|
||||||
// Overloads for 1D vectors/arrays
|
// Overloads for 1D vectors/arrays
|
||||||
|
|
||||||
template<typename Indices>
|
template<typename Indices>
|
||||||
@ -182,6 +185,8 @@ operator()(const IndexType& id) EIGEN_INDEXED_VIEW_METHOD_CONST
|
|||||||
return Base::operator()(internal::eval_expr_given_size(id,size()));
|
return Base::operator()(internal::eval_expr_given_size(id,size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if EIGEN_HAS_STATIC_ARRAY_TEMPLATE
|
||||||
|
|
||||||
template<typename IndicesT, std::size_t IndicesN>
|
template<typename IndicesT, std::size_t IndicesN>
|
||||||
typename internal::enable_if<IsRowMajor,
|
typename internal::enable_if<IsRowMajor,
|
||||||
IndexedView<EIGEN_INDEXED_VIEW_METHOD_CONST Derived,IvcIndex,const IndicesT (&)[IndicesN]> >::type
|
IndexedView<EIGEN_INDEXED_VIEW_METHOD_CONST Derived,IvcIndex,const IndicesT (&)[IndicesN]> >::type
|
||||||
@ -202,6 +207,8 @@ operator()(const IndicesT (&indices)[IndicesN]) EIGEN_INDEXED_VIEW_METHOD_CONST
|
|||||||
(derived(), indices, IvcIndex(0));
|
(derived(), indices, IvcIndex(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // EIGEN_HAS_STATIC_ARRAY_TEMPLATE
|
||||||
|
|
||||||
#undef EIGEN_INDEXED_VIEW_METHOD_CONST
|
#undef EIGEN_INDEXED_VIEW_METHOD_CONST
|
||||||
#undef EIGEN_INDEXED_VIEW_METHOD_TYPE
|
#undef EIGEN_INDEXED_VIEW_METHOD_TYPE
|
||||||
|
|
||||||
@ -258,4 +265,3 @@ IndexedView_or_VectorBlock
|
|||||||
operator()(const Indices& indices);
|
operator()(const Indices& indices);
|
||||||
|
|
||||||
#endif // EIGEN_PARSED_BY_DOXYGEN
|
#endif // EIGEN_PARSED_BY_DOXYGEN
|
||||||
#endif // EIGEN_HAS_INDEXED_VIEW
|
|
||||||
|
@ -79,7 +79,6 @@ is_same_seq_type(const T1& a, const T2& b)
|
|||||||
|
|
||||||
void check_indexed_view()
|
void check_indexed_view()
|
||||||
{
|
{
|
||||||
#if EIGEN_HAS_INDEXED_VIEW
|
|
||||||
using Eigen::placeholders::all;
|
using Eigen::placeholders::all;
|
||||||
using Eigen::placeholders::last;
|
using Eigen::placeholders::last;
|
||||||
using Eigen::placeholders::end;
|
using Eigen::placeholders::end;
|
||||||
@ -298,6 +297,7 @@ void check_indexed_view()
|
|||||||
|
|
||||||
VERIFY_IS_APPROX( (A(std::array<int,3>{{1,3,5}}, std::array<int,4>{{9,6,3,0}})), A(seqN(1,3,2), seqN(9,4,-3)) );
|
VERIFY_IS_APPROX( (A(std::array<int,3>{{1,3,5}}, std::array<int,4>{{9,6,3,0}})), A(seqN(1,3,2), seqN(9,4,-3)) );
|
||||||
|
|
||||||
|
#if EIGEN_HAS_STATIC_ARRAY_TEMPLATE
|
||||||
VERIFY_IS_APPROX( A({3, 1, 6, 5}, all), A(std::array<int,4>{{3, 1, 6, 5}}, all) );
|
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(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_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}}) );
|
||||||
@ -310,6 +310,7 @@ void check_indexed_view()
|
|||||||
|
|
||||||
VERIFY_IS_APPROX( b({3, 1, 6, 5}), b(std::array<int,4>{{3, 1, 6, 5}}) );
|
VERIFY_IS_APPROX( b({3, 1, 6, 5}), b(std::array<int,4>{{3, 1, 6, 5}}) );
|
||||||
VERIFY_IS_EQUAL( b({1,3,5}).SizeAtCompileTime, 3 );
|
VERIFY_IS_EQUAL( b({1,3,5}).SizeAtCompileTime, 3 );
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -365,7 +366,6 @@ void check_indexed_view()
|
|||||||
VERIFY( is_same_eq( cA.middleRows<3>(1), cA.middleRows(1,fix<3>)) );
|
VERIFY( is_same_eq( cA.middleRows<3>(1), cA.middleRows(1,fix<3>)) );
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // EIGEN_HAS_INDEXED_VIEW
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_indexed_view()
|
void test_indexed_view()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user