Boost logo

Boost Users :

From: Eric Niebler (eric_at_[hidden])
Date: 2005-03-02 16:16:23


Arkadiy Vertleyb wrote:
>
>>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.
>>>

>
> It appears to be the same problem that I ran into a few month ago...
>
> This is a combination of two problems with GCC:
>
> 1) GCC STL uses unqualified function calls to its own functions, such as
> end() in this particular case;
> 2) GCC ADL finds class names along with function names.
>
> So, if an STL algorithm is used with a sequence whose value_type has
> anything related to boost::mpl namespace, and this algorithm uses
> unqualified call, and the appropriate MPL header is included, then the
> problem shows up.
>
> I think GCC people are fixing number 1 (which will make the problem go
> away), but I don't know if they are done yet (apparently not).

Sounds like the problem is not in STL but in GCC's implementation of
ADL, which is finding class names. In this case, the collision isn't in
STL, it is a collision of end() from Boost.Range and end<> from MPL.
Changing the STL implementation will *not* fix this problem. My
understanding of ADL is that it should be used to locate *function*
overloads. It is meaningless to find class names using ADL. Until gcc's
rules for ADL are fixed, this problem will persist.

-- 
Eric Niebler
Boost Consulting
www.boost-consulting.com

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