
e r wrote:
Steven Watanabe wrote:
AMDG
e r wrote:
// probably not what result_of::transform expects, based on compile // errors (below) template<typename Metafun,typename Arg2> struct result{ typedef typename Metafun::type type; };
Fusion uses Boost.ResultOf. http://www.boost.org/doc/libs/1_36_0/libs/utility/utility.htm#result_of
In Christ, Steven Watanabe
Thanks. I read the link above before posting as well as the proposal:
//example from proposal. struct square_ { template<typename T> struct result { typedef T type; }
template<typename T> T operator()(T& x) const { return x*x; } };
but I'm not qualified enough to deduce the right answer in my case. i thought id would be like this:
template<typename Arg1> struct fun{ template<typename Metafun,typename Arg2> struct result{ typedef typename Metafun::type type; };
template<typename Metafun,typename Arg2> typename Metafun::type operator()(const Metafun& meta,const Arg2& arg2)const{ typedef typename Metafun::type result_type; return result_type(args,arg2); } };
but apparently it's not correct. I guess I can't fully make sense of F::result<F(T1, T2, ..., TN)>::type. any hint here would be really helpful.
thanks!
I may have made a little bit of progress here... struct fun{ template<typename Signature> struct result; template<typename A> struct result<fun(const A&)>{ typedef A type; }; template<typename A> A operator()(const A& a)const{ return A(); }; }; typedef boost::result_of<fun(const my&)>::type result_type; BOOST_MPL_ASSERT( ( mpl::is_same< result_type, my > ) );