extra operation to function
This commit is contained in:
parent
5fdf6970c9
commit
709e30a4a1
3 changed files with 21 additions and 0 deletions
|
@ -86,6 +86,11 @@ namespace MultiArrayTools
|
|||
{
|
||||
return a1 + a2;
|
||||
}
|
||||
|
||||
static inline T& selfApply(T& a1, const T& a2)
|
||||
{
|
||||
return a1 += a2;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
|
|
|
@ -97,6 +97,18 @@ namespace MultiArrayTools
|
|||
return out;
|
||||
}
|
||||
|
||||
template <typename T, class OperationClass>
|
||||
template <class AOp, class... Indices>
|
||||
auto OperationBase<T,OperationClass>::oto(const AOp& aop,
|
||||
const std::shared_ptr<Indices>&... inds) const
|
||||
-> MultiArray<T,typename Indices::RangeType...>
|
||||
{
|
||||
MultiArray<T,typename Indices::RangeType...> out(inds->range()...,
|
||||
static_cast<T>(0));
|
||||
AOp::selfApply(out(inds...), THIS());
|
||||
return out;
|
||||
}
|
||||
|
||||
template <typename T, class OperationClass>
|
||||
template <typename R, class... Args>
|
||||
auto OperationBase<T,OperationClass>::a(const std::shared_ptr<function<R,T,typename Args::value_type...>>& ll,
|
||||
|
|
|
@ -69,6 +69,10 @@ namespace MultiArrayTools
|
|||
auto to(const std::shared_ptr<Indices>&... inds) const
|
||||
-> MultiArray<T,typename Indices::RangeType...>;
|
||||
|
||||
template <class AOp, class... Indices>
|
||||
auto oto(const AOp& aop, const std::shared_ptr<Indices>&... inds) const
|
||||
-> MultiArray<T,typename Indices::RangeType...>;
|
||||
|
||||
template <typename R, class... Args> // Args = Operation Classes
|
||||
auto a(const std::shared_ptr<function<R,T,typename Args::value_type...>>& ll, const Args&... args) const
|
||||
-> Operation<R,function<R,T,typename Args::value_type...>,OperationClass, Args...>;
|
||||
|
|
Loading…
Reference in a new issue