multi_array_operation: replace template spec by static if
This commit is contained in:
parent
c282cf683d
commit
ffb8e71dbd
1 changed files with 25 additions and 34 deletions
|
@ -592,43 +592,34 @@ namespace MultiArrayTools
|
||||||
return this->template asx<IPlus<T>>(in,i);
|
return this->template asx<IPlus<T>>(in,i);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <bool VABLE = false>
|
template <bool VABLE, template <typename> class F, typename TarOp, class OpClass>
|
||||||
struct VExec
|
inline void vexec(TarOp& th, const OpClass& in)
|
||||||
{
|
{
|
||||||
template <template <typename> class F, typename TarOp, class OpClass>
|
if constexpr(VABLE){
|
||||||
static inline void exec(TarOp& th, const OpClass& in)
|
CHECK;
|
||||||
{
|
typedef typename TarOp::value_type T;
|
||||||
typedef typename TarOp::value_type T;
|
auto x = th.template asx<IVAccess<T,F<T>>>(in);
|
||||||
IAccess<T,F<T>> tmp;
|
if(x.rootSteps(x.vI()) == 1){
|
||||||
th.template asx<decltype(tmp)>(in)();
|
//if(0){
|
||||||
}
|
CHECK;
|
||||||
};
|
x();
|
||||||
|
}
|
||||||
template <>
|
else {
|
||||||
struct VExec<true>
|
th.template asx<IAccess<T,F<T>>>(in)();
|
||||||
{
|
}
|
||||||
template <template <typename> class F, typename TarOp, class OpClass>
|
}
|
||||||
static inline void exec(TarOp& th, const OpClass& in)
|
else {
|
||||||
{
|
typedef typename TarOp::value_type T;
|
||||||
CHECK;
|
IAccess<T,F<T>> tmp;
|
||||||
typedef typename TarOp::value_type T;
|
th.template asx<decltype(tmp)>(in)();
|
||||||
auto x = th.template asx<IVAccess<T,F<T>>>(in);
|
}
|
||||||
if(x.rootSteps(x.vI()) == 1){
|
}
|
||||||
//if(0){
|
|
||||||
CHECK;
|
|
||||||
x();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
th.template asx<IAccess<T,F<T>>>(in)();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <typename T, class... Ranges>
|
template <typename T, class... Ranges>
|
||||||
template <class OpClass>
|
template <class OpClass>
|
||||||
OperationRoot<T,Ranges...>& OperationRoot<T,Ranges...>::operator=(const OpClass& in)
|
OperationRoot<T,Ranges...>& OperationRoot<T,Ranges...>::operator=(const OpClass& in)
|
||||||
{
|
{
|
||||||
VExec<OpClass::VABLE>::template exec<identity>(*this,in);
|
vexec<OpClass::VABLE,identity>(*this,in);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -636,7 +627,7 @@ namespace MultiArrayTools
|
||||||
template <class OpClass>
|
template <class OpClass>
|
||||||
OperationRoot<T,Ranges...>& OperationRoot<T,Ranges...>::operator+=(const OpClass& in)
|
OperationRoot<T,Ranges...>& OperationRoot<T,Ranges...>::operator+=(const OpClass& in)
|
||||||
{
|
{
|
||||||
VExec<OpClass::VABLE>::template exec<xxxplus>(*this,in);
|
vexec<OpClass::VABLE,xxxplus>(*this,in);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -807,7 +798,7 @@ namespace MultiArrayTools
|
||||||
template <class OpClass>
|
template <class OpClass>
|
||||||
ParallelOperationRoot<T,Ranges...>& ParallelOperationRoot<T,Ranges...>::operator=(const OpClass& in)
|
ParallelOperationRoot<T,Ranges...>& ParallelOperationRoot<T,Ranges...>::operator=(const OpClass& in)
|
||||||
{
|
{
|
||||||
VExec<OpClass::VABLE>::template exec<identity>(*this,in);
|
vexec<OpClass::VABLE,identity>(*this,in);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -815,7 +806,7 @@ namespace MultiArrayTools
|
||||||
template <class OpClass>
|
template <class OpClass>
|
||||||
ParallelOperationRoot<T,Ranges...>& ParallelOperationRoot<T,Ranges...>::operator+=(const OpClass& in)
|
ParallelOperationRoot<T,Ranges...>& ParallelOperationRoot<T,Ranges...>::operator+=(const OpClass& in)
|
||||||
{
|
{
|
||||||
VExec<OpClass::VABLE>::template exec<xxxplus>(*this,in);
|
vexec<OpClass::VABLE,xxxplus>(*this,in);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue