olena-2.0-114-g2622f3b Rely on Argument-Dependent Lookup (ADL) in from_to_ overloads.

* mln/accu/count_labels.hh, * mln/convert/from_to.hxx, * mln/convert/to.hh, * mln/core/alias/point1d.hh, * mln/core/alias/point2d.hh, * mln/core/alias/point3d.hh, * mln/core/dpoint.hh, * mln/core/internal/neighborhood_base.hh, * mln/core/point.hh, * mln/core/site_set/p_centered.hh, * mln/core/site_set/p_vaccess.hh, * mln/fun/v2v/hsl_to_rgb.hh, * mln/fun/v2v/rgb_to_hsl.hh, * mln/io/magick/save.hh, * mln/io/plot/save.hh, * mln/labeling/blobs_and_compute.hh, * mln/labeling/value_and_compute.hh, * mln/make/w_window2d.hh, * mln/win/multiple.hh, * mln/win/multiple_size.hh, * tests/accu/site_set/rectangularity.cc, * tests/core/other/graph_elt_neighborhood.cc, * tests/core/other/graph_elt_window.cc, * tests/core/other/point_set_compatibility.cc, * tests/draw/graph.cc: Update forward declarations and includes. * mln/algebra/vec.hh, * mln/convert/from_to.hh, * mln/convert/impl/from_double_to_value.hh, * mln/convert/impl/from_float_to_value.hh, * mln/convert/impl/from_image_to_site_set.hh, * mln/convert/impl/from_int_to_value.hh, * mln/convert/impl/from_unsigned_to_value.hh, * mln/convert/impl/from_value_to_value.hh, * mln/core/alias/neighb2d.hh, * mln/core/alias/neighb3d.hh, * mln/core/alias/window1d.hh, * mln/core/alias/window2d.hh, * mln/core/alias/window3d.hh, * mln/core/concept/accumulator.hh, * mln/core/concept/gdpoint.hh, * mln/core/concept/gpoint.hh, * mln/core/concept/image.hh, * mln/core/concept/proxy.hh, * mln/core/concept/site_set.hh, * mln/core/concept/window.hh, * mln/core/image/graph_window_if_piter.hh, * mln/core/image/image1d.hh, * mln/core/mixed_neighb.hh, * mln/core/neighb.hh, * mln/core/site_set/operators.hh, * mln/core/w_window.hh, * mln/fun/i2v/array.hh, * mln/util/object_id.hh, * mln/value/hsl.hh, * mln/value/int_u.hh, * mln/value/label.hh, * mln/value/qt/rgb32.hh, * mln/value/rgb.hh, * mln/histo/array.hh, * mln/util/array.hh: Move from_to_ overloads in the same namespace as their first argument. Conflicts: milena/mln/convert/from_to.hh --- milena/ChangeLog | 67 ++++++++++++++++++++++++++++++++++++++ milena/mln/convert/from_to.hh | 25 +++++++++----- milena/mln/core/concept/proxy.hh | 6 ++-- 3 files changed, 86 insertions(+), 12 deletions(-) diff --git a/milena/ChangeLog b/milena/ChangeLog index 21114eb..de897eb 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,3 +1,70 @@ +2012-05-10 Guillaume Lazzara <z@lrde.epita.fr> + + Rely on Argument-Dependent Lookup (ADL) in from_to_ overloads. + + * mln/accu/count_labels.hh, + * mln/convert/from_to.hxx, + * mln/convert/to.hh, + * mln/core/alias/point1d.hh, + * mln/core/alias/point2d.hh, + * mln/core/alias/point3d.hh, + * mln/core/dpoint.hh, + * mln/core/internal/neighborhood_base.hh, + * mln/core/point.hh, + * mln/core/site_set/p_centered.hh, + * mln/core/site_set/p_vaccess.hh, + * mln/fun/v2v/hsl_to_rgb.hh, + * mln/fun/v2v/rgb_to_hsl.hh, + * mln/io/magick/save.hh, + * mln/io/plot/save.hh, + * mln/labeling/blobs_and_compute.hh, + * mln/labeling/value_and_compute.hh, + * mln/make/w_window2d.hh, + * mln/win/multiple.hh, + * mln/win/multiple_size.hh, + * tests/accu/site_set/rectangularity.cc, + * tests/core/other/graph_elt_neighborhood.cc, + * tests/core/other/graph_elt_window.cc, + * tests/core/other/point_set_compatibility.cc, + * tests/draw/graph.cc: Update forward declarations and includes. + + * mln/algebra/vec.hh, + * mln/convert/from_to.hh, + * mln/convert/impl/from_double_to_value.hh, + * mln/convert/impl/from_float_to_value.hh, + * mln/convert/impl/from_image_to_site_set.hh, + * mln/convert/impl/from_int_to_value.hh, + * mln/convert/impl/from_unsigned_to_value.hh, + * mln/convert/impl/from_value_to_value.hh, + * mln/core/alias/neighb2d.hh, + * mln/core/alias/neighb3d.hh, + * mln/core/alias/window1d.hh, + * mln/core/alias/window2d.hh, + * mln/core/alias/window3d.hh, + * mln/core/concept/accumulator.hh, + * mln/core/concept/gdpoint.hh, + * mln/core/concept/gpoint.hh, + * mln/core/concept/image.hh, + * mln/core/concept/proxy.hh, + * mln/core/concept/site_set.hh, + * mln/core/concept/window.hh, + * mln/core/image/graph_window_if_piter.hh, + * mln/core/image/image1d.hh, + * mln/core/mixed_neighb.hh, + * mln/core/neighb.hh, + * mln/core/site_set/operators.hh, + * mln/core/w_window.hh, + * mln/fun/i2v/array.hh, + * mln/util/object_id.hh, + * mln/value/hsl.hh, + * mln/value/int_u.hh, + * mln/value/label.hh, + * mln/value/qt/rgb32.hh, + * mln/value/rgb.hh, + * mln/histo/array.hh, + * mln/util/array.hh: Move from_to_ overloads in the same namespace + as their first argument. + 2012-05-22 Guillaume Lazzara <z@lrde.epita.fr> * demos/graph/region_adjacency_graph.cc: Add program arguments. diff --git a/milena/mln/convert/from_to.hh b/milena/mln/convert/from_to.hh index 272a47d..a3ec6d4 100644 --- a/milena/mln/convert/from_to.hh +++ b/milena/mln/convert/from_to.hh @@ -102,6 +102,7 @@ namespace mln to = from; } + // Object -> Object (F not convertible towards T) // No conversion exists! template <typename F, typename T> @@ -116,15 +117,6 @@ namespace mln } - // Object -> Object - template <typename T> - inline - void - from_to_(const Object<T>& from, Object<T>& to) - { - exact(to) = exact(from); - } - namespace convert { @@ -208,6 +200,21 @@ namespace mln exact(from), exact(to)); } + // Object -> Object + template <typename T> + inline + void + from_to_dispatch(const Object<T>& from, Object<T>& to) + { + // // Here we would like to call from_to_ overloads in order + // to let the user specify its own conversion + // function. However, doing so may lead to ambiguous + // prototypes between from_to_(Object<>, Object<>) and + // from_to_(T, T). + // from_to_(exact(from), exact(to)); + exact(to) = exact(from); + } + // Dispatch entry points. diff --git a/milena/mln/core/concept/proxy.hh b/milena/mln/core/concept/proxy.hh index 8c4d2e9..43aed15 100644 --- a/milena/mln/core/concept/proxy.hh +++ b/milena/mln/core/concept/proxy.hh @@ -186,7 +186,7 @@ namespace mln // Disambiguate between (Proxy Op Object) and (Object Op Literal). - + template < template <class, class> class Op, typename P, typename L > struct set_binary_< Op, mln::Proxy, P, mln::Literal, L > @@ -229,7 +229,7 @@ namespace mln typedef q_subject; q_subject subj_(); */ - + protected: Proxy(); }; @@ -261,7 +261,7 @@ namespace mln template <typename T> typename mln::internal::unproxy_rec_<const T>::ret unproxy_rec(const T& t); - + // operator << -- 1.7.2.5
participants (1)
-
Guillaume Lazzara