Boost logo

Boost Users :

From: Ken Smith (kgsmith_at_[hidden])
Date: 2008-05-12 13:34:26


On Sat, May 10, 2008 at 9:12 AM, Steven Watanabe <watanabesj_at_[hidden]> wrote:
> Ken Smith wrote:
> > Here is the code.
> >
> > 1 #include <boost/lambda/lambda.hpp>
> > 2 #include <boost/lambda/construct.hpp>
> > 3 #if defined(INCLUDE_BOOST_BIND)
> > 4 # include <boost/bind.hpp>
> > 5 #endif
> > 6 #include <iostream>
> > 7 #include <iterator>
> > 8 #include <algorithm>
> > 30
> > 31 int main()
> > 32 {
> > 33 using namespace std;
> > 34 using namespace boost::lambda;
> > 35
> > 36 typedef std::istream_iterator<int> in;
> > 37 std::for_each(in(std::cin), in(), std::cout << (_1 * 3) << " " );
> > 76 }
> >
> > Any ideas?
> >
>
> Boost.Bind declares the placeholders _1, _2, etc at global scope.
> Boost.Lambda declares the placeholders _1, _2, and _3 in namespace
> boost::lambda.
> The use of _1 in this context is ambiguous. Try qualifying it.
> namespace bll = boost::lambda;
>
> (bll::_1 * 3)

Thanks for this idea. I was also able to solve this problem by changing

using namespace boost::lambda;

to

using boost::lambda::_1;

   Ken


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