PhysicsTools
Utilities
interface
Sum.h
Go to the documentation of this file.
1
#ifndef PhysicsTools_Utilities_Sum_h
2
#define PhysicsTools_Utilities_Sum_h
3
#include "
PhysicsTools/Utilities/interface/Numerical.h
"
4
5
namespace
funct
{
6
template
<
typename
A,
typename
B>
7
struct
SumStruct
{
8
SumStruct
(
const
A
&
a
,
const
B
&
b
) :
_1
(
a
),
_2
(
b
) {}
9
double
operator()
()
const
{
return
_1
() +
_2
(); }
10
operator
double()
const
{
return
_1
() +
_2
(); }
11
double
operator()
(
double
x)
const
{
return
_1
(x) +
_2
(x); }
12
double
operator()
(
double
x,
double
y)
const
{
return
_1
(x, y) +
_2
(x, y); }
13
A
_1
;
14
B
_2
;
15
};
16
17
template
<
typename
A,
typename
B>
18
struct
Sum
{
19
typedef
SumStruct<A, B>
type
;
20
static
type
combine
(
const
A
&
a
,
const
B
&
b
) {
return
type
(
a
,
b
); }
21
};
22
23
template
<
typename
A,
typename
B>
24
inline
typename
Sum<A, B>::type
operator+
(
const
A
&
a
,
const
B
&
b
) {
25
return
Sum<A, B>::combine
(
a
,
b
);
26
}
27
28
}
// namespace funct
29
30
#endif
funct::Sum::combine
static type combine(const A &a, const B &b)
Definition:
Sum.h:20
funct::B
TEMPL(T2) struct Divides B
Definition:
Factorize.h:29
funct::SumStruct::SumStruct
SumStruct(const A &a, const B &b)
Definition:
Sum.h:8
funct::operator+
Sum< A, B >::type operator+(const A &a, const B &b)
Definition:
Sum.h:24
Numerical.h
b
double b
Definition:
hdecay.h:118
funct::SumStruct::operator()
double operator()() const
Definition:
Sum.h:9
a
double a
Definition:
hdecay.h:119
A
funct::SumStruct::operator()
double operator()(double x) const
Definition:
Sum.h:11
funct::SumStruct::_2
B _2
Definition:
Sum.h:14
funct::Sum::type
SumStruct< A, B > type
Definition:
Sum.h:19
funct::SumStruct
Definition:
Sum.h:7
funct::Sum
Definition:
Sum.h:18
funct::SumStruct::operator()
double operator()(double x, double y) const
Definition:
Sum.h:12
funct
Definition:
Abs.h:5
funct::SumStruct::_1
A _1
Definition:
Sum.h:13
Generated for CMSSW Reference Manual by
1.8.16