On Sat, May 10, 2008 at 9:12 AM, Steven Watanabe
Ken Smith wrote:
Here is the code.
1 #include
2 #include 3 #if defined(INCLUDE_BOOST_BIND) 4 # include 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