* mln/fun/vv2v/max.hh,
* mln/fun/vv2v/mean.hh,
* mln/fun/vv2v/min.hh: Here.
---
milena/ChangeLog | 8 ++++++++
milena/mln/fun/vv2v/max.hh | 23 ++++++++++++-----------
milena/mln/fun/vv2v/mean.hh | 17 ++++++++---------
milena/mln/fun/vv2v/min.hh | 24 ++++++++++++------------
4 files changed, 40 insertions(+), 32 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 7052b67..bc5e138 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,3 +1,11 @@
+2012-10-22 Guillaume Lazzara <z(a)lrde.epita.fr>
+
+ Fix return type in functions.
+
+ * mln/fun/vv2v/max.hh,
+ * mln/fun/vv2v/mean.hh,
+ * mln/fun/vv2v/min.hh: Here.
+
2012-10-19 Guillaume Lazzara <z(a)lrde.epita.fr>
New comparison functions.
diff --git a/milena/mln/fun/vv2v/max.hh b/milena/mln/fun/vv2v/max.hh
index 8d4a4d9..b04eb68 100644
--- a/milena/mln/fun/vv2v/max.hh
+++ b/milena/mln/fun/vv2v/max.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2008, 2009, 2012 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -42,25 +43,25 @@ namespace mln
namespace vv2v
{
- // FIXME: Doc.
-
/// \brief A functor computing the maximum of two values.
- template <typename V>
- struct max : public Function_vv2v< max<V> >
+ template <typename V, typename R = V>
+ struct max : public Function_vv2v< max<V,R> >,
+ private mlc_converts_to(R,V)::check_t
{
- typedef V result;
- V operator()(const V& v1, const V& v2) const;
+ typedef R result;
+ typedef V argument;
+ R operator()(const V& v1, const V& v2) const;
};
# ifndef MLN_INCLUDE_ONLY
- template <typename V>
+ template <typename V, typename R>
inline
- V
- max<V>::operator()(const V& v1, const V& v2) const
+ R
+ max<V,R>::operator()(const V& v1, const V& v2) const
{
- return mln::math::max(v1, v2);
+ return R(mln::math::max(v1, v2));
}
# endif // ! MLN_INCLUDE_ONLY
diff --git a/milena/mln/fun/vv2v/mean.hh b/milena/mln/fun/vv2v/mean.hh
index 510b9a6..65e9f63 100644
--- a/milena/mln/fun/vv2v/mean.hh
+++ b/milena/mln/fun/vv2v/mean.hh
@@ -43,26 +43,25 @@ namespace mln
namespace vv2v
{
- // FIXME: Doc.
-
/// \brief A functor computing the mean of two values.
- template <typename L, typename R = L>
- struct mean : public Function_vv2v< mean<L,R> >,
- private mlc_converts_to(R,L)::check_t
+ template <typename V, typename R = V>
+ struct mean : public Function_vv2v< mean<V,R> >,
+ private mlc_converts_to(R,V)::check_t
{
typedef R result;
- R operator()(const L& v1, const L& v2) const;
+ typedef V argument;
+ R operator()(const V& v1, const V& v2) const;
};
# ifndef MLN_INCLUDE_ONLY
- template <typename L, typename R>
+ template <typename V, typename R>
inline
R
- mean<L,R>::operator()(const L& v1, const L& v2) const
+ mean<V,R>::operator()(const V& v1, const V& v2) const
{
- return R(mln::math::mean(v1, v2);
+ return R(mln::math::mean(v1, v2));
}
# endif // ! MLN_INCLUDE_ONLY
diff --git a/milena/mln/fun/vv2v/min.hh b/milena/mln/fun/vv2v/min.hh
index 0f885fc..d43981f 100644
--- a/milena/mln/fun/vv2v/min.hh
+++ b/milena/mln/fun/vv2v/min.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2008, 2009, 2012 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -43,26 +44,25 @@ namespace mln
namespace vv2v
{
- // FIXME: Doc.
-
/// \brief A functor computing the minimum of two values.
- template <typename L, typename R = L>
- struct min : public Function_vv2v< min<L,R> >,
- private mlc_converts_to(R,L)::check_t
+ template <typename V, typename R = V>
+ struct min : public Function_vv2v< min<V,R> >,
+ private mlc_converts_to(R,V)::check_t
{
- typedef L result;
- L operator()(const L& v1, const R& v2) const;
+ typedef R result;
+ typedef V argument;
+ R operator()(const V& v1, const V& v2) const;
};
# ifndef MLN_INCLUDE_ONLY
- template <typename L, typename R>
+ template <typename V, typename R>
inline
- L
- min<L,R>::operator()(const L& v1, const R& v2) const
+ R
+ min<V,R>::operator()(const V& v1, const V& v2) const
{
- return mln::math::min(v1, L(v2));
+ return R(mln::math::min(v1, v2));
}
# endif // ! MLN_INCLUDE_ONLY
--
1.7.2.5