26 #ifndef MLN_METAL_CONVERTS_TO_HH
27 # define MLN_METAL_CONVERTS_TO_HH
34 # include <mln/metal/is_a.hh>
35 # include <mln/metal/const.hh>
36 # include <mln/core/def/coord.hh>
39 # define mlc_converts_to(T, U) mln::metal::converts_to< T, U >
48 template <
unsigned n>
struct int_u;
49 template <
unsigned n>
struct int_s;
61 template <
typename T> eat(
const volatile T&);
62 template <
typename T> eat(T&);
65 template <
typename T,
typename U>
66 struct helper_converts_to_
68 static yes_ selector(U,
int);
69 static no_ selector(eat, ...);
77 template <
typename T,
typename U>
78 struct converts_to : bool_<( sizeof(internal::helper_converts_to_<T, U>
79 ::selector(*internal::make_<mlc_const(T)>::ptr(),
82 sizeof(internal::yes_) )>
86 template <
typename T,
typename U>
90 template <
typename T,
typename U>
91 struct converts_to<T**, U**> : false_
98 template <>
struct converts_to< float, int > : true_ {};
99 template <>
struct converts_to< float, def::
coord > : true_ {};
100 template <
unsigned n>
struct converts_to< float,
value::int_u<n> > : true_ {};
101 template <
unsigned n>
struct converts_to< float,
value::int_s<n> > : true_ {};
103 template <>
struct converts_to< double, int > : true_ {};
104 template <>
struct converts_to< double, def::
coord > : true_ {};
105 template <
unsigned n>
struct converts_to< double,
value::int_u<n> > : true_ {};
106 template <
unsigned n>
struct converts_to< double,
value::int_s<n> > : true_ {};
117 #endif // ! MLN_METAL_CONVERTS_TO_HH