Boost logo

Boost Users :

Subject: Re: [Boost-users] [Fwd: boost::bind vs. boost::lambda::bind - bug]
From: Bill Buklis (boostuser_at_[hidden])
Date: 2009-12-29 11:57:44


> -----Original Message-----
> From: Chris Hite [mailto:C.Hite_at_[hidden]]
>
> #include <boost/lambda/bind.hpp>
> #include <boost/bind.hpp> //comment this line out and it compiles
>
> int foo(const char*);
>
> void test(){
> using namespace boost::lambda;
> bind(foo,_1);
> }
>

You've created a conflict among the placeholders. Both bind and lambda::bind
declare _1. bind declares its placeholders at global scope, but lambda
includes in the lambda namespace.

Either use one or the other or don't use the "using namespace
boost::lambda". What I usually do is alias the lambda namespace for brevity.

#include <boost/lambda/bind.hpp>
#include <boost/bind.hpp>

namespace bll = boost::lambda;

void test()
{
   bll::bind(foo, bll::_1);
}

There has been talk about merging these, but I'm not sure the status is. Of
course, with bind becoming part of the standard that may be difficult.

-- Bill --


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net