diff --git a/src/include/multi_array_operation.h b/src/include/multi_array_operation.h index 6eb82b8..25d713e 100644 --- a/src/include/multi_array_operation.h +++ b/src/include/multi_array_operation.h @@ -24,9 +24,12 @@ namespace MultiArrayTools { using namespace MultiArrayHelper; } - + template - class OperationTemplate + class TypeSpecificOperationSet { /* empty per default; specialize if needed */ }; + + template + class OperationTemplate : public TypeSpecificOperationSet { public: @@ -52,7 +55,7 @@ namespace MultiArrayTools template auto c(std::shared_ptr& ind) const -> Contraction; - + private: friend OperationClass; OperationTemplate() = default; @@ -298,7 +301,30 @@ namespace MultiArrayTools template auto loop(Expr exp) const -> decltype(mInd->iforh(exp)); }; - + + template + struct operate + { + static inline OperationRoot + apply(const MultiArrayBase& ma, + const std::shared_ptr&... indices) + { + return OperationRoot(ma, indices...); + } + }; + + // interchange inheritance + // try to implement the 'promote' version + template + class TypeSpecificOperationSet,OperationClass> + { + auto operator()() const + -> Operation,operate,OperationClass> + { + return Operation,operate,OperationClass> + (/*THIS*/); + } + }; } /* ========================= *