cnorxz/src/arith.h

48 lines
701 B
C
Raw Normal View History

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