PandaRoot
vec_arithmetic.h
Go to the documentation of this file.
1 //****************************************************************************
2 //* This file is part of PandaRoot. *
3 //* *
4 //* PandaRoot is distributed under the terms of the *
5 //* GNU General Public License (GPL) version 3, *
6 //* copied verbatim in the file "LICENSE". *
7 //* *
8 //* Copyright (C) 2006 - 2024 FAIR GmbH and copyright holders of PandaRoot *
9 //* The copyright holders are listed in the file "COPYRIGHTHOLDERS". *
10 //* The authors are listed in the file "AUTHORS". *
11 //****************************************************************************
12 
13 #ifndef _vec_arithmetic_H_
14 #define _vec_arithmetic_H_
15 
16 /* Define all operators after definition of basic operators */
17 
18 #define vec_arithmetic(V, S) \
19  friend V operator-(const V &a) { return V(0) - a; } \
20  friend V operator+(const V &a) { return a; } \
21  friend V operator+(const V &a, const S &b) { return a + V(b); } \
22  friend V operator-(const V &a, const S &b) { return a - V(b); } \
23  friend V operator*(const V &a, const S &b) { return a * V(b); } \
24  friend V operator/(const V &a, const S &b) { return a / V(b); } \
25  friend V operator+(const S &a, const V &b) { return V(a) + b; } \
26  friend V operator-(const S &a, const V &b) { return V(a) - b; } \
27  friend V operator*(const S &a, const V &b) { return V(a) * b; } \
28  friend V operator/(const S &a, const V &b) { return V(a) / b; } \
29  friend void operator+=(V &a, const V &b) { a = a + b; } \
30  friend void operator-=(V &a, const V &b) { a = a - b; } \
31  friend void operator*=(V &a, const V &b) { a = a * b; } \
32  friend void operator/=(V &a, const V &b) { a = a / b; } \
33  friend void operator+=(V &a, const S &b) { a = a + b; } \
34  friend void operator-=(V &a, const S &b) { a = a - b; } \
35  friend void operator*=(V &a, const S &b) { a = a * b; } \
36  friend void operator/=(V &a, const S &b) { a = a / b; }
37 
38 #endif