What is the difference between Boost::bind and Boost Phoenix::bind?
Asked Answered
M

1

14

What is the difference between Boost::bind and Boost Phoenix::bind?

Monocarpic answered 14/8, 2009 at 14:25 Comment(0)
E
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.

Eroticism answered 14/8, 2009 at 15:13 Comment(1)
It's worth noting that in Phoenix 3.0 (released in boost 1.47), phoenix::bind is compatible 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).Sabbatical

© 2022 - 2024 — McMap. All rights reserved.