Filip Konvi?ka ha escrito:
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 ]
Hello Filip, the problem you describe is only incidentally related with
Boost.MultiIndex (anyway, thank you for using the lib!): actually, it's a
manifestation of a symbol clash between Boost.Lambda and Boost.Bind:
#include
This can of course be fixed by using boost::lambda::_1, but I doubt that it is the expected behavior.
I guess the using declaration is a perfectly good solution if you don't use Boost.Bind in the offending translation unit: This is a well known problem with Boost.Bind defining its placeholders in an unnamed space (::_1,::_2,...), which causes ambiguity problems when combined with the "using namespace boost::lambda" directive. You might want to read the following thread for further info on the issue: http://lists.boost.org/Archives/boost/2004/11/76822.php AFAIK this is not currently being addressed in any way.
Can anyone please explain what I'm doing wrong?
HTH, Joaquín M López Muñoz Telefónica, Investigación y Desarrollo