26 #ifndef MLN_FUN_I2V_VALUE_AT_INDEX_HH
27 # define MLN_FUN_I2V_VALUE_AT_INDEX_HH
33 # include <mln/core/concept/function.hh>
34 # include <mln/trait/value_.hh>
47 struct value_at_index : Function_v2v< value_at_index<T> >,
48 private metal::bool_<(mln_dim(T) == 1)>::check_t
51 T operator()(
unsigned i)
const;
55 struct value_at_index<bool> : Function_v2v< value_at_index<bool> >
58 bool operator()(
unsigned i)
const;
62 # ifndef MLN_INCLUDE_ONLY
67 value_at_index<T>::operator()(
unsigned i)
const
69 return T(
int(mln_min(T)) +
int(i) );
74 value_at_index<bool>::operator()(
unsigned i)
const
76 mln_precondition(i < 2);
77 return i == 1u ?
true :
false;
80 # endif // ! MLN_INCLUDE_ONLY
88 #endif // ! MLN_FUN_I2V_VALUE_AT_INDEX_HH