Eelis van der Weegen wrote:
I'm having trouble using BOOST_FOREACH to iterate over Boost.MultiIndex containers. I've attached a testcase, which fails to compile because of what looks like an ADL collision between range_iterator's end() and boost::mpl::end.
I'm using GCC 3.4.2 with foreach.hpp revision 1.22 from the sandbox. Others have reported that GCC 4.0.0 20050130 is also affected.
(I'm aware that BOOST_FOREACH isn't part of Boost yet, but it's in the review queue so I thought posting this here was appropriate.)
I can reproduce the problem with gcc 3.3.3 (cygwin), but the problem does not reproduce with Visual C++. I'm a bit at a loss here. There is really no problem with BOOST_FOREACH or with its use of Boost.Range or with Boost.MPL that I can see. It would seem to be a compiler problem. I don't know why ADL is finding a class name, and I'm not sure what a suitable work-around should be. I'll give it some thought. Actually, I seem to recall reading about this problem (there might even be a defect report already). If anybody can refresh my memory, I'd appreciate it. -- Eric Niebler Boost Consulting www.boost-consulting.com