phoenix bind vs boost bind?
First of all, I'm using boost 1.55.0 on MSVC9. I've been using boost::phoenix in various places in my code base for easier usage of std::for_each and friends. However, I do not create lazy functions for a lot of the functions I bind to because they are only needed in one place most of the time. As a result, I use boost::phoenix::bind the same as I'd use boost::bind(). However I have read in various places that boost::bind is being deprecated. I'm not sure if there is truth to this, but is there a reason to choose one over the other? Is phx::bind() basically an "upgrade" to boost::bind? If I intermingle them, I have a lot of issues out of placeholder ambiguities that results in more boilerplate code (i.e. using boost::phoenix::placeholders::_1 everywhere). Any tips? I haven't used boost in a few years so I just want to make sure I'm not using it incorrectly. Thanks in advance.
On 08/04/14 14:40, Robert Dailey wrote:
If I intermingle them, I have a lot of issues out of placeholder ambiguities that results in more boilerplate code (i.e. using boost::phoenix::placeholders::_1 everywhere).
You should be able to use arg1 instead, they are the same type: https://github.com/boostorg/phoenix/blob/88b1eb2837e64e1808d755844fe1f868119... Albert
On Thu, Apr 10, 2014 at 3:42 PM, Vee Kay
On 08/04/14 14:40, Robert Dailey wrote:
If I intermingle them, I have a lot of issues out of placeholder ambiguities that results in more boilerplate code (i.e. using boost::phoenix::placeholders::_1 everywhere).
You should be able to use arg1 instead, they are the same type:
https://github.com/boostorg/phoenix/blob/88b1eb2837e64e1808d755844fe1f868119...
By convention I use _1 placeholders because I'm familiar with those from boost::bind. In any case, this doesn't particularly answer the root of my question which is: which one (which bind, not which placeholders) should I be using?
On 12/04/14 20:49, Robert Dailey wrote:
In any case, this doesn't particularly answer the root of my question which is: which one (which bind, not which placeholders) should I be using?
Not seen anything that contradicts what is said here: http://www.boost.org/doc/libs/1_55_0/libs/phoenix/doc/html/phoenix/modules/b... Not sure what makes you think boost::bind is deprecated either - on the contrary, the C++11 standard includes a similar bind() (deprecating its older ones). Albert
My advice would be to use std::bind() if your compiler supports it, unless
you explicitly need one of the other ones for some reason. Standard is
almost always better.
On Sat, Apr 12, 2014 at 4:06 PM, Albert Yiamakis
On 12/04/14 20:49, Robert Dailey wrote:
In any case, this doesn't particularly answer the root of my question which is: which one (which bind, not which placeholders) should I be using?
Not seen anything that contradicts what is said here:
http://www.boost.org/doc/libs/1_55_0/libs/phoenix/doc/html/phoenix/modules/b...
Not sure what makes you think boost::bind is deprecated either - on the contrary, the C++11 standard includes a similar bind() (deprecating its older ones).
Albert _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
On 12/04/2014 21:49, Robert Dailey wrote:
(...) In any case, this doesn't particularly answer the root of my question which is: which one (which bind, not which placeholders) should I be using?
Boost.Bind is limited to 9 arguments so if you need more you don't have much of a choice (Boost.Lambda has 10, only Boost.Phoenix has more). Other than that I tend to use Boost.Bind most of the time because it's much lighter than Boost.Phoenix which tends to hit compile times quite badly from my experience... MAT.
On Sun, Apr 13, 2014 at 2:18 AM, Mathieu Champlon
On 12/04/2014 21:49, Robert Dailey wrote:
(...) In any case, this doesn't particularly answer the
root of my question which is: which one (which bind, not which placeholders) should I be using?
Boost.Bind is limited to 9 arguments so if you need more you don't have much of a choice (Boost.Lambda has 10, only Boost.Phoenix has more). Other than that I tend to use Boost.Bind most of the time because it's much lighter than Boost.Phoenix which tends to hit compile times quite badly from my experience...
Perfect answer. This is exactly what I was looking for. Thanks to everyone for the help.
participants (5)
-
Albert Yiamakis
-
Lindley French
-
Mathieu Champlon
-
Robert Dailey
-
Vee Kay