26 #ifndef MLN_VALUE_INTERNAL_VALUE_LIKE_HH
27 # define MLN_VALUE_INTERNAL_VALUE_LIKE_HH
33 # include <mln/core/concept/value.hh>
34 # include <mln/core/internal/force_exact.hh>
50 template <
typename V,
76 C& handle_() {
return v_; }
86 template <
typename V,
typename C,
typename N,
typename E>
87 bool operator==(
const value_like_<V,C,N,E>& lhs,
const value_like_<V,C,N,E>& rhs);
93 template <
typename V,
typename C,
typename N,
typename E>
94 bool operator<(const value_like_<V,C,N,E>& lhs,
const value_like_<V,C,N,E>& rhs);
97 # ifndef MLN_INCLUDE_ONLY
99 template <
typename V,
typename C,
typename N,
typename E>
102 value_like_<V,C,N,E>::to_equiv()
const
107 template <
typename V,
typename C,
typename N,
typename E>
110 value_like_<V,C,N,E>::to_enc()
const
115 template <
typename V,
typename C,
typename N,
typename E>
118 value_like_<V,C,N,E>::to_interop()
const
120 return static_cast<N
>(mln::internal::force_exact<E>(*this));
123 template <
typename V,
typename C,
typename N,
typename E>
125 bool operator==(
const value_like_<V,C,N,E>& lhs,
126 const value_like_<V,C,N,E>& rhs)
128 return lhs.to_enc() == rhs.to_enc();
131 template <
typename V,
typename C,
typename N,
typename E>
133 bool operator<(const value_like_<V,C,N,E>& lhs,
134 const value_like_<V,C,N,E>& rhs)
136 return lhs.to_interop() < rhs.to_interop();
139 # endif // ! MLN_INCLUDE_ONLY
148 #endif // ! MLN_VALUE_INTERNAL_VALUE_LIKE_HH