last-svn-commit-591-g85d4bb7 mln/convert/from_to.hh: Make use of value::cast for conversions between built-in types.

--- milena/ChangeLog | 5 +++++ milena/mln/convert/from_to.hh | 11 +++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/milena/ChangeLog b/milena/ChangeLog index 77ad3a4..9cbc2db 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,5 +1,10 @@ 2010-11-15 Guillaume Lazzara <z@lrde.epita.fr> + * mln/convert/from_to.hh: Make use of value::cast for conversions + between built-in types. + +2010-11-15 Guillaume Lazzara <z@lrde.epita.fr> + * mln/data/paste_without_localization.hh: Add a missing dispatch overload. diff --git a/milena/mln/convert/from_to.hh b/milena/mln/convert/from_to.hh index 692d88f..fa57ac3 100644 --- a/milena/mln/convert/from_to.hh +++ b/milena/mln/convert/from_to.hh @@ -1,4 +1,5 @@ -// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2008, 2009, 2010 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of Olena. // @@ -44,6 +45,7 @@ # include <mln/metal/is.hh> # include <mln/metal/is_a.hh> +# include <mln/value/cast.hh> namespace mln { @@ -156,7 +158,12 @@ namespace mln from_to_dispatch(metal::false_, const F& from, metal::false_, T& to) { - over_load::from_to_(from, to); + to = mln::value::cast<T>(from); + + // We prefer using value::cast instead of a from_to_ overload. + // We don't want to write explicitly every from_to_ overload + // for all built-in types. + // over_load::from_to_(from, to); } -- 1.5.6.5
participants (1)
-
Guillaume Lazzara