2018-01-15 18:31:47 +01:00
|
|
|
|
|
|
|
#ifndef __arith_h__
|
|
|
|
#define __arith_h__
|
|
|
|
|
|
|
|
namespace MultiArrayHelper
|
|
|
|
{
|
|
|
|
// OPERATIONS (STATIC)
|
|
|
|
template <typename T>
|
|
|
|
struct plus
|
|
|
|
{
|
2018-03-21 19:18:57 +01:00
|
|
|
static constexpr bool FISSTATIC = true;
|
|
|
|
|
2018-02-13 18:18:17 +01:00
|
|
|
static inline T apply(T a1, T a2)
|
2018-01-15 18:31:47 +01:00
|
|
|
{
|
2018-02-13 18:18:17 +01:00
|
|
|
return a1 + a2;
|
2018-01-15 18:31:47 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
struct minus
|
|
|
|
{
|
2018-03-21 19:18:57 +01:00
|
|
|
static constexpr bool FISSTATIC = true;
|
|
|
|
|
2018-02-13 18:18:17 +01:00
|
|
|
static inline T apply(T a1, T a2)
|
2018-01-15 18:31:47 +01:00
|
|
|
{
|
2018-02-13 18:18:17 +01:00
|
|
|
return a1 - a2;
|
2018-01-15 18:31:47 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
struct multiplies
|
|
|
|
{
|
2018-03-21 19:18:57 +01:00
|
|
|
static constexpr bool FISSTATIC = true;
|
|
|
|
|
2018-02-13 18:18:17 +01:00
|
|
|
static inline T apply(T a1, T a2)
|
2018-01-15 18:31:47 +01:00
|
|
|
{
|
2018-02-13 18:18:17 +01:00
|
|
|
return a1 * a2;
|
2018-01-15 18:31:47 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
struct divides
|
|
|
|
{
|
2018-03-21 19:18:57 +01:00
|
|
|
static constexpr bool FISSTATIC = true;
|
|
|
|
|
2018-02-13 18:18:17 +01:00
|
|
|
static inline T apply(T a1, T a2)
|
2018-01-15 18:31:47 +01:00
|
|
|
{
|
2018-02-13 18:18:17 +01:00
|
|
|
return a1 / a2;
|
2018-01-15 18:31:47 +01:00
|
|
|
}
|
|
|
|
};
|
2018-03-21 19:18:57 +01:00
|
|
|
/*
|
2018-03-19 18:38:53 +01:00
|
|
|
template <typename T, class Func>
|
|
|
|
struct dynamic_function
|
|
|
|
{
|
2018-03-21 19:18:57 +01:00
|
|
|
static constexpr bool FISSTATIC = false;
|
|
|
|
|
2018-03-19 18:38:53 +01:00
|
|
|
template <typename... Us>
|
2018-03-21 19:18:57 +01:00
|
|
|
inline T apply(Us... args)
|
2018-03-19 18:38:53 +01:00
|
|
|
{
|
|
|
|
return f(args...);
|
|
|
|
}
|
2018-03-21 19:18:57 +01:00
|
|
|
};
|
|
|
|
*/
|
2018-01-15 18:31:47 +01:00
|
|
|
} // end namespace MultiArrayHelper
|
|
|
|
|
|
|
|
#endif
|