2 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4 // + This file is part of enGrid. +
6 // + Copyright 2008-2013 enGits GmbH +
8 // + enGrid is free software: you can redistribute it and/or modify +
9 // + it under the terms of the GNU General Public License as published by +
10 // + the Free Software Foundation, either version 3 of the License, or +
11 // + (at your option) any later version. +
13 // + enGrid is distributed in the hope that it will be useful, +
14 // + but WITHOUT ANY WARRANTY; without even the implied warranty of +
15 // + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +
16 // + GNU General Public License for more details. +
18 // + You should have received a copy of the GNU General Public License +
19 // + along with enGrid. If not, see <http://www.gnu.org/licenses/>. +
21 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
26 static T
apply(const T
&a
, const T
&b
) { return a
+b
; };
32 static T
apply(const T
&a
, const T
&b
) { return a
-b
; };
38 static T
apply(const T
&a
, const T
&b
) { return a
*b
; };
41 template <class L
, class O
, class R
>
44 typedef typename
R::value_type value_type
;
47 ParseNode(const L
&a
, const R
&b
) : l(a
), r(b
) {};
48 value_type
operator[](const uint_t
&i
) const { return O::apply(l
[i
], r
[i
]); };
49 uint_t
size() const { return r
.size(); };
50 value_type
abs() const;
51 value_type
abs2() const;
54 template <class O
, class R
>
55 struct ParseNode
<double, O
, R
>
57 typedef typename
R::value_type value_type
;
60 ParseNode(const double a
, const R
&b
) : l(a
), r(b
) {};
61 value_type
operator[](const uint_t
&i
) const { return O::apply(l
, r
[i
]); };
62 uint_t
size() const { return r
.size(); };
63 value_type
abs() const;
64 value_type
abs2() const;