
https://svn.lrde.epita.fr/svn/oln/trunk/milena Index: ChangeLog from Thierry Geraud <thierry.geraud@lrde.epita.fr> Minor fixes. * mln/accu/mean.hh (to_result): Make it work even if it is not valid. That is a safety when computing mean values of a collection of labels. * mln/value/label.hh: Fix missing forward declaration. * mln/fun/i2v/array.hh: Upgrade file doc style. accu/mean.hh | 2 ++ fun/i2v/array.hh | 3 +++ value/label.hh | 6 ++++-- 3 files changed, 9 insertions(+), 2 deletions(-) Index: mln/accu/mean.hh --- mln/accu/mean.hh (revision 3350) +++ mln/accu/mean.hh (working copy) @@ -151,6 +151,8 @@ mean<T,S,M>::to_result() const { unsigned n = count_.to_result(); + if (n == 0u) + return M(); // Safety. return static_cast<M>(sum_.to_result() / n); } Index: mln/value/label.hh --- mln/value/label.hh (revision 3350) +++ mln/value/label.hh (working copy) @@ -1,4 +1,5 @@ -// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2007, 2008, 2009 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of the Olena Library. This library is free // software; you can redistribute it and/or modify it under the terms @@ -44,9 +45,10 @@ namespace mln { - // Forward declaration. + // Forward declarations. namespace value { template <unsigned n> struct label; + template <unsigned n> struct int_u; } namespace literal { Index: mln/fun/i2v/array.hh --- mln/fun/i2v/array.hh (revision 3350) +++ mln/fun/i2v/array.hh (working copy) @@ -34,6 +34,9 @@ /// /// \todo Change design so that there is no multiple inheritance: /// array<T> : internal::array_base<T, E==array<T> > : Function_i2v<E> +/// +/// \todo We should convert (with from_to) arrays that do not hold the +/// same element type, e.g., int_u8 -> int or vec<3,f> -> rgb8. # include <vector> # include <algorithm>