
* mln/convert/impl/from_unsigned_to_value.hh, * mln/value/label.hh: Here. --- milena/ChangeLog | 7 +++++ milena/mln/convert/impl/from_unsigned_to_value.hh | 26 ++++++++++++++++----- milena/mln/value/label.hh | 20 ++++++++++++++- 3 files changed, 45 insertions(+), 8 deletions(-) diff --git a/milena/ChangeLog b/milena/ChangeLog index 2eed916..f0a3aea 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,3 +1,10 @@ +2011-03-14 Guillaume Lazzara <z@lrde.epita.fr> + + Add more from_to overloards. + + * mln/convert/impl/from_unsigned_to_value.hh, + * mln/value/label.hh: Here. + 2011-03-01 Guillaume Lazzara <z@lrde.epita.fr> * mln/labeling/fill_holes.hh: Improve speed. diff --git a/milena/mln/convert/impl/from_unsigned_to_value.hh b/milena/mln/convert/impl/from_unsigned_to_value.hh index 4d4fc3a..783b5e9 100644 --- a/milena/mln/convert/impl/from_unsigned_to_value.hh +++ b/milena/mln/convert/impl/from_unsigned_to_value.hh @@ -1,5 +1,5 @@ -// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory -// (LRDE) +// Copyright (C) 2009, 2010, 2011 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of Olena. // @@ -48,11 +48,15 @@ namespace mln namespace convert { - /// Conversion of an unsigned \p from towards a value \p to. - template <typename V> - void - from_to(const unsigned& from, Value<V>& to); + /// Conversion of an unsigned \p from towards a value \p to. + template <typename V> + void + from_to(const unsigned& from, Value<V>& to); + /// Conversion of an unsigned \p from towards a bool \p to. + inline + void + from_to_(const unsigned& from, bool& to); # ifndef MLN_INCLUDE_ONLY @@ -120,6 +124,16 @@ namespace mln } + // Facades. + // unsigned-> bool + inline + void + from_to_(const unsigned& from, bool& to) + { + to = (from != 0u); + } + + } // end of namespace mln::convert::over_load diff --git a/milena/mln/value/label.hh b/milena/mln/value/label.hh index 7491ae5..5c983e5 100644 --- a/milena/mln/value/label.hh +++ b/milena/mln/value/label.hh @@ -1,5 +1,5 @@ -// Copyright (C) 2007, 2008, 2009, 2010 EPITA Research and Development -// Laboratory (LRDE) +// Copyright (C) 2007, 2008, 2009, 2010, 2011 EPITA Research and +// Development Laboratory (LRDE) // // This file is part of Olena. // @@ -119,6 +119,11 @@ namespace mln void from_to_(const value::label<n>& from, bool& to_); + // label -> unsigned. + template <unsigned n> + void + from_to_(const value::label<n>& from, unsigned& to_); + } // end of namespace mln::convert::over_load } // end of namespace mln::convert @@ -233,6 +238,7 @@ namespace mln to_ = from; } + // int_u<n> -> bool template <unsigned n> inline void @@ -241,6 +247,16 @@ namespace mln to_ = (from != 0u); } + // int_u<n> -> unsigned + template <unsigned n> + inline + void + from_to_(const value::label<n>& from, unsigned& to_) + { + to_ = from; + } + + } // end of namespace mln::convert::over_load } // end of namespace mln::convert -- 1.5.6.5