From 92bb02be215e83870626e63d4b8b20d0aec92daf Mon Sep 17 00:00:00 2001 From: Christian Zimmermann Date: Tue, 15 May 2018 21:18:21 +0200 Subject: [PATCH] im com --- src/include/multi_array_operation.h | 34 +++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) 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*/); + } + }; } /* ========================= *