This commit is contained in:
Christian Zimmermann 2018-05-15 21:18:21 +02:00
parent 66be374688
commit 92bb02be21

View file

@ -26,7 +26,10 @@ namespace MultiArrayTools
} }
template <typename T, class OperationClass> template <typename T, class OperationClass>
class OperationTemplate class TypeSpecificOperationSet { /* empty per default; specialize if needed */ };
template <typename T, class OperationClass>
class OperationTemplate : public TypeSpecificOperationSet<T,OperationClass>
{ {
public: public:
@ -299,6 +302,29 @@ namespace MultiArrayTools
auto loop(Expr exp) const -> decltype(mInd->iforh(exp)); auto loop(Expr exp) const -> decltype(mInd->iforh(exp));
}; };
template <typename T, class... Ranges>
struct operate
{
static inline OperationRoot<T,Ranges...>
apply(const MultiArrayBase<T,Ranges...>& ma,
const std::shared_ptr<typename Ranges::IndexType>&... indices)
{
return OperationRoot<T,Ranges...>(ma, indices...);
}
};
// interchange inheritance
// try to implement the 'promote' version
template <class OperationClass, typename T, class... Ranges>
class TypeSpecificOperationSet<MultiArray<T,Ranges...>,OperationClass>
{
auto operator()() const
-> Operation<OperationRoot<T,Ranges...>,operate<T,Ranges...>,OperationClass>
{
return Operation<OperationRoot<T,Ranges...>,operate<T,Ranges...>,OperationClass>
(/*THIS*/);
}
};
} }
/* ========================= * /* ========================= *