27 #ifndef MLN_CONVERT_FROM_TO_HH
28 # define MLN_CONVERT_FROM_TO_HH
40 # include <mln/convert/impl/all.hh>
42 # include <mln/metal/abort.hh>
43 # include <mln/metal/converts_to.hh>
44 # include <mln/metal/is.hh>
45 # include <mln/metal/is_a.hh>
47 # include <mln/value/cast.hh>
53 template <
typename E>
struct Object;
54 template <
typename E>
struct Value;
55 template <
typename E>
struct Site_Set;
56 template <
typename E>
struct Image;
61 template <
typename F,
typename T>
71 # ifndef MLN_INCLUDE_ONLY
84 template <
typename F,
typename T>
89 to = mln::value::cast<T>(from);
108 template <
typename F,
typename T>
110 from_to_(
const Object<F>&, Object<T>&)
116 mlc_abort(F)::check();
129 template <
typename I,
typename S>
132 from_to_dispatch(
const Image<I>& from, Site_Set<S>&
to)
134 mlc_is(mln_trait_site_set_contents(S),
135 mln::trait::site_set::contents::dynamic)::check();
136 mln_precondition(
exact(from).is_valid());
142 template <
typename S,
typename I>
145 from_to_dispatch(
const Site_Set<S>& from, Image<I>& to)
147 mlc_converts_to(mln_site(S), mln_site(I))::check();
148 mln_precondition(
exact(from).is_valid());
154 template <
typename F,
typename T>
157 from_to_dispatch(
const Value<F>& from, Value<T>& to)
168 template <
typename F,
typename T>
172 const Object<F>& from, Object<T>& to)
179 template <
typename F,
typename T>
183 const Object<F>& from, Object<T>& to)
193 template <
typename F,
typename T>
196 from_to_dispatch(
const Object<F>& from, Object<T>& to)
198 typedef mlc_converts_to(F,
T) F_converts_to_T;
199 internal::from_to_dispatch(F_converts_to_T(),
204 template <typename
T>
207 from_to_dispatch(const Object<
T>& from, Object<
T>& to)
224 template <
typename F,
typename T>
235 template <
typename F,
typename T>
246 template <
typename F,
typename T>
256 template <
typename F,
typename T>
262 internal::from_to_dispatch(
exact(from),
exact(to));
271 template <
typename F,
typename T>
276 typedef mlc_is_a(F, Object) F_is_object;
277 typedef mlc_is_a(
T, Object) T_is_object;
278 internal::from_to_dispatch(F_is_object(), from,
287 # endif // ! MLN_INCLUDE_ONLY
290 #endif // ! MLN_CONVERT_FROM_TO_HH