10 template<
class TOUT,
class TIN>
20 template<
class FN,
class... X>
21 inline friend TOUT
apply(FN fn,
const TIN &v,
const X &... x) {
23 for (
size_t idx = 0; idx < v.size(); idx++) {
24 vout[idx] = fn(v[idx], x[idx]...);
35 inline friend TOUT
operator+(
const TIN &v1,
const TIN &v2) {
36 auto v =
apply(std::plus<double>(), v1, v2);
40 inline friend TOUT
operator-(
const TIN &v1,
const TIN &v2) {
41 return apply(std::minus<double>(), v1, v2);
44 inline friend TOUT
operator*(
const TIN &v1,
const TIN &v2) {
45 return apply(std::multiplies<double>(), v1, v2);
48 inline friend TOUT
operator/(
const TIN &v1,
const TIN &v2) {
49 return apply(std::divides<double>(), v1, v2);
53 return apply(std::negate<double>(), v);
62 inline friend TOUT
operator*(
double c,
const TIN &v2) {
63 return apply([c](
double x) {
return x * c; }, v2);
66 inline friend TOUT
operator/(
const TIN &v1,
double c) {
friend TOUT apply(FN fn, const TIN &v, const X &... x)
apply Anwendung einer Rechenvorschrift auf eine beliebige Anzahl von Vektoren
static void error_if(const std::string &s, bool arg)
error_if Fehler wenn Bedingung erfüllt ist
friend TOUT operator*(double c, const TIN &v2)
Implementierung der Operatoren *,/.
friend TOUT operator+(const TIN &v1, const TIN &v2)
Implementierung der Operatoren +,-,*,/.
friend TOUT operator-(const TIN &v1, const TIN &v2)
The IVCalc1 class Implementierung von +,-,*,/ (binär)
friend TOUT operator-(const TIN &v)
friend TOUT operator/(const TIN &v1, const TIN &v2)
friend TOUT operator/(const TIN &v1, double c)
friend TOUT operator*(const TIN &v1, const TIN &v2)