|
Boost Users : |
From: Stephen Gross (sgross_at_[hidden])
Date: 2006-04-05 13:41:23
>> std::cout << a(_y is 5, _z is 10) << std::endl;
>I do think the idea of assigning inputs at the call site is important
which is what you've done. It would be nice to use the named parameter
library here if possible to get rid of the leading underscores.
I've played around a little with the parameter library, but it requires you
to pre-register variable names (I think???). With this system, you can
either use the underscore-letter name, or just wrap the name in the VAR()
macro (eg: Equation e = VAR(foo) + VAR(bar); cout << e(VAR(foo) is 9,
VAR(bar) is 10). )
>> class Equation
>Should be templated
Why?
>I don't know what this offers over boost bind and function. I use these
to do a lot of this type of stuff. As long as the number of parameters
are low, its easy to understand and you get some currying for free.
The idea is that the target users for this toolkit aren't power-users. Quite
the contrary: I work with a lot of scientists, and they have rudimentary
C/C++ skills. This system would let them write equations without having to
learn template syntax or, for that matter, much about function declarations.
>// I'd really like to do
>double v = f(x=x,y=y);
I think the system I've proposed will do what you're asking:
Equation f = _x + _y;
double v = f(_x is 5, _y is 8)
--Steve
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