cnorxz/src/include/arith.h

67 lines
1,021 B
C
Raw Normal View History

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