What is the difference between Boost::bind and Boost Phoenix::bind?
What is the difference between Boost::bind and Boost Phoenix::bind?
Asked Answered
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.
© 2022 - 2024 — McMap. All rights reserved.
phoenix::bind
is compatible withboost::bind
. Keeping in mind litb's response here, this means that you could usephoenix::bind
in places where you previously usedboost::bind
, but I don't think it works the other way around (you can't useboost::bind
inside a lambda and expect it to work just likephoenix::bind
). – Sabbatical