Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2003-11-14 15:23:54

Daniel Wallin <dalwan01_at_[hidden]> writes:

>> I had this idea some time ago, but Peter Dimov pointed out that it
>> doesn't really prevent accidental ADL problems:
>> namespace my {
>> class X {};
>> template <class T>
>> garbage clone(T, X& x)
>> {
>> // not the same meaning for "clone"
>> }
>> }
>> lib::some_generic_algorithm(my::X());
> I might be mistaken, but that shouldn't compile should it? This should
> fail due to ambiguity, which isn't really an ADL problem in this case
> since my::clone() wasn't meant to be found.

I beg to differ. If it fails accidentally due to ambiguity it's
definitely a problem that wouldn't have happened without ADL. In some
cases there may not be a way to prevent the wrong clone from causing
ambiguity without modifying lib, which may be out of your control.

Dave Abrahams
Boost Consulting

Boost list run by bdawes at, gregod at, cpdaniel at, john at