Boost logo

Boost Users :

From: Filip Konvička (filip.konvicka_at_[hidden])
Date: 2007-03-13 04:28:30


Hi,

getting lambda work with multi_index seems a bit tough for me....
the following compiles fine with MSVC++ 2003, but not when I #include
sequenced_index.hpp or ordered_index.hpp.

The error message says:
error C2872: '_1' : ambiguous symbol
         could be
'c:\Boost\include\boost-1_33_1\boost\lambda\core.hpp(69) : const
boost::lambda::placeholder1_type &boost::lambda::`anonymous-namespace'::_1'
         or
'c:\Boost\include\boost-1_33_1\boost\bind\placeholders.hpp(42) :
boost::arg<I> `anonymous-namespace'::_1'
         with
         [
             I=1
         ]

This can of course be fixed by using boost::lambda::_1, but I doubt that
it is the expected behavior.

Can anyone please explain what I'm doing wrong?

Thanks,
Filip

#include <boost/config.hpp>
#include <boost/lambda/lambda.hpp>
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/member.hpp>
#include <boost/multi_index/hashed_index.hpp>
//#include <boost/multi_index/sequenced_index.hpp>
//#include <boost/multi_index/ordered_index.hpp>
#include <list>

using namespace boost;
using namespace boost::lambda;

int main(int argc, char* argv[])
{
     std::list<int> v(10);
     for_each(v.begin(), v.end(), _1 = 1);
     return 0;
}


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