BOOST_FOREACH not compiling with Multindex containers, Intel Compiler version 11

Hi, I use boost.Multindex in my code, to simulate std::map. The code works fine on VC++ 2003 and Intel Compiler 10, but after upgrading to ICL 11 (latest), I can't use BOOST_FOREACH macros like so: BOOST_FOREACH (const parameters_map::value_type &pv, params) { } The compiler throws up the following error: .\interaction_request_handler.cpp(192): error: operand types are incompatible ("boost::foreach_detail_::rvalue_probe<const parameters_map>" and "const parameters_map") BOOST_FOREACH (const parameters_map::value_type &pv, params) { everything else compiles fine. I am guessing that some automatic conversion is not being triggered in this compiler. Any hints as to what I can try tweaking to get this to compile? Else I will just have to expand all FOREACH macros manually... I am using Boost 1.35, and would rather not be forced to upgrade just yet (since I also use built components, and I remember it was quite time-consuming, building the required components with Intel manually since bjam support for it is spotty). Thanks

lipik wrote:
Hi,
I use boost.Multindex in my code, to simulate std::map. The code works fine on VC++ 2003 and Intel Compiler 10, but after upgrading to ICL 11 (latest), I can't use BOOST_FOREACH macros like so: BOOST_FOREACH (const parameters_map::value_type &pv, params) { }
The compiler throws up the following error:
.\interaction_request_handler.cpp(192): error: operand types are incompatible ("boost::foreach_detail_::rvalue_probe<const parameters_map>" and "const parameters_map") BOOST_FOREACH (const parameters_map::value_type &pv, params) {
I don't have access to this compiler, so I can't work on this. Perhaps someone with Intel 11 and time to spare can track it down and submit a patch. In the mean time, you can try turning off rvalue detection by defining BOOST_FOREACH_NO_RVALUE_DETECTION. But then you can't use BOOST_FOREACH on rvalue sequence expressions. -- Eric Niebler BoostPro Computing http://www.boostpro.com

Eric Niebler <eric <at> boost-consulting.com> writes:
lipik wrote:
Hi,
I use boost.Multindex in my code, to simulate std::map. The code works fine on VC++ 2003 and Intel Compiler 10, but after upgrading to ICL 11 (latest), I can't use BOOST_FOREACH macros like so:
[...]
In the mean time, you can try turning off rvalue detection by defining BOOST_FOREACH_NO_RVALUE_DETECTION. But then you can't use BOOST_FOREACH on rvalue sequence expressions.
I suspect it is not a simple case, since this compiles fine: typedef std::map<std::wstring, std::wstring> wsm; wsm sm_; BOOST_FOREACH(const wsm::value_type &sv, sm_) { wcslen(sv.first.c_str()); } The problem occurs where I have used Multindex to define maps (the value type is a pair-like class that has the 'second' member is marked mutable, because Multindex containers only expose the contained data as const). Oh, and it compiles with BOOST_FOREACH_NO_RVALUE_DETECTION defined. Thanks
participants (2)
-
Eric Niebler
-
lipik