26 #ifndef MLN_FUN_UNARY_HH
27 # define MLN_FUN_UNARY_HH
29 # include <mln/core/concept/meta_function.hh>
30 # include <mln/fun/spe/unary.hh>
31 # include <mln/trait/next/solve.hh>
51 template <
typename F,
typename E = F>
55 typedef mln_trait_fun_param(flag) param;
56 typedef mln_trait_fun_storage(flag) storage;
60 typedef mln_trait_nunary(internal::unary_with<F>, T) def;
61 typedef typename def::ret ret;
65 typename with<T>::ret::result operator()(const T& v)
const
67 return with<T>::def::call(exact(*
this), v);
71 typename with<T>::ret::template lresult_with<T>::ret operator()(T& v)
const
74 typedef typename with<T>::ret fun_t;
79 template <
typename T,
typename R>
80 void set(T& v,
const R& r)
const
84 typedef typename with<T>::ret fun_t;
90 void init(
const U& value)
92 state_ = mln::trait::function::internal::introspect::has_storage_t<flag, void>::compute(value);
100 unary(
const U& param)
105 stored<storage>& state()
110 const stored<storage>& state()
const
116 stored<storage> state_;
128 template <
typename F,
typename T>
129 struct set_unary_< mln::fun::internal::unary_with<F>,
mln::Object, T>
133 typedef mln::fun::spe::unary<F, T> ret;
135 static typename ret::result call(
const F& f,
const T& v)
137 return ret(f.state())(v);
145 template <
typename F,
typename G>
149 template <
typename T>
157 typedef typename identity<mln::fun::compose>::ret::template with<F, G>::ret ret;
159 static typename ret::result call(
const F& f,
const G& g)
175 #endif // ! MLN_FUN_UNARY_HH