BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
vec_arithmetic.h
Go to the documentation of this file.
1#ifndef _vec_arithmetic_H_
2#define _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) \
8 { \
9 return V(0) - a; \
10 } \
11 friend V operator+(const V& a) \
12 { \
13 return a; \
14 } \
15 friend V operator+(const V& a, const S& b) \
16 { \
17 return a + V(b); \
18 } \
19 friend V operator-(const V& a, const S& b) \
20 { \
21 return a - V(b); \
22 } \
23 friend V operator*(const V& a, const S& b) \
24 { \
25 return a * V(b); \
26 } \
27 friend V operator/(const V& a, const S& b) \
28 { \
29 return a / V(b); \
30 } \
31 friend V operator+(const S& a, const V& b) \
32 { \
33 return V(a) + b; \
34 } \
35 friend V operator-(const S& a, const V& b) \
36 { \
37 return V(a) - b; \
38 } \
39 friend V operator*(const S& a, const V& b) \
40 { \
41 return V(a) * b; \
42 } \
43 friend V operator/(const S& a, const V& b) \
44 { \
45 return V(a) / b; \
46 } \
47 friend void operator+=(V& a, const V& b) \
48 { \
49 a = a + b; \
50 } \
51 friend void operator-=(V& a, const V& b) \
52 { \
53 a = a - b; \
54 } \
55 friend void operator*=(V& a, const V& b) \
56 { \
57 a = a * b; \
58 } \
59 friend void operator/=(V& a, const V& b) \
60 { \
61 a = a / b; \
62 } \
63 friend void operator+=(V& a, const S& b) \
64 { \
65 a = a + b; \
66 } \
67 friend void operator-=(V& a, const S& b) \
68 { \
69 a = a - b; \
70 } \
71 friend void operator*=(V& a, const S& b) \
72 { \
73 a = a * b; \
74 } \
75 friend void operator/=(V& a, const S& b) \
76 { \
77 a = a / b; \
78 }
79
80#endif