AFF --- A container for numbers (array) by Friederich and Forbriger.
absmax.h
Go to the documentation of this file.
1
36
// include guard
37
#ifndef AFF_ABSMAX_H_VERSION
38
39
#define AFF_ABSMAX_H_VERSION \
40
"AFF_ABSMAX_H V1.0 "
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
Extractabsmax
{
60
typedef
typename
C::Tcoc
Tcont
;
61
typedef
typename
C::Tvalue
Tvalue
;
62
public
:
63
typedef
Tvalue
Tretval
;
65
Extractabsmax
(
const
Tcont
& c):
Mval
(c(c.first()))
66
{
67
if
(
Mval
<0) {
Mval
= -
Mval
; }
68
}
70
void
operator()
(
const
Tvalue
& v)
71
{
72
Tvalue
av = v < 0 ? -v : v;
73
Mval
=
Mval
> av ?
Mval
: av;
74
}
76
Tretval
result
()
const
{
return
(
Mval
); }
77
private
:
78
Tvalue
Mval
;
79
};
// class Extractabsmax
80
81
}
// namespace util
82
83
/*----------------------------------------------------------------------*/
84
97
template
<
class
C>
98
typename
C::Tvalue
absmax
(
const
C& c)
99
{
100
return
(aff::func::util::collect<C, aff::func::util::Extractabsmax>(c));
101
}
// absmax()
102
103
}
// namespace func
104
105
}
// namespace aff
106
107
#endif // AFF_ABSMAX_H_VERSION (includeguard)
108
109
/* ----- END OF absmax.h ----- */
aff::func::util::Extractabsmax::operator()
void operator()(const Tvalue &v)
collect another value
Definition:
absmax.h:70
aff
Root namespace of library.
Definition:
array.h:148
collector.h
collect values (prototypes)
aff::func::util::Extractabsmax::Mval
Tvalue Mval
Definition:
absmax.h:78
aff::func::util::Extractabsmax::Tvalue
C::Tvalue Tvalue
Definition:
absmax.h:61
aff::func::util::Extractabsmax::Tcont
C::Tcoc Tcont
Definition:
absmax.h:60
aff::func::util::Extractabsmax::Tretval
Tvalue Tretval
Definition:
absmax.h:63
aff::func::util::Extractabsmax
Definition:
absmax.h:59
aff::func::absmax
C::Tvalue absmax(const C &c)
Definition:
absmax.h:98
aff::func::util::Extractabsmax::result
Tretval result() const
return result of operation
Definition:
absmax.h:76
aff::func::util::Extractabsmax::Extractabsmax
Extractabsmax(const Tcont &c)
initialize member data
Definition:
absmax.h:65
functions
absmax.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