Make Ref<> suitable for both Matrix and Array kinds. Note that Matrix kind objects can be implicitely converted to an Array kind Ref<> and vice versa

This commit is contained in:
Gael Guennebaud 2012-09-22 11:11:26 +02:00
parent 7e0dd17312
commit 7740127e3d

View File

@ -195,12 +195,12 @@ template<typename PlainObjectType, int Options, typename StrideType> class Ref
Base::construct(expr); Base::construct(expr);
} }
template<typename Derived> template<typename Derived>
inline Ref(const MatrixBase<Derived>& expr, inline Ref(const DenseBase<Derived>& expr,
typename internal::enable_if<bool(internal::is_lvalue<Derived>::value&&bool(Traits::template match<Derived>::MatchAtCompileTime)),Derived>::type* = 0, typename internal::enable_if<bool(internal::is_lvalue<Derived>::value&&bool(Traits::template match<Derived>::MatchAtCompileTime)),Derived>::type* = 0,
int = Derived::ThisConstantIsPrivateInPlainObjectBase) int = Derived::ThisConstantIsPrivateInPlainObjectBase)
#else #else
template<typename Derived> template<typename Derived>
inline Ref(MatrixBase<Derived>& expr) inline Ref(DenseBase<Derived>& expr)
#endif #endif
{ {
Base::construct(expr.const_cast_derived()); Base::construct(expr.const_cast_derived());
@ -221,7 +221,7 @@ template<typename PlainObjectType, int Options, typename StrideType> class Ref<c
EIGEN_DENSE_PUBLIC_INTERFACE(Ref) EIGEN_DENSE_PUBLIC_INTERFACE(Ref)
template<typename Derived> template<typename Derived>
inline Ref(const MatrixBase<Derived>& expr) inline Ref(const DenseBase<Derived>& expr)
{ {
// std::cout << match_helper<Derived>::HasDirectAccess << "," << match_helper<Derived>::OuterStrideMatch << "," << match_helper<Derived>::InnerStrideMatch << "\n"; // std::cout << match_helper<Derived>::HasDirectAccess << "," << match_helper<Derived>::OuterStrideMatch << "," << match_helper<Derived>::InnerStrideMatch << "\n";
// std::cout << int(StrideType::OuterStrideAtCompileTime) << " - " << int(Derived::OuterStrideAtCompileTime) << "\n"; // std::cout << int(StrideType::OuterStrideAtCompileTime) << " - " << int(Derived::OuterStrideAtCompileTime) << "\n";