boost-proto

Static functions from boost.lambda or boost.phoenix

跟風遠走 提交于 2019-12-01 16:22:02
I regularly use boost.lambda (and phoenix) to define lambda functions in C++. I really like their polymorphic property, the simplicity of their representation and the way they make functional programming in C++ so much easier. In some cases, it's even cleaner and more readable (if you're used to reading them) to use them for defining small functions and naming them in the static scope. The way to store these functionals that resembles conventional functions the most is to capture them in a boost::function const boost::function<double(double,double)> add = _1+_2; But the problem is the runtime