|
Boost Users : |
From: Jesse Perla (jlp400_at_[hidden])
Date: 2008-08-08 14:13:51
Is there any way to get a normal function pointer out of a boost::function
(with its state and potential bindings)? I want to have the option of
calling existing optimization routines that are not functor aware. And
hopefully including Fortran and C functions as well? I imagine that any
solution to this would be hacky and potentially slow, but it would be nice
to have the option without porting every optimization routine.
Also, what is the general consensus on
http://www.codeproject.com/KB/cpp/FastDelegate.aspx these days? How much
faster is the overhead? From what I read in this link, it is virtually none
vs. 20nanoseconds'ish for boost::function. Are there any caveats or reasons
not to apply this widely (assuming that I am using only the Intel
compiler)? And am I able to hack out a function pointer out of this
library? Does using a binding library remove the speed of the fast
delegation?
Last, I am having a little trouble understanding the "forwarding problem" as
a library user. My main use-case is for dynamic programming. I will have a
function of 3-4 parameters (an euler equation or bellman iteration). I will
bind all but one of the parameters and then run an optimizer over the other
one. However, what values are bound will be in a foreach. (i.e. choose a
state space, foreach in statespace run optimizer to see policy function
choice for each point in the statespace. iterate...) . Is this going to
work with these libraries? Is boost::function combined with boost::binding
the most semantically correct way to do this? Am I going to run into
enormous overhead or the forwarding problem when I do this? Do nested
bindings add in linear overhead?
Thanks,
Jesse
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