AFF --- A container for numbers (array) by Friederich and Forbriger.
max.h
Go to the documentation of this file.
1
36
// include guard
37
#ifndef AFF_MAX_H_VERSION
38
39
#define AFF_MAX_H_VERSION \
40
"AFF_MAX_H V1.1 "
41
42
#include<
aff/lib/collector.h
>
43
44
namespace
aff
{
45
46
namespace
func {
47
48
namespace
util {
49
57
template
<
class
C>
58
class
Extractmax
{
59
typedef
typename
C::Tcoc
Tcont
;
60
typedef
typename
C::Tvalue
Tvalue
;
61
public
:
62
typedef
Tvalue
Tretval
;
64
Extractmax
(
const
Tcont
& c):
Mval
(c(c.first())) { }
66
void
operator()
(
const
Tvalue
& v)
67
{
Mval
=
Mval
> v ?
Mval
: v; }
69
Tretval
result
()
const
{
return
(
Mval
); }
70
private
:
71
Tvalue
Mval
;
72
};
// class Extractmax
73
74
}
// namespace util
75
76
/*----------------------------------------------------------------------*/
77
88
template
<
class
C>
89
typename
C::Tvalue
max
(
const
C& c)
90
{
91
return
(aff::func::util::collect<C, aff::func::util::Extractmax>(c));
92
}
// max()
93
94
}
// namespace func
95
96
}
// namespace aff
97
98
#endif // AFF_MAX_H_VERSION (includeguard)
99
100
/* ----- END OF max.h ----- */
aff
Root namespace of library.
Definition:
array.h:148
collector.h
collect values (prototypes)
aff::func::util::Extractmax::Mval
Tvalue Mval
Definition:
max.h:71
aff::func::util::Extractmax::Tretval
Tvalue Tretval
Definition:
max.h:62
aff::func::util::Extractmax::Tvalue
C::Tvalue Tvalue
Definition:
max.h:60
aff::func::util::Extractmax::result
Tretval result() const
return result of operation
Definition:
max.h:69
aff::func::util::Extractmax::operator()
void operator()(const Tvalue &v)
collect another value
Definition:
max.h:66
aff::func::max
C::Tvalue max(const C &c)
Definition:
max.h:89
aff::func::util::Extractmax
Definition:
max.h:58
aff::func::util::Extractmax::Extractmax
Extractmax(const Tcont &c)
initialize member data
Definition:
max.h:64
aff::func::util::Extractmax::Tcont
C::Tcoc Tcont
Definition:
max.h:59
functions
max.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