What is the difference between Boost::bind and Boost Phoenix::bind?
Asked
Active
Viewed 1,853 times
1 Answers
15
phoenix::bind
is like lambda::bind
a function that returns an expression template that records that it has to call the given function. These are designed to work together with phoenix and lambda, respectively. As a result, they contain much more things. Like, the type they return overloads all possible operators so that their respective action can be recorded and executed later.
boost::bind
is "just" a binder. It will bind the function, and return a type that has the function call operator overloaded, and not much more.

Johannes Schaub - litb
- 496,577
- 130
- 894
- 1,212
-
2It's worth noting that in [Phoenix 3.0](http://www.boost.org/doc/libs/1_47_0/libs/phoenix/doc/html/index.html) (released in boost 1.47), `phoenix::bind` is [compatible](http://www.boost.org/doc/libs/1_47_0/libs/phoenix/doc/html/phoenix/modules/bind/compatibility_with_boost_bind.html) with `boost::bind`. Keeping in mind litb's response here, this means that you could use `phoenix::bind` in places where you previously used `boost::bind`, but I don't think it works the other way around (you can't use `boost::bind` inside a lambda and expect it to work just like `phoenix::bind`). – Stuart Berg Nov 30 '11 at 23:21