Boost logo

Boost Users :

From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2008-05-10 12:12:08


AMDG

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)

In Christ,
Steven Watanabe


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