cnorxz/src/arith.h
2018-02-06 13:44:15 +01:00

47 lines
701 B
C++

#ifndef __arith_h__
#define __arith_h__
namespace MultiArrayHelper
{
// OPERATIONS (STATIC)
template <typename T>
struct plus
{
static inline T& acc(T& target, const T& arg)
{
return target += arg;
}
};
template <typename T>
struct minus
{
static inline T& acc(T& target, const T& arg)
{
return target -= arg;
}
};
template <typename T>
struct multiplies
{
static inline T& acc(T& target, const T& arg)
{
return target *= arg;
}
};
template <typename T>
struct divides
{
static inline T& acc(T& target, const T& arg)
{
return target /= arg;
}
};
} // end namespace MultiArrayHelper
#endif