26 #ifndef MLN_FUN_V2I_INDEX_OF_VALUE_HH
27 # define MLN_FUN_V2I_INDEX_OF_VALUE_HH
33 # include <mln/core/concept/function.hh>
34 # include <mln/trait/value_.hh>
47 struct index_of_value : Function_v2v< index_of_value<T> >,
48 private metal::bool_<(mln_dim(T) == 1)>::check_t
50 typedef unsigned result;
51 unsigned operator()(
const T& v)
const;
55 struct index_of_value<bool> : Function_v2v< index_of_value<bool> >
57 typedef unsigned result;
58 unsigned operator()(
bool b)
const;
63 meta_index_of_value(
const T& v);
66 # ifndef MLN_INCLUDE_ONLY
71 index_of_value<T>::operator()(
const T& v)
const
73 return unsigned(
int(v) -
int(mln_min(T)) );
77 unsigned index_of_value<bool>::operator()(
bool b)
const
85 meta_index_of_value(
const T& v)
91 # endif // ! MLN_INCLUDE_ONLY
99 #endif // ! MLN_FUN_V2I_INDEX_OF_VALUE_HH