2018-01-15 18:31:47 +01:00
|
|
|
|
|
|
|
#ifndef __arith_h__
|
|
|
|
#define __arith_h__
|
|
|
|
|
|
|
|
namespace MultiArrayHelper
|
|
|
|
{
|
|
|
|
// OPERATIONS (STATIC)
|
|
|
|
template <typename T>
|
|
|
|
struct plus
|
|
|
|
{
|
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-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-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-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
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
} // end namespace MultiArrayHelper
|
|
|
|
|
|
|
|
#endif
|