AFF --- A container for numbers (array) by Friederich and Forbriger.
sqrsum.h
Go to the documentation of this file.
1
35
// include guard
36
#ifndef AFF_SQRSUM_H_VERSION
37
38
#define AFF_SQRSUM_H_VERSION \
39
"AFF_SQRSUM_H V1.0 "
40
41
42
#include<
aff/lib/collector.h
>
43
44
namespace
aff
{
45
46
namespace
func {
47
48
namespace
util {
49
58
template
<
class
C>
59
class
Extractsqrsum
{
60
typedef
typename
C::Tcoc
Tcont
;
61
typedef
typename
C::Tvalue
Tvalue
;
62
public
:
63
typedef
Tvalue
Tretval
;
65
Extractsqrsum
(
const
Tcont
& c):
Msum
(0),
Mn
(0) { }
67
void
operator()
(
const
Tvalue
& v) {
Msum
+=(v*v); ++
Mn
; }
69
Tretval
result
()
const
{
return
(
Msum
); }
70
private
:
71
Tvalue
Msum
;
72
int
Mn
;
73
};
// class Extractsqrsum
74
75
}
// namespace util
76
77
/*----------------------------------------------------------------------*/
78
89
template
<
class
C>
90
typename
C::Tvalue
sqrsum
(
const
C& c)
91
{
92
return
(aff::func::util::collect<C, aff::func::util::Extractsqrsum>(c));
93
}
// sqrsum()
94
95
}
// namespace func
96
97
}
// namespace aff
98
99
#endif // AFF_SQRSUM_H_VERSION (includeguard)
100
101
/* ----- END OF sqrsum.h ----- */
aff
Root namespace of library.
Definition:
array.h:148
collector.h
collect values (prototypes)
aff::func::util::Extractsqrsum::Tvalue
C::Tvalue Tvalue
Definition:
sqrsum.h:61
aff::func::util::Extractsqrsum::Mn
int Mn
Definition:
sqrsum.h:72
aff::func::util::Extractsqrsum::Tcont
C::Tcoc Tcont
Definition:
sqrsum.h:60
aff::func::util::Extractsqrsum::Tretval
Tvalue Tretval
Definition:
sqrsum.h:63
aff::func::sqrsum
C::Tvalue sqrsum(const C &c)
Definition:
sqrsum.h:90
aff::func::util::Extractsqrsum::Msum
Tvalue Msum
Definition:
sqrsum.h:71
aff::func::util::Extractsqrsum::result
Tretval result() const
return result of operation
Definition:
sqrsum.h:69
aff::func::util::Extractsqrsum::Extractsqrsum
Extractsqrsum(const Tcont &c)
initialize member data
Definition:
sqrsum.h:65
aff::func::util::Extractsqrsum::operator()
void operator()(const Tvalue &v)
collect another value
Definition:
sqrsum.h:67
aff::func::util::Extractsqrsum
Definition:
sqrsum.h:59
functions
sqrsum.h
Generated on Mon Aug 21 2023 17:36:08 for AFF --- A container for numbers (array) by Friederich and Forbriger. by
1.8.14