26 #ifndef MLN_CORE_INTERNAL_EXACT_HH
27 # define MLN_CORE_INTERNAL_EXACT_HH
52 struct no_ {
char dummy[2]; };
60 template <
unsigned id,
typename T>
64 struct exact_ret_< 1, T >
66 typedef typename T::exact_t ret;
70 struct exact_ret_< 2, T >
76 yes_ exact_selector_(Object<E>*);
78 no_ exact_selector_(
void*);
80 template <
typename E,
typename T>
81 E* exact_run_(Object<E>* t, T*);
84 T* exact_run_(
void*, T* t);
89 enum {
id =
sizeof(exact_selector_(make_<T>::ptr())) };
90 typedef exact_ret_<id, T> helper;
91 typedef typename helper::ret ret;
94 return exact_run_(t, t);
99 struct exact_<const T>
101 enum {
id =
sizeof(exact_selector_(make_<T>::ptr())) };
102 typedef exact_ret_<id, T> helper;
103 typedef const typename helper::ret ret;
104 static ret* run(
const T* t)
106 return exact_run_((T*)t, (T*)t);
111 # ifndef MLN_INCLUDE_ONLY
113 template <
typename T>
122 template <
typename E,
typename T>
124 E* exact_run_(Object<E>* t, T*)
129 template <
typename T>
131 T* exact_run_(
void*, T* t)
136 # endif // ! MLN_INCLUDE_ONLY
142 # include <mln/core/concept/object.hh>
144 #endif // ! MLN_CORE_INTERNAL_EXACT_HH