6 Apr
2006
6 Apr
'06
8:42 a.m.
james.jones@firstinvestors.com wrote:
As to mapping, it would be nice to be able to write code like:
double v = expr1(x=5,y=10); double w = expr2(x=2,y=3,z=8);
I should think the Boost parameter library could handle this.
Actually, maybe you don't even need the Boost parameter library. Just define operator() on expression to ignore its arguments (then x=5, y=10 sets the values of x and y, and expr1 is then evaluated in that context).
I agree - this is a more natural notation, as it is closer to what a mathematician would write ("v = expr1(x, y) where x = 5 and y= 10"). Using arrows ("->") looks odd to a mathematician's eyes, as that means "maps to", and it is expr1 that does the mapping, not the variables.