41 lines
1.2 KiB
C++
41 lines
1.2 KiB
C++
#ifndef PFOR_PFOR_INDEX_OP_H
|
|
#define PFOR_PFOR_INDEX_OP_H
|
|
|
|
#include <utility>
|
|
|
|
#define PFOR_INDEX_DEF_OPERATION_UNARY(OPNAME, OPSYM) \
|
|
struct OPNAME { \
|
|
template<typename Rhs> \
|
|
inline static decltype(auto) eval(Rhs&& rhs) { \
|
|
return OPSYM std::forward<Rhs>(rhs); \
|
|
} \
|
|
}
|
|
|
|
#define PFOR_INDEX_DEF_OPERATION_BINARY(OPNAME, OPSYM) \
|
|
struct OPNAME { \
|
|
template<typename Lhs, typename Rhs> \
|
|
inline static decltype(auto) eval(Lhs&& lhs, Rhs&& rhs) { \
|
|
return std::forward<Lhs>(lhs) OPSYM std::forward<Rhs>(rhs); \
|
|
} \
|
|
}
|
|
|
|
namespace pfor {
|
|
namespace index {
|
|
namespace op {
|
|
|
|
PFOR_INDEX_DEF_OPERATION_UNARY(Minus, -);
|
|
|
|
PFOR_INDEX_DEF_OPERATION_BINARY(Addition, +);
|
|
PFOR_INDEX_DEF_OPERATION_BINARY(Subtraction, -);
|
|
PFOR_INDEX_DEF_OPERATION_BINARY(Multiplication, *);
|
|
// PFOR_INDEX_DEF_OPERATION_BINARY(Division, /);
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
#undef PFOR_INDEX_DEF_OPERATION_BINARY
|
|
#undef PFOR_INDEX_DEF_OPERATION_UNARY
|
|
|
|
#endif
|