aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Core/MapBase.h
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2009-03-09 19:23:31 +0000
committerGravatar Gael Guennebaud <g.gael@free.fr>2009-03-09 19:23:31 +0000
commitdb6c3d0197144638ced6ff97d2b6f2e8aef61cd4 (patch)
treee17f98f429cd84077a0290226f15cfa6cc7ca0d6 /Eigen/src/Core/MapBase.h
parent3f80c68be52543d1463eec4461c3b79f49f33ed9 (diff)
fix MapBase's ForceAligned concept which was not working at all....
Diffstat (limited to 'Eigen/src/Core/MapBase.h')
-rw-r--r--Eigen/src/Core/MapBase.h24
1 files changed, 23 insertions, 1 deletions
diff --git a/Eigen/src/Core/MapBase.h b/Eigen/src/Core/MapBase.h
index 7014f27f6..d4d99a167 100644
--- a/Eigen/src/Core/MapBase.h
+++ b/Eigen/src/Core/MapBase.h
@@ -65,9 +65,20 @@ template<typename Derived> class MapBase
inline int stride() const { return derived().stride(); }
inline const Scalar* data() const { return m_data; }
+ template<bool IsForceAligned,typename Dummy> struct force_aligned_impl {
+ AlignedDerivedType static run(MapBase& a) { return a.derived(); }
+ };
+
+ template<typename Dummy> struct force_aligned_impl<false,Dummy> {
+ AlignedDerivedType static run(MapBase& a) { return a.derived()._convertToForceAligned(); }
+ };
+
/** \returns an expression equivalent to \c *this but having the \c PacketAccess constant
* set to \c ForceAligned. Must be reimplemented by the derived class. */
- AlignedDerivedType forceAligned() { return derived().forceAligned(); }
+ AlignedDerivedType forceAligned()
+ {
+ return force_aligned_impl<int(PacketAccess)==int(ForceAligned),Derived>::run(*this);
+ }
inline const Scalar& coeff(int row, int col) const
{
@@ -155,6 +166,17 @@ template<typename Derived> class MapBase
&& cols > 0 && (ColsAtCompileTime == Dynamic || ColsAtCompileTime == cols)));
}
+ Derived& operator=(const MapBase& other)
+ {
+ return Base::operator=(other);
+ }
+
+ template<typename OtherDerived>
+ Derived& operator=(const MatrixBase<OtherDerived>& other)
+ {
+ return Base::operator=(other);
+ }
+
template<typename OtherDerived>
Derived& operator+=(const MatrixBase<OtherDerived>& other)
{ return derived() = forceAligned() + other; }