diff --git a/src/include/multi_array_operation.cc.h b/src/include/multi_array_operation.cc.h index 79a3568..d6d44aa 100644 --- a/src/include/multi_array_operation.cc.h +++ b/src/include/multi_array_operation.cc.h @@ -187,7 +187,7 @@ namespace MultiArrayTools */ template AssignmentExpr::AssignmentExpr(T* dataPtr, const AccessTemplate& dataAcc, const Target& tar, const OpClass& sec) : - mTar(tar), mSec(sec), mDataAcc(dataAcc), mDataPtr(dataPtr) {} + mTar(tar), mSec(sec), mDataAcc(static_cast(dataAcc)), mDataPtr(dataPtr) {} template inline void AssignmentExpr::operator()(size_t start) @@ -195,25 +195,13 @@ namespace MultiArrayTools ExtType last = rootSteps(); last.zero(); // TODO: ask MA container for data (ptr)!!! - //mDataAcc.template exec(opIndexResolve(start,last),mSec,last.next()); - assert(mDataAcc.get(0) != nullptr); - assert(mDataAcc.oget(0) != nullptr); - assert(mDataPtr == mDataAcc.oget(0)); - IOp::f(mDataAcc.oget(0),opIndexResolve(start,last),mSec,last.next()); - //IOp::f(mDataPtr,opIndexResolve(start,last),mSec,last.next()); + mDataAcc.template exec(opIndexResolve(start,last),mSec,last.next()); } template inline void AssignmentExpr::operator()(size_t start, ExtType last) { - //PointerAccess pa(mDataPtr, mDataPtr); - //pa.template exec(opIndexResolve(start,last),mSec,last.next()); - //mDataAcc.template exec(opIndexResolve(start,last),mSec,last.next()); - assert(mDataAcc.get(0) != nullptr); - assert(mDataAcc.oget(0) != nullptr); - assert(mDataPtr == mDataAcc.oget(0)); - IOp::f(mDataAcc.oget(0),opIndexResolve(start,last),mSec,last.next()); - //IOp::f(mDataPtr,opIndexResolve(start,last),mSec,last.next()); + mDataAcc.template exec(opIndexResolve(start,last),mSec,last.next()); } template diff --git a/src/include/multi_array_operation.h b/src/include/multi_array_operation.h index 70115b5..ad5bc45 100644 --- a/src/include/multi_array_operation.h +++ b/src/include/multi_array_operation.h @@ -219,7 +219,12 @@ namespace MultiArrayTools { public: typedef AccessClass AC; - + + AccessTemplate(const AccessTemplate& in) = default; + AccessTemplate(AccessTemplate&& in) = default; + AccessTemplate& operator=(const AccessTemplate& in) = default; + AccessTemplate& operator=(AccessTemplate&& in) = default; + AccessClass& THIS() { return static_cast(*this); } const AccessClass& THIS() const { return static_cast(*this); } @@ -240,6 +245,8 @@ namespace MultiArrayTools public: typedef T value_type; typedef T in_type; + + friend class AccessTemplate>; private: PointerAccess() = default; @@ -247,12 +254,13 @@ namespace MultiArrayTools T* mOrigPtr = nullptr; public: - PointerAccess(T* ptr, T* origPtr) : mPtr(ptr), mOrigPtr(origPtr) {} + PointerAccess(T* ptr, T* origPtr) : mPtr(ptr), mOrigPtr(origPtr) + { assert(mPtr != nullptr); assert(mOrigPtr != nullptr); } PointerAccess(const PointerAccess& in) = default; PointerAccess(PointerAccess&& in) = default; PointerAccess& operator=(const PointerAccess& in) = default; PointerAccess& operator=(PointerAccess&& in) = default; - + T* get(size_t pos) { return mPtr+pos; } T* get(size_t pos) const { return mPtr+pos; } PointerAccess& set(size_t pos) { mPtr = mOrigPtr + pos; return *this; } @@ -292,7 +300,7 @@ namespace MultiArrayTools Target mTar; OpClass mSec; - AccessTemplate mDataAcc; + AT mDataAcc; T* mDataPtr; public: