diff --git a/src/include/functional_multi_array.h b/src/include/functional_multi_array.h index 4719b41..3a51fc7 100644 --- a/src/include/functional_multi_array.h +++ b/src/include/functional_multi_array.h @@ -47,7 +47,7 @@ namespace MultiArrayTools // EVALUTAION CLASS ??!!!! auto exec(std::shared_ptr&... inds) const - -> decltype( mkOperation( mFunc, ConstOperationRoot( indexToSlice( inds ), inds) ... ) ); + -> decltype( mkOperation( mFunc, ConstOperationRoot( indexToSlice( inds ), inds) ... ) ); virtual ConstOperationRoot operator()(std::shared_ptr&... inds) const override; @@ -157,9 +157,9 @@ namespace MultiArrayTools template auto FunctionalMultiArray:: exec(std::shared_ptr&... inds) const - -> decltype( mkOperation( mFunc, ConstOperationRoot( indexToSlice( inds ), inds) ... ) ) + -> decltype( mkOperation( mFunc, ConstOperationRoot( indexToSlice( inds ), inds) ... ) ) { - return mkOperation( mFunc, ConstOperationRoot( indexToSlice( inds ), inds ) ... ); + return mkOperation( mFunc, ConstOperationRoot( indexToSlice( inds ), inds ) ... ); } diff --git a/src/include/pack_num.h b/src/include/pack_num.h index a9d4adb..69cf12a 100644 --- a/src/include/pack_num.h +++ b/src/include/pack_num.h @@ -16,20 +16,22 @@ namespace MultiArrayHelper template struct Application { - template - static inline T apply(std::shared_ptr f, T a, Ts... as) + template + static inline auto apply(std::shared_ptr f, Ts... as) + -> decltype((*f)(as...)) { - return (*f)(a, as...); + return (*f)(as...); } }; template <> struct Application { - template - static inline T apply(std::shared_ptr f, T a, Ts... as) + template + static inline auto apply(std::shared_ptr f, Ts... as) + -> decltype(OpFunction::apply(as...)) { - return OpFunction::apply(a, as...); + return OpFunction::apply(as...); } }; @@ -74,7 +76,8 @@ namespace MultiArrayHelper typedef typename std::remove_reference(ops))>::type NextOpType; static_assert(LAST > NextOpType::SIZE, "inconsistent array positions"); static constexpr size_t NEXT = LAST - NextOpType::SIZE; - return PackNum::template mkOpExpr + typedef decltype(std::get(ops).get(Getter::template getX( pos ))) ArgT; + return PackNum::template mkOpExpr ( f, pos, ops, std::get(ops).get(Getter::template getX( pos )), args...); } @@ -136,7 +139,8 @@ namespace MultiArrayHelper typedef typename std::remove_reference(ops))>::type NextOpType; static constexpr size_t NEXT = LAST - NextOpType::SIZE; static_assert(NEXT == 0, "inconsistent array positions"); - return Application::apply(f, std::get<0>(ops).get(Getter<0>::template getX( pos )), args...); + typedef decltype(std::get<0>(ops).get(Getter<0>::template getX( pos ))) ArgT; + return Application::template apply(f, std::get<0>(ops).get(Getter<0>::template getX( pos )), args...); //return OpFunction::apply(std::get<0>(ops).get(Getter<0>::template getX( pos )), args...); }