Boost logo

Boost Users :

Subject: Re: [Boost-users] fusion::result_of::transform<Seq1,Seq2,F>
From: e r (erwann.rogard_at_[hidden])
Date: 2008-09-12 21:08:16


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!


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net