$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [Boost-users] reference to _1 is ambiguous
From: Kenny Riddile (kfriddile_at_[hidden])
Date: 2009-03-18 10:52:49
Johan Nilsson wrote:
> Sandeep Gupta wrote:
>> Hi,
>>  This problem has appeared before on the list but in a different
>> context.  The following code
>>
>>
>>  std::vector<int> myvec;
>>  for_each(myvec, std::cout<<_1<<' ');
>>
>>  gives the error:
>>
>> Serializer.h:78: error: reference to _1 is ambiguous
>> /home/sandeep/Computing/boost_1_38_0/boost/lambda/core.hpp:69: error:
>> candidates are: const boost::lambda::placeholder1_type&
>> boost::lambda::<unnamed>::_1
>> /home/sandeep/Computing/boost_1_38_0/boost/bind/placeholders.hpp:54:
>> error:                 boost::arg<1> <unnamed>::_1
>> Serializer.h:78: error: reference to _1 is ambiguous
>>
>>
>> I believe boost/bind is getting included indirectly via some other
>> library.  I have tried several modification but none seem to work as I
>> was quite reluctant to post a third mail on the list.
> 
> Disregaring the bind inclusion part, what about:
> 
> for_each(myvec, std::cout << ::boost::lambda::_1 << ' ');
> 
> / Johan
This has come up before for me, and I've always solved it in a similar way.