On 11/07/10 13:07, Alfredo Correa wrote: [snip]
template
double derivative(double const& x){ ...already defined... } double f(double x){return x*x;}
used as derivative<f>(1.);
the question is how to define a function "d" that takes a function like H with fusion container arguments, bind it against all arguments except one and calls derivative on that function. For example
d
(1.,2.); internally, the code should bind all the parameters except q to its corresponding values in the argument. in this case it is H binded with p=1. and then *derivative* of H( __, 2.) is called with argument 1.
[snip]
What about just creating a fusion::vector for tuple containing
an initial value, then store that into a templated functor taking the
free variable index as one of the template arguments, and then the
operator()(double value) would use value to set the tuple at the
template index and then call the function. For example:
//{-- free_at.hpp --
template
< typename Tuple//e.g. fusion::vector
struct free_at
: Tuple
{
Functor
functor
;
template