Boost logo

Boost Users :

Subject: Re: [Boost-users] [units,typeof] meta_multiply units?
From: Rupert Mazzucco (mazzucco_at_[hidden])
Date: 2009-09-11 10:11:11


> say I have a functor F which takes an argument of type
>
> F::arg_type = quantity<time>
>
> and returns a value of type
>
> F::ret_type = quantity<velocity>
>
> Now I want to write an integration function, which should
> return the correct type, something like
>
> template<class F>
> F::ret_type*F::arg_type // only conceptually
> integrate(F& f, typename F::arg_type a, typename F::arg_type b);
>
> so instantiating this with the above functor should produce a
> return type quantity<time*velocity==length>. How can I combine
> F::arg_type and F::ret_type to produce the correct return type
> for the function template?

Attempted to solve this with the help of boost.typeof:

  template<class F>
  BOOST_TYPEOF_TPL(F::ret_type() * F::arg_type())
  integrate(F& f, typename F::arg_type a, typename F::arg_type b);

but MVC9 produces a

   error C2064: term does not evaluate to a function taking 0 arguments

for the default constructor calls in the macro argument. Any ideas welcome.

Thanks

-- 
Rupert Mazzucco         <mazzucco_at_[hidden]>
Research Scholar, Evolution and Ecology Program
IIASA - Institute for Applied Systems Analysis
Schlossplatz 1, 2361 Laxenburg, Austria
Phone: +43 2236 807 522   Fax: +43 2236 713 13

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