diff --git a/src/include/multi_array_operation.h b/src/include/multi_array_operation.h index a22f0d6..7d1b602 100644 --- a/src/include/multi_array_operation.h +++ b/src/include/multi_array_operation.h @@ -482,14 +482,14 @@ namespace MultiArrayTools private: const Op& mOp; - mutable MultiArray mCont; + mutable std::shared_ptr > mCont; mutable OperationRoot mTarOp; public: typedef decltype(mOp.rootSteps(0)) ETuple; SliceContraction(const Op& op, std::shared_ptr... ind); - + template inline const value_type& get(ET pos) const; @@ -1011,8 +1011,9 @@ namespace MultiArrayTools SliceContraction::SliceContraction(const Op& op, std::shared_ptr... ind) : mOp(op), - mCont(ind->range()...), - mTarOp(mCont,ind...) {} + mCont(std::make_shared >(ind->range()...)), + mTarOp(*mCont,ind...) + { } // forward loop !!!! template @@ -1020,9 +1021,10 @@ namespace MultiArrayTools inline const MultiArray& SliceContraction::get(ET pos) const { - mCont *= 0; // grrr - mTarOp = mOp.set(pos); // SET FUNCTION!! - return mCont; + *mCont = 0; + mOp.set(pos); + mTarOp = mOp; + return *mCont; } template