CbmRoot
littrack/parallel/vectors/vec_arithmetic.h
Go to the documentation of this file.
1 #ifndef LIT_VEC_ARITHMETIC_H
2 #define LIT_VEC_ARITHMETIC_H
3 
4 /* Define all operators after definition of basic operators */
5 
6 #define vec_arithmetic(V, S) \
7  friend V operator-(const V& a) { return V(0) - a; } \
8  friend V operator+(const V& a) { return a; } \
9  friend V operator+(const V& a, const S& b) { return a + V(b); } \
10  friend V operator-(const V& a, const S& b) { return a - V(b); } \
11  friend V operator*(const V& a, const S& b) { return a * V(b); } \
12  friend V operator/(const V& a, const S& b) { return a / V(b); } \
13  friend V operator+(const S& a, const V& b) { return V(a) + b; } \
14  friend V operator-(const S& a, const V& b) { return V(a) - b; } \
15  friend V operator*(const S& a, const V& b) { return V(a) * b; } \
16  friend V operator/(const S& a, const V& b) { return V(a) / b; } \
17  friend void operator+=(V& a, const V& b) { a = a + b; } \
18  friend void operator-=(V& a, const V& b) { a = a - b; } \
19  friend void operator*=(V& a, const V& b) { a = a * b; } \
20  friend void operator/=(V& a, const V& b) { a = a / b; } \
21  friend void operator+=(V& a, const S& b) { a = a + b; } \
22  friend void operator-=(V& a, const S& b) { a = a - b; } \
23  friend void operator*=(V& a, const S& b) { a = a * b; } \
24  friend void operator/=(V& a, const S& b) { a = a / b; }
25 
26 #endif