On Sat, Nov 6, 2010 at 2:19 PM, Dave Abrahams
On Sat, Nov 6, 2010 at 5:19 AM, alfC
wrote: (Note, named parameter boost library is not the proper way to go here because the of the level of instrospection I need in the functions, and because the use of named parameters is not to omit passing parameters but to recognize 'externally' certain parameters).
I would be *very* surprised if there was some kind of introspection possible that Boost.Parameter didn't allow. And I don't understand what you mean about omitting passing parameters or external recognition. I think you're reinventing the wheel; a Boost.Parameter ArgumentPack is essentially a fusion map.
ok, since I am probably missing the point, I am going to be one order of
magnitude more specific in defining what I want to achieve.
In the following example I will mix C++ and mathematical language to make
the point clear.
In "math", one can define a function of parameters and with some abuse of
notation one can use the names of parameters to define functionals (e.g.
derivatives), so for example
H(p,q) = p*p + q;
which can be evaluated, e.g. H(1.,2.) == 3. but one can also "invoke" the
derivatives of H,
dH/dq(1.,2.) == 4.
To be consistent with the abuse of notation one can also say H(p=1., q=2.)
or even H(q=2.,p=1), etc. It is this degree of notational flexibility what I
would like to achieve.
Let's switch to C++
double H(double p, double q){
return p*p+q;
}
if I call H(1.,2.) I get of course the desired result. I would also like to
call something like
d (1.,2.));
H(make_set(1.,2.));
or even as H(1.,2.)
now the derivative problem:
suppose I already have a magical templated function, called 'derivative'
that returns the numerical derivative of a function or function object, when
this function has only one argument.
template --
Dave Abrahams
BoostPro Computing
http://www.boostpro.com
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users --
Sie haben diese Nachricht erhalten, da Sie der Google Groups-Gruppe Boost
Users beigetreten sind.
Wenn Sie Nachrichten in dieser Gruppe posten möchten, senden Sie eine
E-Mail an boostusers@googlegroups.com.
Wenn Sie aus dieser Gruppe austreten möchten, senden Sie eine E-Mail an
boostusers+unsubscribe@googlegroups.com > const& args){
return at_key<p>(args)*at_key<p>(args) + at_key<q>(args);
// same as return H(at_key<p>(args), at_key<q>(args));
}
great, now the compiler has some idea of what the parameters are.
I can call this function as
H(make_map