Boost logo

Boost :

From: Brian McNamara (lorgon_at_[hidden])
Date: 2004-02-19 22:12:22


On Thu, Feb 19, 2004 at 04:54:36PM -0500, David Abrahams wrote:
> Unless I'm just observing a bug in Comeau, I've just discovered
> something.
...
> It seems that's true for qualified names, but when ADL is disabled
> with parentheses, names aren't bound until the point of instantiation:
>
> // lib.hpp
> namespace lib
> {
> template <class T> void f(T);
> template <class T> void g(T x)
> {
> (f)(x); // not bound here
> }
> }
>
> // user.cpp
> #include "lib.hpp"
> #include "user.hpp" // defines some user::f overload
>
> int main()
> {
> user::my_class x;
> lib::g(x); // calls user::f()
> }

The return of name-capture... I dunno enough about the standard to know
if this is a bug or not. I am curious what you mean by "when ADL is
disabled with parentheses": surely ADL is still needed for lib::g to
call user::f? I have seen parens around function names before as a
means to something, but can you give me the reminder-summary of what
the parens do? In the example, it looks like it is not ADL that is
disabled, but rather template hygiene.

(Despite the fact that no one wants to hear it, I would feel remiss if I
didn't play Chicken Little and say "Fool's gold! Qualified calls and
template specialization are the one true path to such customization!
All designs based on overloading or ADL will end in tears!")

-- 
-Brian McNamara (lorgon_at_[hidden])

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk