#ifndef __arith_h__ #define __arith_h__ namespace MultiArrayTools { template struct ArgPack { template static inline auto mk(const Tuple& tp, As... as) -> decltype(ArgPack::mk(tp, std::get(tp), as...)) { return ArgPack::mk(tp, std::get(tp), as...); } }; template <> struct ArgPack<0> { template static inline auto mk(const Tuple& tp, As... as) -> decltype(F::apply(std::get<0>(tp), as...)) { return F::apply(std::get<0>(tp), as...); } }; template struct StaticFunctionBase { static constexpr bool FISSTATIC = true; typedef T value_type; template static auto mk(const Ops&... ops) -> Operation { return Operation(ops...); } static inline T apply(const std::tuple& arg) { return ArgPack::template mk >(arg); } }; // OPERATIONS (STATIC) template struct identity : public StaticFunctionBase, T> { //static constexpr bool FISSTATIC = true; using StaticFunctionBase, T>::apply; static inline T apply(T a) { return a; } }; template struct plus { static constexpr bool FISSTATIC = true; static inline T apply(T a1, T a2) { return a1 + a2; } }; template struct minus { static constexpr bool FISSTATIC = true; static inline T apply(T a1, T a2) { return a1 - a2; } }; template struct multiplies { static constexpr bool FISSTATIC = true; static inline T apply(T a1, T a2) { return a1 * a2; } }; template struct divides { static constexpr bool FISSTATIC = true; static inline T apply(T a1, T a2) { return a1 / a2; } }; /* template struct dynamic_function { static constexpr bool FISSTATIC = false; template inline T apply(Us... args) { return f(args...); } }; */ } // end namespace MultiArrayHelper #endif